|
427 | 427 | A JSON Schema resource is a schema which is |
428 | 428 | <xref target="RFC6596">canonically</xref> identified by an |
429 | 429 | <xref target="RFC3986">absolute URI</xref>. Schema resources MAY |
430 | | - also be identified by URIs including fragments. Any such URIs |
431 | | - are considered to be non-canonical. |
| 430 | + also be identified by URIs, including URIs with fragments, |
| 431 | + if the resulting secondary resource (as defined by |
| 432 | + <xref target="RFC3986">section 3.5 of RFC 3986</xref>) is identical |
| 433 | + to the primary resource. This can occur with the empty fragment, |
| 434 | + or when one schema resource is embedded in another. Any such URIs |
| 435 | + with fragments are considered to be non-canonical. |
432 | 436 | </t> |
433 | 437 | <t> |
434 | 438 | The root schema is the schema that comprises the entire JSON document |
435 | 439 | in question. The root schema is always a schema resource, where the |
436 | 440 | URI is determined as described in section |
437 | 441 | <xref target="initial-base" format="counter"></xref>. |
| 442 | + <cref> |
| 443 | + Note that documents that embed schemas in another format will not |
| 444 | + have a root schema resource in this sense. Exactly how such usages |
| 445 | + fit with the JSON Schema document and resource concepts will be |
| 446 | + clarified in a future draft. |
| 447 | + </cref> |
438 | 448 | </t> |
439 | 449 | <t> |
440 | 450 | Some keywords take schemas themselves, allowing JSON Schemas to be nested: |
|
1342 | 1352 | <t> |
1343 | 1353 | If present, the value for this keyword MUST be a string, and MUST represent a |
1344 | 1354 | valid <xref target="RFC3986">URI-reference</xref>. This URI-reference |
1345 | | - SHOULD be normalized, and MUST be semantically equivalent to an |
1346 | | - <xref target="RFC3986">absolute-URI</xref> (without a fragment). |
| 1355 | + SHOULD be normalized, and MUST resolve to an |
| 1356 | + <xref target="RFC3986">absolute-URI</xref> (without a fragment), |
| 1357 | + or to a URI with an empty fragment. |
1347 | 1358 | </t> |
1348 | 1359 | <t> |
1349 | | - The application/schema+json media type defines that an absolute-URI |
1350 | | - identifying a resource and the same URI with an empty fragment |
1351 | | - appended (which identifies the resource's root schema object) are |
1352 | | - semantically equivalent. Since this semantic equivalence is not part |
1353 | | - of the <xref target="RFC3986">RFC 3986 normalization process</xref>, |
1354 | | - implementors and schema authors cannot rely on generic URI libraries |
1355 | | - understanding the equivalence. |
| 1360 | + The empty fragment form is NOT RECOMMENDED and is retained only |
| 1361 | + for backwards compatibility, and because the |
| 1362 | + application/schema+json media type defines that a URI with an |
| 1363 | + empty fragment identifies the same resource as the same URI |
| 1364 | + with the fragment removed. However, since this equivalence is not |
| 1365 | + part of the <xref target="RFC3986">RFC 3986 normalization process</xref>, |
| 1366 | + implementers and schema authors cannot rely on generic URI libraries |
| 1367 | + understanding it. |
1356 | 1368 | </t> |
1357 | 1369 | <t> |
1358 | 1370 | Therefore, "$id" MUST NOT contain a non-empty fragment, and SHOULD NOT |
|
1757 | 1769 | Since JSON Pointer URI fragments are constructed based on the structure |
1758 | 1770 | of the schema document, an embedded schema resource and its subschemas |
1759 | 1771 | can be identified by JSON Pointer fragments relative to either its own |
1760 | | - canonical URI, or relative to a containing resource's URI. |
| 1772 | + canonical URI, or relative to any containing resource's URI. |
1761 | 1773 | </t> |
1762 | 1774 | <t> |
1763 | 1775 | Conceptually, a set of linked schema resources should behave |
|
1822 | 1834 | ]]> |
1823 | 1835 | </artwork> |
1824 | 1836 | <postamble> |
1825 | | - Here we see that the URI for the "additionalProperties" schema object |
1826 | | - that is relative to its resource's canonical URI is still valid, |
1827 | | - while the URI relative to the "items" schema object's URI no longer |
1828 | | - resolves to anything. |
| 1837 | + Here we see that "https://example.com/bar#/additionalProperties", |
| 1838 | + using a JSON Pointer fragment appended to the canonical URI of |
| 1839 | + the "bar" schema resource, is still valid, while |
| 1840 | + "https://example.com/foo#/items/additionalProperties", which relied |
| 1841 | + on a JSON Pointer fragment appended to the canonical URI of the |
| 1842 | + "foo" schema resource, no longer resolves to anything. |
1829 | 1843 | </postamble> |
1830 | 1844 | </figure> |
1831 | 1845 | <t> |
|
0 commit comments