|
10 | 10 | <!ENTITY rfc5988 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5988.xml">
|
11 | 11 | <!ENTITY rfc6570 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6570.xml">
|
12 | 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"> |
13 | 14 | ]>
|
14 | 15 | <?rfc toc="yes"?>
|
15 | 16 | <?rfc symrefs="yes"?>
|
@@ -906,6 +907,91 @@ GET /foo/
|
906 | 907 | </t>
|
907 | 908 | </section>
|
908 | 909 |
|
| 910 | + <section title="anchorPointer" anchor="anchorPointer"> |
| 911 | + <t> |
| 912 | + This property changes the point within the instance that is considered |
| 913 | + to be the context resource of the link. The value of the property is a |
| 914 | + <xref target="I-D.luff-relative-json-pointer">Relative JSON Pointer</xref>, |
| 915 | + starting from the default context (the part of the instance that validated |
| 916 | + against the schema containing the LDO). |
| 917 | + </t> |
| 918 | + <t> |
| 919 | + While an alternate context with a known URI is best set with the |
| 920 | + "anchor" keyword, the lack of a fragment identifier |
| 921 | + syntax for application/json means that it is usually not possible to |
| 922 | + change the context within a JSON instance. |
| 923 | + </t> |
| 924 | + <t> |
| 925 | + Even in "+json" media types that define JSON Pointer as a fragment identifier |
| 926 | + syntax, if the default context is nested within an array, it is not possible to |
| 927 | + obtain the index of the default context's position in that array in order |
| 928 | + to construct a pointer to another property in that same nested JSON object. |
| 929 | + </t> |
| 930 | + |
| 931 | + <figure> |
| 932 | + <preamble> |
| 933 | + For example, given this hyper-schema: |
| 934 | + </preamble> |
| 935 | + <artwork> |
| 936 | +<![CDATA[{ |
| 937 | + "type": "object", |
| 938 | + "properties": { |
| 939 | + "theThing": { |
| 940 | + "type": "object", |
| 941 | + "properties": { |
| 942 | + "name": {"type": "string"} |
| 943 | + } |
| 944 | + }, |
| 945 | + "examples": { |
| 946 | + "title": "The collection of example for the thing", |
| 947 | + "type": "array", |
| 948 | + "items": { |
| 949 | + "type": "object", |
| 950 | + "properties": { |
| 951 | + "id": {"type": "integer"} |
| 952 | + }, |
| 953 | + "links": [{ |
| 954 | + "rel": "item", |
| 955 | + "href": "/examples/{id}", |
| 956 | + "anchorPointer": "1" |
| 957 | + }] |
| 958 | + } |
| 959 | + } |
| 960 | + } |
| 961 | +}]]> |
| 962 | + </artwork> |
| 963 | + <postamble> |
| 964 | + The "item" relation indicates that each array entry can be used to construct |
| 965 | + a link from the collection embedded in this instance to a resource for that |
| 966 | + specific item. The default context of this link is the individual array |
| 967 | + element. But the context of an "item" relation should be the collection, |
| 968 | + which is the entire "examples" array. The Relative JSON Pointer of "1" |
| 969 | + accomplishes this as follows: |
| 970 | + </postamble> |
| 971 | + </figure> |
| 972 | + <figure> |
| 973 | + <preamble> |
| 974 | + Given this instance of media type application/json: |
| 975 | + </preamble> |
| 976 | + <artwork> |
| 977 | +<![CDATA[{ |
| 978 | + "theThing": {"name": "An actual thing"}, |
| 979 | + "examples": [{"id": 1234}, {"id": 5678}] |
| 980 | +}]]> |
| 981 | + </artwork> |
| 982 | + <postamble> |
| 983 | + The default context for the link to "/examples/1234" is the first |
| 984 | + array entry, and for the link to "/examples/5678" it is the second array |
| 985 | + entry. But "anchorPointer" moves this up one instance level (the "1" |
| 986 | + Relative JSON Pointer) to be the array containing each entry. |
| 987 | + </postamble> |
| 988 | + </figure> |
| 989 | + <t> |
| 990 | + If both "anchor" and "anchorPointer" are defined, and do not resolve to |
| 991 | + the same link context, the resulting behavior is undefined. |
| 992 | + </t> |
| 993 | + </section> |
| 994 | + |
909 | 995 | <section title="title">
|
910 | 996 | <t>
|
911 | 997 | This property defines a title for the link.
|
@@ -1227,6 +1313,7 @@ GET /foo/
|
1227 | 1313 | &rfc3986;
|
1228 | 1314 | <!--&rfc4287;-->
|
1229 | 1315 | &rfc6570;
|
| 1316 | + &I-D.luff-relative-json-pointer; |
1230 | 1317 | <reference anchor="json-schema">
|
1231 | 1318 | <front>
|
1232 | 1319 | <title>JSON Schema: A Media Type for Describing JSON Documents</title>
|
|
0 commit comments