JSON-Schema-Test-Suite
JSON-Schema-Test-Suite copied to clipboard
test needed to show that transclusion of $ref into allOf changes the evaluation outcome
see https://json-schema.slack.com/archives/CT7FF623C/p1603727881177900?thread_ts=1603504778.173300&cid=CT7FF623C
Basically, we need a test to show that changing this:
{
"$ref": "some subschema that generates annotations",
"unevaluatedProperties": { ... },
}
to this:
{
"allOf": [
< that same subschema that generates annotations, included directly here... >,
"unevaluatedProperties": { ... }
],
}
...does not always yield the same result, sibling keywords in a subschema can see annotations produced by earlier-evaluating siblings, but subchemas under allOf siblings cannot see each other's annotation results.
Therefore, this is not a reliable mechanism of transcluding/bundling referenced subschemas into the same schema.
cc @Relequestual
~You need to move the unevalated* out of the allOf to make that work right.~
Oh, I see. You're saying these are not the same, which is correct. But if you move the unevaluated* out of the allOf, then they become semantically the same.
I don't follow.. if unevaluatedProperties is the consumer of the annotations, it doesn't matter if the keywords are siblings or underneath an allOf. In both cases, the other keywords run first and unevaluatedProperties runs later.
If unevaluatedProperties is the producer of the annotations for some other keyword to consume, then that would be different, but the only keyword that consumes the unevaluatedProperties annotation is unevaluatedProperties itself, so I doubt that's what was intended here.
Hey! I am writing an example below, tell me if this matches what is expected:
{
"properties":{
"foo": { "const": 11}
},
"allOf":[
{
"properties":{
"baz": {"type": "string"}
},
"unevaluatedProperties": false
}
]
}
--- this produces validation false
{
"properties":{
"foo": { "const": 11}
},
"$ref": "#/$defs/bar",
"unevaluatedProperties": false,
"$defs":{
"bar":{
"properties":{
"baz": {"type": "string"}
}
}
}
}
--- and this produces true result.
for the instance:
{"foo":11, "baz": "hello"}
@gregsdennis @jdesrosiers @Julian