Skip to content

Commit

Permalink
update note about processing contentSchema subschema in context
Browse files Browse the repository at this point in the history
  • Loading branch information
gregsdennis committed Nov 23, 2024
1 parent d1c8642 commit ef68f56
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions specs/jsonschema-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,18 @@ Since `contentMediaType` is required to provide instruction on how to interpret
string content, the annotation schema produced by this keyword has no meaning if
`contentMediaType` is not present.

Accessing the schema through the schema location IRI included as part of the
annotation will ensure that it is correctly processed as a subschema. Using the
extracted annotation value directly is only safe if the subschema is an embedded
resource with both `$schema` and an absolute IRI `$id`.
Note that evaluating the `contentSchema` subschema in-place (i.e. as part of its
parent schema) will ensure that it is correctly processed. Independent use of
the extracted subschema (as returned in an annotation) is only safe if the
subschema is an embedded reource which defines both a `$schema` and an absolute
IRI `$id`.[^7]

[^7] Processing a non-resource subschema in place will ensure that any
references (e.g. `$ref`) are always resolved properly. This isn't a problem when
the subschema is itself a resource. See
https://github.com/json-schema-org/json-schema-spec/issues/1381 for several
examples where processing this subschema independently can cause `$ref`
resolution failure.

### Example

Expand Down

0 comments on commit ef68f56

Please sign in to comment.