Reputation: 579
I am using https://github.com/everit-org/json-schema library to do serverside validation for JSONSchema it is failing when i use dataref in maximum validation
my schema property is like
"fromYear": {
"array": false,
"type": "number",
"title": "From Year",
"minimum": {
"$data": "1/toYear"
},
"key": "fromYear",
"required": false
}
but when we call validate method of Schema then it throws error like
"#/properties/qualificationsection/items/properties/fromYear/minimum: expected type: Number, found: JsonObject"
JSON Schema supports minimum number as well as a jsonobject (ie., it supports union types) where we can specify data ref.
The library is unable to deal with this as is expecting minumum to always be of type number
Upvotes: 0
Views: 356
Reputation: 12315
$data
is not a JSON Schema keyword at current (draft-7).
Some libraries attempt to implement it, as it is a suggestion for future drafts, but it is not currently part of the official specification.
There's no alternative to this. It simply isn't currently possible.
Upvotes: 1