Reputation: 1
Trying to use $ref for the entirety of properties. I can't tell what this is syntax valid but doesn't validate the payload. This should fail but doesn't.
I've also tried "$ref": "file:./ref.json".
schema:
{
"animal": {
"properties":{
"allOf": {"$ref": "file:./ref.json"}
}
},
"required": ["animal"]
}
ref.json:
{
"action":{
"type": "string"
},
"required": ["action"]
}
payload
{
"animal": {
"action": 2
}
}
Upvotes: 0
Views: 1179
Reputation: 53966
"allOf": {"$ref": "file:./ref.json"}
is not syntactically valid -- the value of an allOf
must be an array. (your evaluator should be giving you a warning about this.)$ref
. (your evaluator should be giving you a warning when you reference an unknown resource.)The reason why you are not seeing the above errors is because your overall schema has no recognized keywords in it -- you are missing a "properties": { ... }
wrapped around the entire schema. The top level "keyword" is "animal", which is not recognized, therefore there are no recognized keywords anywhere in the schema, therefore there is nothing to make it return an invalid result.
Upvotes: 1