|
420 | 420 | A JSON Schema resource is a schema which is
|
421 | 421 | <xref target="RFC6596">canonically</xref> identified by an
|
422 | 422 | <xref target="RFC3986">absolute URI</xref>. Schema resources MAY
|
423 |
| - also be identified by URIs including fragments. Any such URIs |
424 |
| - are considered to be non-canonical. |
| 423 | + also be identified by URIs, including URIs with fragments, |
| 424 | + if the resulting secondary resource (as defined by |
| 425 | + <xref target="RFC3986">section 3.5 of RFC 3986</xref>) is identical |
| 426 | + to the primary resource. This can occur with the empty fragment, |
| 427 | + or when one schema resource is embedded in another. Any such URIs |
| 428 | + with fragments are considered to be non-canonical. |
425 | 429 | </t>
|
426 | 430 | <t>
|
427 | 431 | The root schema is the schema that comprises the entire JSON document
|
428 | 432 | in question. The root schema is always a schema resource, where the
|
429 | 433 | URI is determined as described in section
|
430 | 434 | <xref target="initial-base" format="counter"></xref>.
|
| 435 | + <cref> |
| 436 | + Note that documents that embed schemas in another format will not |
| 437 | + have a root schema resource in this sense. Exactly how such usages |
| 438 | + fit with the JSON Schema document and resource concepts will be |
| 439 | + clarified in a future draft. |
| 440 | + </cref> |
431 | 441 | </t>
|
432 | 442 | <t>
|
433 | 443 | Some keywords take schemas themselves, allowing JSON Schemas to be nested:
|
|
1335 | 1345 | <t>
|
1336 | 1346 | If present, the value for this keyword MUST be a string, and MUST represent a
|
1337 | 1347 | valid <xref target="RFC3986">URI-reference</xref>. This URI-reference
|
1338 |
| - SHOULD be normalized, and MUST be semantically equivalent to an |
1339 |
| - <xref target="RFC3986">absolute-URI</xref> (without a fragment). |
| 1348 | + SHOULD be normalized, and MUST resolve to an |
| 1349 | + <xref target="RFC3986">absolute-URI</xref> (without a fragment), |
| 1350 | + or to a URI with an empty fragment. |
1340 | 1351 | </t>
|
1341 | 1352 | <t>
|
1342 |
| - The application/schema+json media type defines that an absolute-URI |
1343 |
| - identifying a resource and the same URI with an empty fragment |
1344 |
| - appended (which identifies the resource's root schema object) are |
1345 |
| - semantically equivalent. Since this semantic equivalence is not part |
1346 |
| - of the <xref target="RFC3986">RFC 3986 normalization process</xref>, |
1347 |
| - implementors and schema authors cannot rely on generic URI libraries |
1348 |
| - understanding the equivalence. |
| 1353 | + The empty fragment form is NOT RECOMMENDED and is retained only |
| 1354 | + for backwards compatibility, and because the |
| 1355 | + application/schema+json media type defines that a URI with an |
| 1356 | + empty fragment identifies the same resource as the same URI |
| 1357 | + with the fragment removed. However, since this equivalence is not |
| 1358 | + part of the <xref target="RFC3986">RFC 3986 normalization process</xref>, |
| 1359 | + implementers and schema authors cannot rely on generic URI libraries |
| 1360 | + understanding it. |
1349 | 1361 | </t>
|
1350 | 1362 | <t>
|
1351 | 1363 | Therefore, "$id" MUST NOT contain a non-empty fragment, and SHOULD NOT
|
|
1750 | 1762 | Since JSON Pointer URI fragments are constructed based on the structure
|
1751 | 1763 | of the schema document, an embedded schema resource and its subschemas
|
1752 | 1764 | can be identified by JSON Pointer fragments relative to either its own
|
1753 |
| - canonical URI, or relative to a containing resource's URI. |
| 1765 | + canonical URI, or relative to any containing resource's URI. |
1754 | 1766 | </t>
|
1755 | 1767 | <t>
|
1756 | 1768 | Conceptually, a set of linked schema resources should behave
|
|
1815 | 1827 | ]]>
|
1816 | 1828 | </artwork>
|
1817 | 1829 | <postamble>
|
1818 |
| - Here we see that the URI for the "additionalProperties" schema object |
1819 |
| - that is relative to its resource's canonical URI is still valid, |
1820 |
| - while the URI relative to the "items" schema object's URI no longer |
1821 |
| - resolves to anything. |
| 1830 | + Here we see that "https://example.com/bar#/additionalProperties", |
| 1831 | + using a JSON Pointer fragment appended to the canonical URI of |
| 1832 | + the "bar" schema resource, is still valid, while |
| 1833 | + "https://example.com/foo#/items/additionalProperties", which relied |
| 1834 | + on a JSON Pointer fragment appended to the canonical URI of the |
| 1835 | + "foo" schema resource, no longer resolves to anything. |
1822 | 1836 | </postamble>
|
1823 | 1837 | </figure>
|
1824 | 1838 | <t>
|
|
0 commit comments