Skip to content

Commit 1be07c3

Browse files
committed
Fix example. Hopefully correctly this time.
Also note limitations of the hrefPointer system.
1 parent 53a3776 commit 1be07c3

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

jsonschema-hyperschema.xml

+29-14
Original file line numberDiff line numberDiff line change
@@ -702,17 +702,27 @@
702702
]
703703
}]]>
704704
</artwork>
705-
<postamble>
706-
The self links here should always include the root node id,
707-
followed by an immediate parent id if one exists, and always ending
708-
with the id of the node that is the context of the self link.
709-
The context node's id resolves with the standard process and
710-
does not appear in "hrefPointers". The root id is located
711-
using an absolute JSON Pointer, while the parent node
712-
uses a Relative JSON Pointer, going up two levels (one level up
713-
is the array of children, two levels up is the whole parent node).
714-
</postamble>
715705
</figure>
706+
<t>
707+
The self links here should always include the root node id,
708+
followed by an immediate parent id if one exists, and always ending
709+
with the id of the node that is the context of the self link.
710+
</t>
711+
<t>
712+
The context node's id resolves with the standard process and
713+
does not appear in "hrefPointers". The root id is located
714+
using an absolute JSON Pointer, while the parent node
715+
uses a Relative JSON Pointer, going up two levels (one level up
716+
is the array of children, two levels up is the whole parent node).
717+
</t>
718+
<t>
719+
This design never has more than three ids in the URI. Nodes
720+
along the path between the root and the immediate parent,
721+
if any, are omitted. This illustrates a limitation of JSON Schema:
722+
Producing a variable-length path URI to any arbitrary depth is
723+
not possible without redesigning the representation to make an
724+
array of path ids available in each node.
725+
</t>
716726
<figure>
717727
<preamble>
718728
Given the following instance:
@@ -726,21 +736,26 @@
726736
"id": 2,
727737
"children": [ {
728738
"id": 3
729-
} ] } ] } ] }]]>
739+
} ]
740+
} ]
741+
} ]
742+
}]]>
730743
</artwork>
731744
</figure>
732745
<t>
733746
We get the following self links for each node in the instance as identifed
734747
by JSON Pointers:
735748
<list style="hanging">
736749
<t hangText='"" (the root node)'>/trees/0/0</t>
737-
<t hangText='"/children/0/children/0"'>/trees/0/0/1</t>
738-
<t hangText='"/children/0/children/0/children/0"'>/trees/0/1/2</t>
739-
<t hangText='"/children/0/children/0/children/0/children/0"'>/trees/0/2/3</t>
750+
<t hangText='"/children/0"'>/trees/0/0/1</t>
751+
<t hangText='"/children/0/children/0"'>/trees/0/1/2</t>
752+
<t hangText='"/children/0/children/0/children/0"'>/trees/0/2/3</t>
740753
</list>
741754
This shows the use of an absolute JSON Pointer to always resolve
742755
the root node from any depth, and a Relative JSON Pointer to always resolve
743756
the immediate parent, which cannot be identified with an absolute pointer.
757+
</t>
758+
<t>
744759
For the root node, there is no defined parent, so per URI Template resolution
745760
rules, that variable and the path component that it would produce are simply
746761
omitted, giving us the desired URI with two components after "/trees".

0 commit comments

Comments
 (0)