Skip to content

Commit f2ca522

Browse files
committed
Dynamic anchors are not fragments
1 parent 2441221 commit f2ca522

1 file changed

Lines changed: 21 additions & 13 deletions

File tree

specs/jsonschema-core.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,27 +1010,23 @@ fragments to identify subschemas is sometimes preferable because it is not tied
10101010
to a particular structural location. This allows a subschema to be relocated
10111011
without requiring references to be updated.
10121012

1013-
The `$anchor` and `$dynamicAnchor` keywords are used to define
1014-
location-independent identifiers for subschemas within a schema resource.
1015-
1016-
`$anchor` defines a plain name fragment identifier that can be used in IRI
1017-
fragments as an alternative to JSON Pointers.[^6] See {{fragments}}.
1013+
The `$anchor` keyword is used to define location-independent identifiers for
1014+
subschemas within a schema resource. `$anchor` defines a plain name fragment
1015+
identifier that can be used in IRI fragments as an alternative to JSON
1016+
Pointers.[^4] See {{fragments}}.
10181017

10191018
[^6]: Note that the anchor string does not include the "#" character, as it is
10201019
just a fragment identifier not an IRI reference. To reference the "foo"
10211020
`$anchor` from the same schema resource, you would use the fragment-only IRI
10221021
`#foo`. See below for full examples.
10231022

1024-
`$dynamicAnchor` defines a (non-fragment) identifier that only has meaning when
1025-
used with `$dynamicRef`.
1026-
1027-
If present, the value of these keywords MUST be a string and MUST conform to the
1023+
If present, the value of this keyword MUST be a string and MUST conform to the
10281024
plain name fragment identifier syntax defined in {{fragments}}.
10291025

1030-
`$anchor`, `$dynamicAnchor`, and any extensions that define plain name
1031-
fragment identifiers MUST match XML's
1032-
[`NCName` production](https://www.w3.org/TR/2006/REC-xml-names11-20060816/#NT-NCName).
1033-
For convenience, the `NCName` syntax is reproduced here in ABNF form, using a
1026+
`$anchor`, and any extensions that define a plain name fragment identifier MUST
1027+
match XML's [`NCName`
1028+
production](https://www.w3.org/TR/2006/REC-xml-names11-20060816/#NT-NCName). For
1029+
convenience, the `NCName` syntax is reproduced here in ABNF form, using a
10341030
minimal set of rules:
10351031

10361032
```abnf
@@ -1046,6 +1042,18 @@ NCNameChar = NCNameStartChar / "-" / "." / DIGIT
10461042
/ %xB7 / %x0300-036F / %x203F-2040
10471043
```
10481044

1045+
#### Defining dynamically scoped identifiers {#dynamic-anchors}
1046+
1047+
The `$dynamicAnchor` keyword is used to define location-independent identifiers
1048+
for subschemas within the dynamic scope of a schema evaluation. They are only
1049+
used by `$dynamicRef`. They are not meaningful in IRI fragments.
1050+
1051+
The fragment identifiers defined by `$dynamicAnchor` are not normal fragment
1052+
identifiers because they identify both the primary resource and the secondary
1053+
resource. See {{dynamic-ref}} for details.
1054+
1055+
If present, the value of this keyword MUST be a string.
1056+
10491057
#### Duplicate schema identifiers {#duplicate-iris}
10501058

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

0 commit comments

Comments
 (0)