@@ -122,19 +122,14 @@ interpreted according to this data model is called an "instance".
122
122
An instance has one of six primitive types, and a range of possible values
123
123
depending on the type:
124
124
125
- null: A JSON "null" value
126
-
127
- boolean: A "true" or "false" value, from the JSON "true" or "false" value
128
-
129
- object: An unordered set of properties mapping a string to an instance, from the
130
- JSON "object" value
131
-
132
- array: An ordered list of instances, from the JSON "array" value
133
-
134
- number: An arbitrary-precision, base-10 decimal number value, from the JSON
135
- "number" value
136
-
137
- string: A string of Unicode code points, from the JSON "string" value
125
+ - * null* : A JSON "null" value
126
+ - boolean: A "true" or "false" value, from the JSON "true" or "false" value
127
+ - * object* : An unordered set of properties mapping a string to an instance, from
128
+ the JSON "object" value
129
+ - * array* : An ordered list of instances, from the JSON "array" value
130
+ - * number* : An arbitrary-precision, base-10 decimal number value, from the JSON
131
+ "number" value
132
+ - * string* : A string of Unicode code points, from the JSON "string" value
138
133
139
134
Whitespace and formatting concerns, including different lexical representations
140
135
of numbers that are equal within the data model, are thus outside the scope of
@@ -201,18 +196,14 @@ A JSON Schema MUST be an object or a boolean.
201
196
Object properties that are applied to the instance are called keywords, or
202
197
schema keywords. Broadly speaking, keywords fall into one of five categories:
203
198
204
- identifiers: control schema identification through setting a IRI for the schema
205
- and/or changing how the base IRI is determined
206
-
207
- assertions: produce a boolean result when applied to an instance
208
-
209
- annotations: attach information to an instance for application use
210
-
211
- applicators: apply one or more subschemas to a particular location in the
212
- instance, and combine or modify their results
213
-
214
- reserved locations: do not directly affect results, but reserve a place for a
215
- specific purpose to ensure interoperability
199
+ - * identifiers* : control schema identification through setting a IRI for the
200
+ schema and/or changing how the base IRI is determined
201
+ - * assertions* : produce a boolean result when applied to an instance
202
+ - * annotations* : attach information to an instance for application use
203
+ - * applicators* : apply one or more subschemas to a particular location in the
204
+ instance, and combine or modify their results
205
+ - * reserved locations* : do not directly affect results, but reserve a place for
206
+ a specific purpose to ensure interoperability
216
207
217
208
Keywords may fall into multiple categories, although applicators SHOULD only
218
209
produce assertion results based on their subschemas' results. They should not
@@ -241,9 +232,8 @@ schema processing optimizations. They behave identically to the following schema
241
232
objects (where ` not ` is part of the subschema application vocabulary defined in
242
233
this document).
243
234
244
- ` true ` : Always passes validation, as if the empty schema ` {} `
245
-
246
- ` false ` : Always fails validation, as if the schema ` { "not": {} } `
235
+ - ` true ` : Always passes validation, as if the empty schema ` {} `
236
+ - ` false ` : Always fails validation, as if the schema ` { "not": {} } `
247
237
248
238
While the empty schema object is unambiguous, there are many possible
249
239
equivalents to the ` false ` schema. Using the boolean values ensures that the
@@ -890,7 +880,7 @@ vocabulary's keywords.
890
880
Meta-schema authoring is an advanced usage of JSON Schema, so the design of
891
881
meta-schema features emphasizes flexibility over simplicity.
892
882
893
- #### The $schema Keyword {#keyword-schema}
883
+ #### The ` $schema ` Keyword {#keyword-schema}
894
884
895
885
The ` $schema ` keyword is both used as a JSON Schema dialect identifier and as
896
886
the identifier of a resource which is itself a JSON Schema, which describes the
@@ -917,7 +907,7 @@ the following options:
917
907
Values for this property are defined elsewhere in this and other documents, and
918
908
by other parties.
919
909
920
- #### The $vocabulary Keyword
910
+ #### The ` $vocabulary ` Keyword
921
911
922
912
The ` $vocabulary ` keyword is used in meta-schemas to identify the vocabularies
923
913
available for use in schemas described by that meta-schema, and whether each
@@ -1048,7 +1038,7 @@ Several keywords can accept a relative [IRI-reference](#rfc3987), or a value
1048
1038
used to construct a relative IRI-reference. For these keywords, it is necessary
1049
1039
to establish a base IRI in order to resolve the reference.
1050
1040
1051
- #### The $id Keyword {#id-keyword}
1041
+ #### The ` $id ` Keyword {#id-keyword}
1052
1042
1053
1043
The ` $id ` keyword identifies a schema resource with its [ canonical] ( #rfc6596 )
1054
1044
IRI.
@@ -1128,10 +1118,11 @@ as the same IRI through the use of `$id`, `$anchor`, `$dynamicAnchor`, or any
1128
1118
other mechanism, implementations SHOULD raise an error condition. Otherwise the
1129
1119
result is undefined, and even if documented will not be interoperable.
1130
1120
1131
- #### Schema References {#references} Several keywords can be used to reference a
1132
- schema which is to be applied to the current instance location. ` $ref ` and
1133
- ` $dynamicRef ` are applicator keywords, applying the referenced schema to the
1134
- instance.
1121
+ #### Schema References {#references}
1122
+
1123
+ Several keywords can be used to reference a schema which is to be applied to the
1124
+ current instance location. ` $ref ` and ` $dynamicRef ` are applicator keywords,
1125
+ applying the referenced schema to the instance.
1135
1126
1136
1127
As the values of ` $ref ` and ` $dynamicRef ` are IRI References, this allows the
1137
1128
possibility to externalise or divide a schema across multiple files, and
@@ -1143,7 +1134,7 @@ if it is a network-addressable URL, and implementations SHOULD NOT assume they
1143
1134
should perform a network operation when they encounter a network-addressable
1144
1135
IRI.
1145
1136
1146
- ##### Direct References with $ref {#ref}
1137
+ ##### Direct References with ` $ref ` {#ref}
1147
1138
1148
1139
The ` $ref ` keyword is an applicator that is used to reference a statically
1149
1140
identified schema. Its results are the results of the referenced schema.[ ^ 5 ]
@@ -1156,7 +1147,7 @@ Resolved against the current IRI base, it produces the IRI of the schema to
1156
1147
apply. This resolution is safe to perform on schema load, as the process of
1157
1148
evaluating an instance cannot change how the reference resolves.
1158
1149
1159
- ##### Dynamic References with $dynamicRef {#dynamic-ref}
1150
+ ##### Dynamic References with ` $dynamicRef ` {#dynamic-ref}
1160
1151
1161
1152
The ` $dynamicRef ` keyword is an applicator that allows for deferring the full
1162
1153
resolution until runtime, at which point it is resolved each time it is
@@ -1182,7 +1173,7 @@ For a full example using these keyword, see {{recursive-example}}.[^6]
1182
1173
[ ^ 6 ] : The difference between the hyper-schema meta-schema in pre-2019 drafts and
1183
1174
an this draft dramatically demonstrates the utility of these keywords.
1184
1175
1185
- #### Schema Re-Use With $defs {#defs}
1176
+ #### Schema Re-Use With ` $defs ` {#defs}
1186
1177
1187
1178
The ` $defs ` keyword reserves a location for schema authors to inline re-usable
1188
1179
JSON Schemas into a more general schema. The keyword does not directly affect
@@ -1207,7 +1198,7 @@ the positive integer constraint is a subschema in `$defs`:
1207
1198
}
1208
1199
```
1209
1200
1210
- ### Comments With $comment
1201
+ ### Comments With ` $comment `
1211
1202
1212
1203
This keyword reserves a location for comments from schema authors to readers or
1213
1204
maintainers of the schema.
@@ -1650,15 +1641,15 @@ annotation collection, although they enable the same annotation keyword to be
1650
1641
applied to an instance location with different values. Annotation keywords
1651
1642
define their own rules for combining such values.
1652
1643
1653
- ##### allOf {#allof}
1644
+ ##### ` allOf ` {#allof}
1654
1645
1655
1646
This keyword's value MUST be a non-empty array. Each item of the array MUST be a
1656
1647
valid JSON Schema.
1657
1648
1658
1649
An instance validates successfully against this keyword if it validates
1659
1650
successfully against all schemas defined by this keyword's value.
1660
1651
1661
- ##### anyOf
1652
+ ##### ` anyOf `
1662
1653
1663
1654
This keyword's value MUST be a non-empty array. Each item of the array MUST be a
1664
1655
valid JSON Schema.
@@ -1668,15 +1659,15 @@ successfully against at least one schema defined by this keyword's value. Note
1668
1659
that when annotations are being collected, all subschemas MUST be examined so
1669
1660
that annotations are collected from each subschema that validates successfully.
1670
1661
1671
- ##### oneOf
1662
+ ##### ` oneOf `
1672
1663
1673
1664
This keyword's value MUST be a non-empty array. Each item of the array MUST be a
1674
1665
valid JSON Schema.
1675
1666
1676
1667
An instance validates successfully against this keyword if it validates
1677
1668
successfully against exactly one schema defined by this keyword's value.
1678
1669
1679
- ##### not {#not}
1670
+ ##### ` not ` {#not}
1680
1671
1681
1672
This keyword's value MUST be a valid JSON Schema.
1682
1673
@@ -1698,7 +1689,7 @@ present. In particular, they MUST NOT be treated as if present with an empty
1698
1689
schema, and when ` if ` is not present, both ` then ` and ` else ` MUST be entirely
1699
1690
ignored.
1700
1691
1701
- ##### if
1692
+ ##### ` if `
1702
1693
1703
1694
This keyword's value MUST be a valid JSON Schema.
1704
1695
@@ -1716,7 +1707,7 @@ If [annotations](#annotations) are being collected, they are collected from this
1716
1707
keyword's subschema in the usual way, including when the keyword is present
1717
1708
without either ` then ` or ` else ` .
1718
1709
1719
- ##### then
1710
+ ##### ` then `
1720
1711
1721
1712
This keyword's value MUST be a valid JSON Schema.
1722
1713
@@ -1729,7 +1720,7 @@ validate against its subschema. Implementations MUST NOT evaluate the instance
1729
1720
against this keyword, for either validation or annotation collection purposes,
1730
1721
in such cases.
1731
1722
1732
- ##### else
1723
+ ##### ` else `
1733
1724
1734
1725
This keyword's value MUST be a valid JSON Schema.
1735
1726
@@ -1742,7 +1733,7 @@ successfully validates against its subschema. Implementations MUST NOT evaluate
1742
1733
the instance against this keyword, for either validation or annotation
1743
1734
collection purposes, in such cases.
1744
1735
1745
- ##### dependentSchemas
1736
+ ##### ` dependentSchemas `
1746
1737
1747
1738
This keyword specifies subschemas that are evaluated if the instance is an
1748
1739
object and contains a certain property.
@@ -1756,7 +1747,7 @@ property.
1756
1747
1757
1748
Omitting this keyword has the same behavior as an empty object.
1758
1749
1759
- ##### propertyDependencies
1750
+ ##### ` propertyDependencies `
1760
1751
1761
1752
This keyword specifies subschemas that are evaluated if the instance is an
1762
1753
object and contains a certain property with a certain string value.
@@ -1779,7 +1770,7 @@ results.
1779
1770
1780
1771
#### Keywords for Applying Subschemas to Arrays
1781
1772
1782
- ##### prefixItems
1773
+ ##### ` prefixItems `
1783
1774
1784
1775
The value of "prefixItems` MUST be a non-empty array of valid JSON Schemas.
1785
1776
@@ -1795,7 +1786,7 @@ keyword. This annotation affects the behavior of `items` and `unevaluatedItems`.
1795
1786
1796
1787
Omitting this keyword has the same assertion behavior as an empty array.
1797
1788
1798
- ##### items {#items}
1789
+ ##### ` items ` {#items}
1799
1790
1800
1791
The value of ` items ` MUST be a valid JSON Schema.
1801
1792
@@ -1825,7 +1816,7 @@ collection MUST do so.
1825
1816
1826
1817
#### Keywords for Applying Subschemas to Objects
1827
1818
1828
- ##### properties
1819
+ ##### ` properties `
1829
1820
1830
1821
The value of ` properties ` MUST be an object. Each value of this object MUST be a
1831
1822
valid JSON Schema.
@@ -1841,7 +1832,7 @@ the Unevaluated vocabulary.
1841
1832
1842
1833
Omitting this keyword has the same assertion behavior as an empty object.
1843
1834
1844
- ##### patternProperties
1835
+ ##### ` patternProperties `
1845
1836
1846
1837
The value of ` patternProperties ` MUST be an object. Each property name of this
1847
1838
object SHOULD be a valid regular expression, according to the ECMA-262 regular
@@ -1861,7 +1852,7 @@ behavior of `additionalProperties` (in this vocabulary) and
1861
1852
1862
1853
Omitting this keyword has the same assertion behavior as an empty object.
1863
1854
1864
- ##### additionalProperties {#additionalproperties}
1855
+ ##### ` additionalProperties ` {#additionalproperties}
1865
1856
1866
1857
The value of ` additionalProperties ` MUST be a valid JSON Schema.
1867
1858
@@ -1895,7 +1886,7 @@ failing schemas are dropped. See our [Decision
1895
1886
Record] ( https://github.com/json-schema-org/json-schema-spec/tree/HEAD/adr/2022-04-08-cref-for-ambiguity-and-fix-later-gh-spec-issue-1172.md )
1896
1887
for further details.
1897
1888
1898
- ##### propertyNames
1889
+ ##### ` propertyNames `
1899
1890
1900
1891
The value of ` propertyNames ` MUST be a valid JSON Schema.
1901
1892
@@ -1907,7 +1898,7 @@ Omitting this keyword has the same behavior as an empty schema.
1907
1898
1908
1899
#### Other Keywords for Applying Subschemas
1909
1900
1910
- ##### maxContains
1901
+ ##### ` maxContains `
1911
1902
1912
1903
The value of this keyword MUST be a non-negative integer.
1913
1904
@@ -1917,7 +1908,7 @@ as described below in the section for that keyword.
1917
1908
Validation MUST always succeed against this keyword. The value of this keyword
1918
1909
is used as its annotation result.
1919
1910
1920
- ##### minContains
1911
+ ##### ` minContains `
1921
1912
1922
1913
The value of this keyword MUST be a non-negative integer.
1923
1914
@@ -1931,7 +1922,7 @@ Per {{default-behaviors}}, omitted keywords MUST NOT produce annotation results.
1931
1922
However, as described in the section for ` contains ` , the absence of this
1932
1923
keyword's annotation causes ` contains ` to assume a minimum value of 1.
1933
1924
1934
- ##### contains
1925
+ ##### ` contains `
1935
1926
1936
1927
The value of this keyword MUST be a valid JSON Schema.
1937
1928
@@ -2015,7 +2006,7 @@ outcomes. However, the keywords in this vocabulary are notable exceptions:
2015
2006
from ` properties ` , ` patternProperties ` , ` additionalProperties ` , ` contains ` ,
2016
2007
and itself
2017
2008
2018
- ### unevaluatedItems {#unevaluateditems}
2009
+ ### ` unevaluatedItems ` {#unevaluateditems}
2019
2010
2020
2011
The value of ` unevaluatedItems ` MUST be a valid JSON Schema.
2021
2012
@@ -2046,7 +2037,7 @@ the behavior of `items`. This annotation affects the behavior of
2046
2037
2047
2038
Omitting this keyword has the same assertion behavior as an empty schema.
2048
2039
2049
- ### unevaluatedProperties {#unevaluatedproperties}
2040
+ ### ` unevaluatedProperties ` {#unevaluatedproperties}
2050
2041
2051
2042
The value of ` unevaluatedProperties ` MUST be a valid JSON Schema.
2052
2043
@@ -2238,7 +2229,7 @@ if they contain the same units, in any order.
2238
2229
2239
2230
The JSON key for these additional results is "details".
2240
2231
2241
- ### 12.4. Output Structure
2232
+ ### Output Structure
2242
2233
2243
2234
The output MUST be an object containing a boolean property named "valid". When
2244
2235
additional information about the result is required, the output MUST also
@@ -2728,7 +2719,7 @@ action based on `$comment` contents.
2728
2719
2729
2720
## IANA Considerations
2730
2721
2731
- ### application/schema+json
2722
+ ### ` application/schema+json `
2732
2723
2733
2724
The proposed MIME media type for JSON Schema is defined as follows:
2734
2725
@@ -2748,7 +2739,7 @@ Interoperability considerations:: See Sections [6.2](#language),
2748
2739
2749
2740
Fragment identifier considerations:: See {{fragments}}
2750
2741
2751
- ### application/schema-instance+json
2742
+ ### ` application/schema-instance+json `
2752
2743
2753
2744
The proposed MIME media type for JSON Schema Instances that require a JSON
2754
2745
Schema-specific media type is defined as follows:
0 commit comments