Closed Julian closed 2 years ago
This is a good find.
I would argue that objects with only unrecognized keywords aren't "empty schemas." These schemas would produce annotations for each of the unknown keywords. This is explicitly different behavior than the true
and zero-property-object schemas.
Yes, this should be fixed, thanks! The first part dates from when unknown keywords SHOULD be ignored but really now that they're SHOULD collect as annotations it makes even less sense.
§4.3.1 ends with:
(emphasis mine)
while §4.3.2 ends with:
(emphasis again mine)
But if schemas with unknown properties are also defined to be "empty", then they indeed aren't unambiguous, there are instead an infinite number of them.
I'm not sure why we define empty schemas to include those with unknown keywords, though it seems that has been there forever.
If we stick with that definition it seems we should remove the offhand remark in 4.3.2 and just treat them the same (i.e. say something like both
true
andfalse
are intended to be "canonical ways" to express those notions).But personally if there's not a good reason to I'd re-define empty schemas to refer simply to the schema
{}
(n.b. or if there's some complication there due to$schema
being mandatory, perhaps be either{}
or{"$schema" : "..."}
though that seems hairy...)