@@ -875,7 +875,9 @@ The meta-schema serves two purposes:
875
875
Declaring the vocabularies in use: The ` $vocabulary ` keyword, when it appears in
876
876
a meta-schema, declares which vocabularies are available to be used in schemas
877
877
that refer to that meta-schema. Vocabularies define keyword semantics, as well
878
- as their general syntax.
878
+ as their general syntax. By combining various vocabularies, distinct
879
+ sets of keywords can be made available for use in a schema. This collection of
880
+ vocabularies defines a dialect.
879
881
880
882
Describing valid schema syntax: A schema MUST successfully validate against its
881
883
meta-schema, which constrains the syntax of the available keywords. The syntax
@@ -893,29 +895,51 @@ vocabulary's keywords.
893
895
Meta-schema authoring is an advanced usage of JSON Schema, so the design of
894
896
meta-schema features emphasizes flexibility over simplicity.
895
897
898
+ #### Dialect Determination
899
+
900
+ When evaluation encounters a new schema resource (i.e. the lexical scope
901
+ changes), the first task is to determine the dialect used by the schema.
902
+ Implementations MUST determine the dialect using the following prioritized
903
+ steps.
904
+
905
+ 1 . The ` $schema ` keyword - Implementations MUST process the schema according to
906
+ the dialect it declares.
907
+ 2 . ` application/schema+json ` media type with a ` schema ` parameter -
908
+ Implementations which support media type parameter inputs MUST process the
909
+ schema according to the dialect the parameter declares. A media type will
910
+ generally only be available if the schema has been retrieved from an external
911
+ source and only applies to the document root.
912
+ 3 . Parent dialect - An embedded schema resource which does not itself contain a
913
+ ` $schema ` keyword MUST be processed using the same dialect as the schema
914
+ which contains it. If the schema is embedded in a non-schema document, the
915
+ semantics for determining the dialect MAY be determined by any specification
916
+ which applies to that document.
917
+ 4 . User configuration - Implementations MAY provide means for the user to
918
+ configure the dialect under which a schema should be processed.
919
+
920
+ (Note that steps 2 and 3 are mutually exclusive.)
921
+
922
+ If the dialect is not specified through one of these methods, the implementation
923
+ MUST refuse to process the schema, as with unsupported required vocabularies.
924
+
896
925
#### The ` $schema ` Keyword {#keyword-schema}
897
926
898
927
The ` $schema ` keyword is both used as a JSON Schema dialect identifier and as
899
928
the identifier of a resource which is itself a JSON Schema, which describes the
900
- set of valid schemas written for this particular dialect.
929
+ set of valid schemas written for this particular dialect. The identified dialect
930
+ applies to the resource in which it is declared as well as any embedded schema
931
+ resources, unless such a resource itself declares a different dialect by
932
+ including the ` $schema ` keyword with a different value.
901
933
902
- The value of this keyword MUST be a [ IRI] ( #rfc3987 ) (containing a scheme) and
903
- this IRI MUST be normalized. The current schema MUST be valid against the
904
- meta-schema identified by this IRI.
934
+ The value of this keyword MUST be an [ IRI] ( #rfc3987 ) (containing a scheme) and
935
+ this IRI MUST be normalized.
905
936
906
937
If this IRI identifies a retrievable resource, that resource SHOULD be of media
907
938
type ` application/schema+json ` .
908
939
909
940
The ` $schema ` keyword SHOULD be used in the document root schema object, and MAY
910
- be used in the root schema objects of embedded schema resources. It MUST NOT
911
- appear in non-resource root schema objects. If absent from the document root
912
- schema, the resulting behavior is implementation-defined, but MUST fall within
913
- the following options:
914
-
915
- - Refuse to process the schema, as with unsupported required vocabularies
916
- - Assume a specific, documented meta-schema
917
- - Document the process by which it examines the schema and determines which of a
918
- specific set of meta-schemas to assume
941
+ be used in the root schema objects of embedded schema resources. When the
942
+ keyword appears in a non-resource root schema object, the behavior is undefined.
919
943
920
944
Values for this property are defined elsewhere in this and other documents, and
921
945
by other parties.
0 commit comments