Reputation: 1
For example, need to validate field GRADE - not blank string (which can be converted to integer) or integer between 1 and 1000
Upvotes: 0
Views: 73
Reputation: 1817
The most basic definition would be:
"GRADE": {
"type": ["string", "integer"],
"pattern": "^[0-9]+$"
}
Take a look at the pattern
keyword as described in detail here: https://json-schema.org/understanding-json-schema/reference/string.html#id6
You can define a regular expression that meets your exact requirements for the GRADE field.
Upvotes: 1