Skip to content

Commit d552bc3

Browse files
committed
Updates for fragment identifiers
1 parent 2b5baaa commit d552bc3

File tree

1 file changed

+28
-44
lines changed

1 file changed

+28
-44
lines changed

specs/jsonschema-core.md

Lines changed: 28 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -303,54 +303,19 @@ are processed in the same way, with the same available behaviors.
303303

304304
## Fragment Identifiers {#fragments}
305305

306-
In accordance with
307-
[section 3.1 of RFC 6839](https://www.rfc-editor.org/rfc/rfc6839.html#section-3.1),
308-
the syntax and semantics of fragment identifiers specified for any +json media
309-
type SHOULD be as specified for `application/json`. (At publication of this
310-
document, there is no fragment identification syntax defined for
311-
`application/json`.)
312-
313-
Additionally, the `application/schema+json` media type supports two fragment
314-
identifier structures: plain names and JSON Pointers. The
315-
`application/schema-instance+json` media type supports one fragment identifier
316-
structure: JSON Pointers.
306+
JSON Schema uses two fragment identifier structures: plain names and JSON
307+
Pointers. Any media types defined for JSON Schema MUST support these structures.
317308

318309
The use of JSON Pointers as IRI fragment identifiers is described in [RFC
319-
6901][rfc6901]. For `application/schema+json`, which supports two fragment
320-
identifier syntaxes, fragment identifiers matching the JSON Pointer syntax,
321-
including the empty string, MUST be interpreted as JSON Pointer fragment
322-
identifiers.
323-
324-
Per the W3C's
325-
[best practices for fragment identifiers](https://www.w3.org/TR/2012/WD-fragid-best-practices-20121025),
326-
plain name fragment identifiers in `application/schema+json` are reserved for
327-
referencing locally named schemas.
328-
329-
Plain name fragments MUST follow XML's
330-
[`NCName` production](https://www.w3.org/TR/2006/REC-xml-names11-20060816/#NT-NCName),
331-
which allows for compatibility with the recommended [plain name
332-
syntax](https://www.w3.org/TR/2003/REC-xptr-framework-20030325/) for XML-based
333-
media types. For convenience, the `NCName` syntax is reproduced here in ABNF
334-
form, using a minimal set of rules:
310+
6901][rfc6901]. Fragment identifiers that start with `/` or are the empty
311+
string, MUST be interpreted as JSON Pointer fragment identifiers.
335312

336-
```abnf
337-
NCName = NCNameStartChar *NCNameChar
338-
NCNameStartChar = "_" / ALPHA
339-
/ %xC0-D6 / %xD8-F6 / %xF8-2FF
340-
/ %x370-37D / %x37F-1FFF
341-
/ %x200C-200D / %x2070-218F
342-
/ %x2C00-2FEF / %x3001-D7FF
343-
/ %xF900-FDCF / %xFDF0-FFFD
344-
/ %x10000-EFFFF
345-
NCNameChar = NCNameStartChar / "-" / "." / DIGIT
346-
/ %xB7 / %x0300-036F / %x203F-2040
347-
```
348-
349-
All fragment identifiers that do not match the JSON Pointer syntax MUST be
350-
interpreted as plain name fragment identifiers.
313+
Plain name fragment identifiers are reserved for referencing locally named
314+
schemas. All fragment identifiers that are not interpreted as JSON Pointers MUST
315+
be interpreted as plain name fragment identifiers.
351316

352-
Defining a plain name fragment identifier within an `application/schema+json`
353-
document is specified in the [`$anchor` keyword](#anchors) section.
317+
Defining a plain name fragment identifier within a schema resource is specified
318+
in the [`$anchor` keyword](#anchors) section.
354319

355320
## General Considerations
356321

@@ -1067,6 +1032,25 @@ details.
10671032
If present, the value of these keywords MUST be a string and MUST conform to the
10681033
plain name fragment identifier syntax defined in {{fragments}}.
10691034

1035+
`$anchor`, `$dynamicAnchor`, and any extensions that define a plain name
1036+
fragment identifiers MUST match XML's [`NCName`
1037+
production](https://www.w3.org/TR/2006/REC-xml-names11-20060816/#NT-NCName). For
1038+
convenience, the `NCName` syntax is reproduced here in ABNF form, using a
1039+
minimal set of rules:
1040+
1041+
```abnf
1042+
NCName = NCNameStartChar *NCNameChar
1043+
NCNameStartChar = "_" / ALPHA
1044+
/ %xC0-D6 / %xD8-F6 / %xF8-2FF
1045+
/ %x370-37D / %x37F-1FFF
1046+
/ %x200C-200D / %x2070-218F
1047+
/ %x2C00-2FEF / %x3001-D7FF
1048+
/ %xF900-FDCF / %xFDF0-FFFD
1049+
/ %x10000-EFFFF
1050+
NCNameChar = NCNameStartChar / "-" / "." / DIGIT
1051+
/ %xB7 / %x0300-036F / %x203F-2040
1052+
```
1053+
10701054
#### Duplicate schema identifiers {#duplicate-iris}
10711055

10721056
A schema MAY (and likely will) have multiple IRIs, but there is no way for an

0 commit comments

Comments
 (0)