Skip to content

Commit b5c7bfb

Browse files
committed
add $schema inheritance details; rework and add that implemnetations are not required to support media type parameter inputs
1 parent 044298c commit b5c7bfb

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

jsonschema-core.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,10 @@ meta-schema features emphasizes flexibility over simplicity.
884884

885885
The `$schema` keyword is both used as a JSON Schema dialect identifier and as
886886
the identifier of a resource which is itself a JSON Schema, which describes the
887-
set of valid schemas written for this particular dialect.
887+
set of valid schemas written for this particular dialect. The identified dialect
888+
applies to the resource in which it is declared as well as any embedded schema
889+
resources, unless such a resource itself declares a different dialect by
890+
including the `$schema` keyword with a different value.
888891

889892
The value of this keyword MUST be an [IRI](#rfc3987) (containing a scheme) and
890893
this IRI MUST be normalized. The current schema MUST be valid against the
@@ -894,20 +897,21 @@ If this IRI identifies a retrievable resource, that resource SHOULD be of media
894897
type `application/schema+json`.
895898

896899
The `$schema` keyword SHOULD be used in the document root schema object, and MAY
897-
be used in the root schema objects of embedded schema resources. It MUST NOT
898-
appear in non-resource root schema objects.
900+
be used in the root schema objects of embedded schema resources. When the
901+
keyword appears in non-resource root schema object, the behavior is undefined.
899902

900-
If present in the document root schema, an implementation MUST process the
903+
If present in the resource root schema, an implementation MUST process the
901904
schema in accordance with the associated dialect.
902905

903-
If absent from the document root schema, and an `application/schema+json` media
904-
type with a `schema` parameter is available, then the schema MUST be processed
905-
in accordance with the dialect indicated by the `schema` parameter.
906+
If absent from the resource root schema, and no parent dialect is defined, the
907+
schema MUST be processed with the following priorities:
906908

907-
For cases where the `$schema` keyword is absent from the document root, no media
908-
type is provided, and/or the media type has no `schema` parameter, an
909-
implementation MAY offer a mechanism for the user to explicitly set the
910-
dialect.
909+
1. If the implementation accepts media type parameter inputs, and an
910+
`application/schema+json` media type with a `schema` parameter is available,
911+
then the schema MUST be processed in accordance with the dialect indicated by
912+
the `schema` parameter.
913+
2. An implementation MAY offer a mechanism for the user to explicitly set the
914+
dialect.
911915

912916
If the dialect is not specified through one of these methods, the implementation
913917
MUST refuse to process the schema, as with unsupported required vocabularies.

0 commit comments

Comments
 (0)