|
8 | 8 | <!ENTITY rfc5789 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5789.xml">
|
9 | 9 | <!ENTITY rfc5988 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5988.xml">
|
10 | 10 | <!ENTITY rfc6570 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6570.xml">
|
| 11 | +<!ENTITY rfc6906 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6906.xml"> |
11 | 12 | <!ENTITY rfc7231 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7231.xml">
|
| 13 | +<!ENTITY I-D.luff-relative-json-pointer SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.draft-luff-relative-json-pointer-00.xml"> |
12 | 14 | <!ENTITY I-D.reschke-http-jfv SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.draft-reschke-http-jfv-06.xml">
|
13 | 15 | ]>
|
14 | 16 | <?rfc toc="yes"?>
|
|
654 | 656 | resource is the instance to which the schema (or sub-schema)
|
655 | 657 | applies, rather than any larger document in which the
|
656 | 658 | instance may have been found. The context may be changed
|
657 |
| - with the <xref target="anchor">"anchor"</xref> property. |
| 659 | + with the <xref target="anchor">"anchor"</xref> or |
| 660 | + <xref target="anchorPointer">"anchorPointer"</xref> properties. |
658 | 661 | </t>
|
659 | 662 |
|
660 | 663 | <t>
|
@@ -793,6 +796,93 @@ GET /foo/
|
793 | 796 | </t>
|
794 | 797 | </section>
|
795 | 798 |
|
| 799 | + <section title="anchorPointer" anchor="anchorPointer"> |
| 800 | + <t> |
| 801 | + This property changes the point within the instance that is considered |
| 802 | + to be the context resource of the link. The value of the property MUST be a |
| 803 | + valid <xref target="RFC6906">JSON Pointer</xref>, or a valid |
| 804 | + <xref target="I-D.luff-relative-json-pointer">Relative JSON Pointer</xref> |
| 805 | + which is evaluated relative to the position in the instance from which |
| 806 | + <xref target="href">"href"</xref> template variable resolution would |
| 807 | + normally begin. |
| 808 | + </t> |
| 809 | + <t> |
| 810 | + While an alternate context with a known URI is best set with the |
| 811 | + <xref target="anchor">"anchor"</xref> keyword, the lack of a fragment identifier |
| 812 | + syntax for application/json means that it is usually not possible to |
| 813 | + change the context within a JSON instance using a URI. |
| 814 | + </t> |
| 815 | + <t> |
| 816 | + Even in "+json" media types that define JSON Pointer as a fragment identifier |
| 817 | + syntax, if the default context is nested within an array, it is not possible to |
| 818 | + obtain the index of the default context's position in that array in order |
| 819 | + to construct a pointer to another property in that same nested JSON object. |
| 820 | + </t> |
| 821 | + |
| 822 | + <figure> |
| 823 | + <preamble> |
| 824 | + For example, given this hyper-schema: |
| 825 | + </preamble> |
| 826 | + <artwork> |
| 827 | +<![CDATA[{ |
| 828 | + "type": "object", |
| 829 | + "properties": { |
| 830 | + "theThing": { |
| 831 | + "type": "object", |
| 832 | + "properties": { |
| 833 | + "name": {"type": "string"} |
| 834 | + } |
| 835 | + }, |
| 836 | + "examples": { |
| 837 | + "title": "The collection of example for the thing", |
| 838 | + "type": "array", |
| 839 | + "items": { |
| 840 | + "type": "object", |
| 841 | + "properties": { |
| 842 | + "id": {"type": "integer"} |
| 843 | + }, |
| 844 | + "links": [{ |
| 845 | + "rel": "item", |
| 846 | + "href": "/examples/{id}", |
| 847 | + "anchorPointer": "1" |
| 848 | + }] |
| 849 | + } |
| 850 | + } |
| 851 | + } |
| 852 | +}]]> |
| 853 | + </artwork> |
| 854 | + <postamble> |
| 855 | + The "item" relation indicates that each array entry can be used to construct |
| 856 | + a link from the collection embedded in this instance to a resource for that |
| 857 | + specific item. The default context of this link is the individual array |
| 858 | + element. But the context of an "item" relation should be the collection, |
| 859 | + which is the entire "examples" array. The Relative JSON Pointer of "1" |
| 860 | + accomplishes this as follows: |
| 861 | + </postamble> |
| 862 | + </figure> |
| 863 | + <figure> |
| 864 | + <preamble> |
| 865 | + Given this instance of media type application/json: |
| 866 | + </preamble> |
| 867 | + <artwork> |
| 868 | +<![CDATA[{ |
| 869 | + "theThing": {"name": "An actual thing"}, |
| 870 | + "examples": [{"id": 1234}, {"id": 5678}] |
| 871 | +}]]> |
| 872 | + </artwork> |
| 873 | + <postamble> |
| 874 | + The default context for the link to "/examples/1234" is the first |
| 875 | + array entry, and for the link to "/examples/5678" it is the second array |
| 876 | + entry. But "anchorPointer" moves this up one instance level (the "1" |
| 877 | + Relative JSON Pointer) to be the array containing each entry. |
| 878 | + </postamble> |
| 879 | + </figure> |
| 880 | + <t> |
| 881 | + If both "anchor" and "anchorPointer" are defined, and do not resolve to |
| 882 | + the same link context, the resulting behavior is undefined. |
| 883 | + </t> |
| 884 | + </section> |
| 885 | + |
796 | 886 | <section title="title">
|
797 | 887 | <t>
|
798 | 888 | This property defines a title for the link.
|
@@ -1190,6 +1280,8 @@ GET /foo/
|
1190 | 1280 | &rfc3986;
|
1191 | 1281 | <!--&rfc4287;-->
|
1192 | 1282 | &rfc6570;
|
| 1283 | + &rfc6906; |
| 1284 | + &I-D.luff-relative-json-pointer; |
1193 | 1285 | &I-D.reschke-http-jfv;
|
1194 | 1286 | <reference anchor="json-schema">
|
1195 | 1287 | <front>
|
|
0 commit comments