Skip to content

Commit

Permalink
clarify that contentSchema holds a subschema and when/how it applies
Browse files Browse the repository at this point in the history
  • Loading branch information
gregsdennis committed Nov 21, 2024
1 parent e3a87d4 commit 487a36c
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions specs/jsonschema-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,19 +532,24 @@ defined by [RFC 2046](#rfc2046).

### `contentSchema`

If the instance is a string, and if `contentMediaType` is present, this property
contains a schema which describes the structure of the string.
If the instance is a string, and if `contentMediaType` is present, this
property's subschema describes the structure of the string.

This keyword MAY be used with any media type that can be mapped into JSON
Schema's data model. Specifying such mappings is outside of the scope of this
specification.

The value of this property MUST be a valid JSON schema. It SHOULD be ignored 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 schema is an embedded resource with both `$schema` and an
absolute IRI `$id`.
The value of this property MUST be a valid JSON schema. The subschema is
produced as an annotation.

Since `contentMediaType` is required to provide instruction on how to interpret
the 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`.

### Example

Expand Down

0 comments on commit 487a36c

Please sign in to comment.