Skip to content

Commit bcfa396

Browse files
committed
Remove references to JSON Schema media types
1 parent f1a3de3 commit bcfa396

File tree

2 files changed

+41
-87
lines changed

2 files changed

+41
-87
lines changed

.remarkrc-lint.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import remarkValidateLinks from "remark-validate-links";
22
import remarkPresetLintConsistent from "remark-preset-lint-consistent";
33
import remarkPresetLintRecommended from "remark-preset-lint-recommended";
44
import remarkPresetLintMarkdownStyleGuide from "remark-preset-lint-markdown-style-guide";
5+
import remarkLintDefinitionCase from "remark-lint-definition-case";
56
import remarkLintListItemIndent from "remark-lint-list-item-indent";
67
import remarkLintListItemSpacing from "remark-lint-list-item-spacing";
78
import remarkLintNoFileNameMixedCase from "remark-lint-no-file-name-mixed-case";
@@ -14,6 +15,7 @@ export default {
1415
remarkPresetLintConsistent,
1516
remarkPresetLintRecommended,
1617
remarkPresetLintMarkdownStyleGuide,
18+
[remarkLintDefinitionCase, false],
1719
[remarkLintListItemIndent, "one"],
1820
[remarkLintListItemSpacing, { checkBlanks: true }],
1921
[remarkLintNoFileNameMixedCase, false],

specs/jsonschema-core.md

Lines changed: 39 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ define their own dialects of JSON Schema.
105105

106106
### JSON Document
107107

108-
A JSON document is an information resource (series of octets) described by the
109-
`application/json` media type.
108+
In JSON Schema, the terms "JSON document", "JSON data", and "JSON value" are
109+
interchangeable and refer to the data model defined in {{data-model}}.
110110

111111
In JSON Schema, the terms "JSON document", "JSON text", and "JSON value" are
112112
interchangeable because of the data model it defines in {{data-model}}.
@@ -117,13 +117,8 @@ model can be interpreted against a JSON Schema.
117117

118118
### Instance
119119

120-
A JSON document to which a schema is applied is known as an "instance".
121-
122-
JSON Schema is defined over `application/json` or compatible documents,
123-
including media types with the `+json` structured syntax suffix.
124-
125-
Among these, this specification defines the `application/schema-instance+json`
126-
media type which defines handling for fragments in the IRI.
120+
A JSON document to which a schema is applied is known as a "JSON instance" or
121+
just an "instance".
127122

128123
#### Instance Data Model {#data-model}
129124

@@ -193,12 +188,8 @@ use of the `const` keyword.
193188

194189
### JSON Schema Documents {#schema-document}
195190

196-
A JSON Schema document, or simply a schema, is a JSON document used to describe
197-
an instance. A schema can itself be interpreted as an instance, but SHOULD
198-
always be given the media type `application/schema+json` rather than
199-
`application/schema-instance+json`. The `application/schema+json` media type is
200-
defined to offer a superset of the fragment identifier syntax and semantics
201-
provided by `application/schema-instance+json`.
191+
A JSON Schema document, or simply a schema, is used to describe an instance. A
192+
schema can itself be interpreted as an instance.
202193

203194
A JSON Schema MUST be an object or a boolean.
204195

@@ -909,21 +900,25 @@ steps.
909900

910901
1. The `$schema` keyword - Implementations MUST process the schema according to
911902
the dialect it declares.
912-
2. `application/schema+json` media type with a `schema` parameter -
913-
Implementations which support media type parameter inputs MUST process the
914-
schema according to the dialect the parameter declares. A media type will
915-
generally only be available if the schema has been retrieved from an external
916-
source and only applies to the document root.
917-
3. Parent dialect - An embedded schema resource which does not itself contain a
918-
`$schema` keyword MUST be processed using the same dialect as the schema
919-
which contains it. If the schema is embedded in a non-schema document, the
920-
semantics for determining the dialect MAY be determined by any specification
921-
which applies to that document.
903+
2. Parent schema dialect - A schema resource embedded within another schema
904+
resource which does not itself contain a `$schema` keyword MUST be processed
905+
using the same dialect as the schema which contains it.
906+
3. External context - In some contexts, there is a default dialect or a way to
907+
declare the dialect external from the schema resource in question. Examples
908+
include the following.
909+
- If the schema is embedded in a non-schema document (such as an OpenAPI
910+
Document), the semantics for determining the dialect MUST be determined by
911+
the specification that applies to that document.
912+
- If the media type of the schema is known and the media type defines a
913+
default dialect or a way to declare a dialect, the dialect MUST be
914+
determined by the rules of that media types. For example, the
915+
[application/schema+json] media type includes a `schema` parameter that
916+
can be used to declare the dialect. A media type will generally only be
917+
available if the schema has been retrieved from an external source and
918+
only applies to the document root.
922919
4. User configuration - Implementations MAY provide means for the user to
923920
configure the dialect under which a schema should be processed.
924921

925-
(Note that steps 2 and 3 are mutually exclusive.)
926-
927922
If the dialect is not specified through one of these methods, the implementation
928923
MUST refuse to process the schema.
929924

@@ -940,9 +935,6 @@ The value of this keyword MUST be an
940935
[IRI](https://www.rfc-editor.org/info/rfc3987) (containing a scheme) and this
941936
IRI MUST be normalized.
942937

943-
If this IRI identifies a retrievable resource, that resource SHOULD be of media
944-
type `application/schema+json`.
945-
946938
The `$schema` keyword SHOULD be used in the document root schema object, and MAY
947939
be used in the root schema objects of embedded schema resources. This keyword
948940
MUST NOT appear in a subschema that is not also the root object of a schema
@@ -1143,11 +1135,10 @@ this string to end users. Tools for editing schemas SHOULD support displaying
11431135
and editing this keyword. The value of this keyword MAY be used in debug or
11441136
error output which is intended for developers making use of schemas.
11451137

1146-
Tools that translate other media types or programming languages to and from
1147-
`application/schema+json` MAY choose to convert that media type or programming
1148-
language's native comments to or from `$comment` values. The behavior of such
1149-
translation when both native comments and `$comment` properties are present is
1150-
implementation-dependent.
1138+
Tools that translate schemas between media types or programming languages MAY
1139+
choose to convert that media type or programming language's native comments to
1140+
or from `$comment` values. The behavior of such translation when both native
1141+
comments and `$comment` properties are present is implementation-dependent.
11511142

11521143
Implementations MAY strip `$comment` values at any point during processing. In
11531144
particular, this allows for shortening schemas when the size of deployed schemas
@@ -1181,8 +1172,8 @@ implementation-specific default IRI MAY be used as described in RFC 3987 Section
11811172
6.5 and RFC 3986 Section 5.1.4. It is RECOMMENDED that implementations document
11821173
any default base IRI that they assume.
11831174

1184-
If a schema object is embedded in a document of another media type, then the
1185-
initial base IRI is determined according to the rules of that media type.
1175+
If a schema object is embedded in a document that is not a schema, then the
1176+
initial base IRI is determined according to the rules of that document.
11861177

11871178
Unless the `$id` keyword described in an earlier section is present in the root
11881179
schema, this base IRI SHOULD be considered the canonical IRI of the schema
@@ -1460,14 +1451,17 @@ custom keywords.
14601451
A reference target under a keyword for which the value is not explicitly known
14611452
to be a schema results in undefined behavior. Implementations MAY support
14621453
references to these locations, however such behavior is not considered
1463-
interoperable and should not be relied upon.[^10]
1454+
interoperable and should not be relied upon.
14641455

1465-
[^10]: These scenarios are analogous to fetching a schema over HTTP but
1466-
receiving a response with a Content-Type other than `application/schema+json`.
1467-
An implementation can certainly try to interpret it as a schema, but the origin
1468-
server offered no guarantee that it actually is any such thing. Therefore,
1469-
interpreting it as such has security implication and may produce unpredictable
1470-
results.
1456+
When a schema is resolved over HTTP or another protocol that declares the media
1457+
type of the response, implementations SHOULD refuse to evaluate schemas whose
1458+
declared media type is not a known and supported JSON Schema media type such as
1459+
[application/schema+json].[^10]
1460+
1461+
[^10]: An implementation can certainly try to interpret it as a schema, but
1462+
there's no guarantee that it can be parsed and evaluated as a schema. Therefore,
1463+
interpreting it as such has security implications and may produce unpredictable
1464+
or malicious results.
14711465

14721466
#### Failure to resolve references {#failed-refs}
14731467

@@ -2159,49 +2153,6 @@ Third-party JSON Schema extensions may introduce additional risks. Implementers
21592153
are advised to consult the specifications of any extensions they support and
21602154
take into account their security considerations as well.
21612155

2162-
## IANA Considerations
2163-
2164-
### `application/schema+json`
2165-
2166-
The proposed MIME media type for JSON Schema is defined as follows:
2167-
2168-
Type name:: application
2169-
2170-
Subtype name:: schema+json
2171-
2172-
Required parameters:: N/A
2173-
2174-
Encoding considerations:: Encoding considerations are identical to those
2175-
specified for the `application/json` media type. See [JSON][rfc8259].
2176-
2177-
Security considerations:: See {{security}} above.
2178-
2179-
Interoperability considerations:: See Sections [6.2](#language),
2180-
[6.3](#data-model), and [6.4](#regex) above.
2181-
2182-
Fragment identifier considerations:: See {{fragments}}
2183-
2184-
### `application/schema-instance+json`
2185-
2186-
The proposed MIME media type for JSON Schema Instances that require a JSON
2187-
Schema-specific media type is defined as follows:
2188-
2189-
Type name:: application
2190-
2191-
Subtype name:: schema-instance+json
2192-
2193-
Required parameters:: N/A
2194-
2195-
Encoding considerations:: Encoding considerations are identical to those
2196-
specified for the `application/json` media type. See [JSON][rfc8259].
2197-
2198-
Security considerations:: See {{security}} above.
2199-
2200-
Interoperability considerations:: See Sections [6.2](#language),
2201-
[6.3](#data-model), and [6.4](#regex) above.
2202-
2203-
Fragment identifier considerations:: See {{fragments}}
2204-
22052156
## %appendix% Schema identification examples {#idexamples}
22062157

22072158
Consider the following schema, which shows `$id` being used to identify both the
@@ -2676,3 +2627,4 @@ to the document.
26762627
[rfc6901]: https://www.rfc-editor.org/info/rfc6901
26772628
[rfc8259]: https://www.rfc-editor.org/info/rfc8259
26782629
[rfc8288]: https://www.rfc-editor.org/info/rfc8288
2630+
[application/schema+json]: ../ietf/json-schema-media-types.md

0 commit comments

Comments
 (0)