|
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 | 11 | <!ENTITY rfc7231 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7231.xml">
|
| 12 | +<!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 | 13 | <!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 | 14 | ]>
|
14 | 15 | <?rfc toc="yes"?>
|
@@ -793,6 +794,91 @@ GET /foo/
|
793 | 794 | </t>
|
794 | 795 | </section>
|
795 | 796 |
|
| 797 | + <section title="anchorPointer" anchor="anchorPointer"> |
| 798 | + <t> |
| 799 | + This property changes the point within the instance that is considered |
| 800 | + to be the context resource of the link. The value of the property is a |
| 801 | + <xref target="I-D.luff-relative-json-pointer">Relative JSON Pointer</xref>, |
| 802 | + starting from the default context (the part of the instance that validated |
| 803 | + against the schema containing the LDO). |
| 804 | + </t> |
| 805 | + <t> |
| 806 | + While an alternate context with a known URI is best set with the |
| 807 | + "anchor" keyword, the lack of a fragment identifier |
| 808 | + syntax for application/json means that it is usually not possible to |
| 809 | + change the context within a JSON instance. |
| 810 | + </t> |
| 811 | + <t> |
| 812 | + Even in "+json" media types that define JSON Pointer as a fragment identifier |
| 813 | + syntax, if the default context is nested within an array, it is not possible to |
| 814 | + obtain the index of the default context's position in that array in order |
| 815 | + to construct a pointer to another property in that same nested JSON object. |
| 816 | + </t> |
| 817 | + |
| 818 | + <figure> |
| 819 | + <preamble> |
| 820 | + For example, given this hyper-schema: |
| 821 | + </preamble> |
| 822 | + <artwork> |
| 823 | +<![CDATA[{ |
| 824 | + "type": "object", |
| 825 | + "properties": { |
| 826 | + "theThing": { |
| 827 | + "type": "object", |
| 828 | + "properties": { |
| 829 | + "name": {"type": "string"} |
| 830 | + } |
| 831 | + }, |
| 832 | + "examples": { |
| 833 | + "title": "The collection of example for the thing", |
| 834 | + "type": "array", |
| 835 | + "items": { |
| 836 | + "type": "object", |
| 837 | + "properties": { |
| 838 | + "id": {"type": "integer"} |
| 839 | + }, |
| 840 | + "links": [{ |
| 841 | + "rel": "item", |
| 842 | + "href": "/examples/{id}", |
| 843 | + "anchorPointer": "1" |
| 844 | + }] |
| 845 | + } |
| 846 | + } |
| 847 | + } |
| 848 | +}]]> |
| 849 | + </artwork> |
| 850 | + <postamble> |
| 851 | + The "item" relation indicates that each array entry can be used to construct |
| 852 | + a link from the collection embedded in this instance to a resource for that |
| 853 | + specific item. The default context of this link is the individual array |
| 854 | + element. But the context of an "item" relation should be the collection, |
| 855 | + which is the entire "examples" array. The Relative JSON Pointer of "1" |
| 856 | + accomplishes this as follows: |
| 857 | + </postamble> |
| 858 | + </figure> |
| 859 | + <figure> |
| 860 | + <preamble> |
| 861 | + Given this instance of media type application/json: |
| 862 | + </preamble> |
| 863 | + <artwork> |
| 864 | +<![CDATA[{ |
| 865 | + "theThing": {"name": "An actual thing"}, |
| 866 | + "examples": [{"id": 1234}, {"id": 5678}] |
| 867 | +}]]> |
| 868 | + </artwork> |
| 869 | + <postamble> |
| 870 | + The default context for the link to "/examples/1234" is the first |
| 871 | + array entry, and for the link to "/examples/5678" it is the second array |
| 872 | + entry. But "anchorPointer" moves this up one instance level (the "1" |
| 873 | + Relative JSON Pointer) to be the array containing each entry. |
| 874 | + </postamble> |
| 875 | + </figure> |
| 876 | + <t> |
| 877 | + If both "anchor" and "anchorPointer" are defined, and do not resolve to |
| 878 | + the same link context, the resulting behavior is undefined. |
| 879 | + </t> |
| 880 | + </section> |
| 881 | + |
796 | 882 | <section title="title">
|
797 | 883 | <t>
|
798 | 884 | This property defines a title for the link.
|
@@ -1190,6 +1276,7 @@ GET /foo/
|
1190 | 1276 | &rfc3986;
|
1191 | 1277 | <!--&rfc4287;-->
|
1192 | 1278 | &rfc6570;
|
| 1279 | + &I-D.luff-relative-json-pointer; |
1193 | 1280 | &I-D.reschke-http-jfv;
|
1194 | 1281 | <reference anchor="json-schema">
|
1195 | 1282 | <front>
|
|
0 commit comments