@@ -862,7 +862,9 @@ The meta-schema serves two purposes:
862
862
Declaring the vocabularies in use: The ` $vocabulary ` keyword, when it appears in
863
863
a meta-schema, declares which vocabularies are available to be used in schemas
864
864
that refer to that meta-schema. Vocabularies define keyword semantics, as well
865
- as their general syntax.
865
+ as their general syntax. By combining various vocabularies, distinct
866
+ sets of keywords can be made available for use in a schema. This collection of
867
+ vocabularies defines a dialect.
866
868
867
869
Describing valid schema syntax: A schema MUST successfully validate against its
868
870
meta-schema, which constrains the syntax of the available keywords. The syntax
@@ -880,6 +882,30 @@ vocabulary's keywords.
880
882
Meta-schema authoring is an advanced usage of JSON Schema, so the design of
881
883
meta-schema features emphasizes flexibility over simplicity.
882
884
885
+ ### Dialect Determination
886
+
887
+ When the schema evaluation process begins, the first task is to determine the
888
+ dialect used by the schema. To do this, implementations MUST determine the
889
+ dialect using the following prioritized steps.
890
+
891
+ 1 . The ` $schema ` keyword - Implementations MUST process the schema according to
892
+ the dialect it declares.
893
+ 2 . ` application/schema+json ` media type with a ` schema ` parameter -
894
+ Implementations which support media type parameter inputs MUST process the
895
+ schema according to the dialect the parameter declares. A media type will
896
+ generally only be available if the schema has been retrieved and only applies
897
+ to the document root.
898
+ 3 . Parent dialect - An embedded schema resource which does not itself contain a
899
+ ` $schema ` keyword MUST be processed using the same dialect as the schema
900
+ which contains it.
901
+ 4 . User configuration - Implementations MAY provide means for the user to
902
+ configure the dialect under which a schema should be processed.
903
+
904
+ (Note that steps 2 and 3 are mutually exclusive.)
905
+
906
+ If the dialect is not specified through one of these methods, the implementation
907
+ MUST refuse to process the schema, as with unsupported required vocabularies.
908
+
883
909
#### The ` $schema ` Keyword {#keyword-schema}
884
910
885
911
The ` $schema ` keyword is both used as a JSON Schema dialect identifier and as
@@ -900,22 +926,6 @@ The `$schema` keyword SHOULD be used in the document root schema object, and MAY
900
926
be used in the root schema objects of embedded schema resources. When the
901
927
keyword appears in non-resource root schema object, the behavior is undefined.
902
928
903
- If present in the resource root schema, an implementation MUST process the
904
- schema in accordance with the associated dialect.
905
-
906
- If absent from the resource root schema, and no parent dialect is defined, the
907
- schema MUST be processed with the following priorities:
908
-
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.
915
-
916
- If the dialect is not specified through one of these methods, the implementation
917
- MUST refuse to process the schema, as with unsupported required vocabularies.
918
-
919
929
Values for this property are defined elsewhere in this and other documents, and
920
930
by other parties.
921
931
0 commit comments