Using njsonschema, I want to generate a schema that will ensure that all values written to a dictionary will be validated against a regex pattern.
Consider the following class:
class File
{
[RegularExpression("^\\d+\\.\\d+\\.\\d+\\.\\d+$")]
public Dictionary<string, string> Versions { get; set; }
}
The schema part that I wish that njsonschema would generate is:
"Versions": {
"type": "object",
"additionalProperties": {
"type": "string",
"pattern": "^\\d+\\.\\d+\\.\\d+\\.\\d+$"
}
}
Instaed, njsonschema generates something like this:
"Versions": {
"type": "object",
"pattern": "^\\d+\\.\\d+\\.\\d+\\.\\d+$",
"additionalProperties": {
"type": "string"
}
}
Is there any way to acheive this?
Thanks in advance!