Proposal: Vocabularies are Always Mandatory #342
Replies: 4 comments 10 replies
-
Whether optional vocabularies make sense or not depends on what "optional" means. I think we can define it a way where it makes sense, even if it's not quite as useful as it used to be. I would define an "optional" vocabulary to mean that implementations for the keywords in that library are optional. An implementation would need to "know" all vocabularies in For example, my implementation doesn't support the "format-assertion" version of This discussion is about reconciling optional vocabularies with forbidding unknown keywords. I think this approach does that in the least intrusive way. However, I think there's a less urgent discussion we should probably have about whether we think it even makes sense for the vocabulary system to have a concept of optional vocabularies. |
Beta Was this translation helpful? Give feedback.
-
It's worth pointing out that the current document (in GitHub) also recognizes this relationship:
The direct consequence of this is that if unsupported optional vocabularies create unrecognized keywords, and unrecognized keywords are forbidden, then optional vocabularies are actually required. |
Beta Was this translation helpful? Give feedback.
-
I think the only way out here (to continue allowing a vocabulary to be specified as The other useful usecase for true/false vocabularies is where two vocabularies define the same set of keywords, and the schema has the option of deciding which to support - e.g. the two format vocabularies which both define |
Beta Was this translation helpful? Give feedback.
-
I would like to point out that @Relequestual also (and independently) noticed this conflict when attempting to remove support for unknown keywords. |
Beta Was this translation helpful? Give feedback.
-
Previously, on JSON Schema Discussions:
Currently, a vocabulary is listed in a meta-schema by URI ID along with a boolean value that indicates the required behavior for an implementation that does not understand the vocabulary:
true
, then the implementation MUST refuse to process the schema.false
, then the implementation MAY continue to process the schema.The second case,
false
, means the vocabulary is considered "optional" in that it's not required that the implementation understand the vocabulary.However, now that we've said unknown keywords are disallowed, we have a conundrum:
The keywords in an unknown vocabulary are themselves unknown, and implementations MUST refuse to process them. But this means that implementations no longer have the option to continue processing. Therefore the
false
case now indirectly requires the same behavior as thetrue
case.Thus, if implementations must refuse to process schemas with unknown keywords, a vocabulary can't really be optional, and the true/false values are meaningless.
The fallout from this is that the syntax of the
$vocabulary
keyworddoesn't really make sense anymore.
Should we change the keyword to just an array of URI IDs? Do something else?
The format of this keyword was never really solidified as vocabularies as a feature are still being developed, so I don't mind keeping its definition a bit fluid for now.
Beta Was this translation helpful? Give feedback.
All reactions