Skip to content

Updates for Relative JSON Pointer #1400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 26 additions & 24 deletions relative-json-pointer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<?rfc rfcedstyle="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes" ?>
<rfc category="info" docName="draft-bhutton-relative-json-pointer-00" ipr="trust200902" submissionType="IETF">
<rfc category="info" docName="draft-handrews-relative-json-pointer-03" ipr="trust200902" submissionType="IETF">
<front>
<title abbrev="Relative JSON Pointers">Relative JSON Pointers</title>

Expand Down Expand Up @@ -83,35 +83,31 @@
<t>
A Relative JSON Pointer is a Unicode string in UTF-8 encoding (see RFC 8259,
<xref target="RFC8259">Section 8</xref>), comprising a non-negative integer,
followed by either a '#' (%x23) character or a JSON Pointer
(<xref target="RFC6901">RFC 6901</xref>).
an optional index adjustment consisting of '+' (%x2B) or '-' (%x2D) followed
by a positive integer, followed by either a '#' (%x23) character or
a JSON Pointer (<xref target="RFC6901">RFC 6901</xref>).
</t>
<t>
The separation between the integer prefix and the JSON Pointer will
The separation between the integer prefix (with optional adjustment)
and the JSON Pointer will
always be unambiguous, because a JSON Pointer must be either zero-
length or start with a '/' (%x2F). Similarly, a JSON Pointer will
never be ambiguous with the '#'.
</t>
<figure align="center">
<preamble>
The ABNF syntax of a Relative JSON Pointer is:
</preamble>
<artwork>
<![CDATA[
relative-json-pointer = non-negative-integer [index-manipulation] <json-pointer>
relative-json-pointer =/ non-negative-integer "#"
index-manipulation = ("+" / "-") non-negative-integer
non-negative-integer = %x30 / %x31-39 *( %x30-39 )
; "0", or digits without a leading "0"
]]>
</artwork>
<postamble>
where &lt;json-pointer&gt; follows the production defined in
<xref target="RFC6901">RFC 6901, Section 3</xref> ("Syntax").
</postamble>
</figure>
<t>
The ABNF syntax of a Relative JSON Pointer is:
</t>
<sourcecode type="abnf9110"><![CDATA[
relative-json-pointer = origin-specification json-pointer
/ origin-specification "#"
Comment on lines +101 to +102
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
relative-json-pointer = origin-specification json-pointer
/ origin-specification "#"
relative-json-pointer = origin-specification ( "#" / json-pointer )

It might be better to not duplicate the origin-specification as it's not necessary; this equivalent formulation lets the syntax stay LL1-parseable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't seem to push to this branch. I'll create a secondary PR for this.

; json-pointer from RFC 6901

origin-specification = non-negative-integer [ index-manipulation ]
index-manipulation = ( "+" / "-" ) positive-integer
non-negative-integer = "0" / positive-integer
positive-integer = %x31-39 *DIGIT
; digits without a leading zero
]]></sourcecode>
</section>

<section title="Evaluation">
Expand Down Expand Up @@ -203,7 +199,7 @@
<artwork>
<![CDATA[
{
"foo": ["bar", "baz"],
"foo": ["bar", "baz", "biz"],
"highly": {
"nested": {
"objects": true
Expand All @@ -225,7 +221,7 @@
"0-1" "bar"
"2/highly/nested/objects" true
"0#" 1
"0-1#" 0
"0+1#" 2
"1#" "foo"
]]>
</artwork>
Expand Down Expand Up @@ -329,6 +325,12 @@
</t>
<t>
<list style="hanging">
<t hangText="draft-handrews-relative-json-pointer-03">
<list style="symbols">
<t>Fix ABNF omission for using # with index manipulation</t>
<t>Clarify handling of leading "0"</t>
</list>
</t>
<t hangText="draft-bhutton-relative-json-pointer-00">
<list style="symbols">
<t>Add array forward and backward index manipulation</t>
Expand Down