-
-
Notifications
You must be signed in to change notification settings - Fork 338
Description
For the purpose of this issue (and consistent with #1306), "schema ___location behavior" means that a keyword indicates that some part(s) of its value are schemas and MUST be recognized as such by an implementation. Being "recognized" means that an implementation knows to scan it for $id
, $anchor
, etc. and associates the IRIs they create with the schema, along with the JSON Pointer fragment IRI (it's irrelevant whether any of this is done on load or at runtime).
$defs
only has schema ___location behavior- all inline (as opposed to by-reference) applicators inherently have schema ___location behavior
2020-12 classifies $defs
as a ___location keyword, but the concept of "___location keyword" is somewhat muddled.
Schemas located through this behavior can be targeted by $ref
(or anything else that might reference schemas with an IRI). I think we generally agree that $ref
-ing into applicators is a bad practice, but we don't (currently) forbid it. TBH, I wouldn't mind forbidding it, but I suspect I'm in the minority.
contentSchema
is defined as an annotation, and was not intended to have schema ___location behavior. $ref
-ing into contentSchema
is definitely at least as bad a practice as $ref
-ing into an inline applicator.
My preference would be to forbid it by saying that contentSchema
lacks this behavior. Framing it in terms of schema ___location behavior would make this part of the JSON Schema system rather than a weird exception.
As noted in #1288, @jdesrosiers would prefer that contentSchema
have schema ___location behavior.
I'd like to get more opinions on this point, which doesn't change the outcome of #1288. So it's not necessary to read through all of that issue.
An alternative would be to change contentSchema
from taking a schema to taking a string containing a schema. Which I almost did when I added it to ensure it was treated as data. If anyone likes this idea please speak up, but I am not expecting it to be popular.