Draft: draft-ietf-jsonpath-base

Commentary: This PR replaces APPENDER with segment . If merged , this will extend PR 263 . 
 Thanks . I 'm going to merge this into PR . The term is n't set in stone and I 'd prefer to have a concrete proposal than just a placeholder before merging . 
 Assuming we decide to use this terminology , this looks fine .
Paragraph (version A):
Specifically, the "Semantics" subsections of Sections name-selector,
wildcard, filter-selector, and descendant-appender describe behavior
that turns unpredictable when the JSON value for one of the objects
under consideration was constructed out of JSON text that exhibits
multiple members for a single object that share the same member name
("duplicate names", see RFC8259).  Also, selecting a child by name
(name-selector) and comparing strings (comparisons in Section filter-
selector) assume these strings are sequences of Unicode scalar
values, turning unpredictable if they aren't (RFC8259).
Paragraph (version B):
Specifically, the "Semantics" subsections of Sections name-selector,
wildcard, filter-selector, and descendant-segment describe behavior
that turns unpredictable when the JSON value for one of the objects
under consideration was constructed out of JSON text that exhibits
multiple members for a single object that share the same member name
("duplicate names", see RFC8259).  Also, selecting a child by name
(name-selector) and comparing strings (comparisons in Section filter-
selector) assume these strings are sequences of Unicode scalar
values, turning unpredictable if they aren't (RFC8259).
Paragraph (version A):
is presented as the result of the query; depending on the specific
API, it might be presented as an array of the JSON values at the
nodes, an array of Normalized Paths referencing the nodes, or both --
or some other representation as desired by the implementation.  Note
that the API must be capable of presenting an empty nodelist as the
result of the query.
Paragraph (version A):
MUST NOT produce errors.  This means that some operations that might
be considered erroneous, such as indexing beyond the end of an array,
simply result in fewer nodes being selected.
Paragraph (version B):
The nodelist resulting from the root identifier contains a single
node, the argument.  The nodelist resulting from the last segment is
presented as the result of the query; depending on the specific API,
it might be presented as an array of the JSON values at the nodes, an
array of Normalized Paths referencing the nodes, or both -- or some
other representation as desired by the implementation.  Note that the
API must be capable of presenting an empty nodelist as the result of
the query.
Paragraph (version B):
A segment performs its function on each of the nodes in its input
nodelist, during such a function execution, such a node is referred
to as the "current node".  Each of these function executions produces
a nodelist, which are then concatenated to produce the result of the
segment.  A node may be selected more than once and appears that
number of times in the nodelist.  Duplicate nodes are not removed.
Paragraph (version B):
A syntactically valid segment MUST NOT produce errors.  This means
that some operations that might be considered erroneous, such as
indexing beyond the end of an array, simply result in fewer nodes
being selected.
Paragraph (version B):
The query consists of "$" followed by three segments: ".a", "[*]",
and ".b".
Paragraph (version A):
produces an empty nodelist, then the whole query produces an empty
nodelist.
Paragraph (version A):
are defined for each type of node.
Paragraph (version B):
As a consequence of this approach, if any of the segments produces an
empty nodelist, then the whole query produces an empty nodelist.
Paragraph (version B):
In what follows, the semantics of each segment are defined for each
type of node.
Paragraph (version A):
Selectors appear only inside child-appender and descendant-appender.
Paragraph (version B):
Selectors appear only inside child-segment and descendant-segment.
Paragraph (version B):
The following examples show the "wildcard" selector in use by a child
segment.
Paragraph (version B):
The following examples show the index selector in use by a child
segment.
Paragraph (version A):
apply one or more selectors to an input value and concatenate the
results into a single nodelist.
Paragraph (version A):
consists of a non-empty, comma-delimited sequence of selectors
enclosed in square brackets.
Paragraph (version B):
Segments apply one or more selectors to an input value and
concatenate the results into a single nodelist.
Paragraph (version B):
The child segment consists of a non-empty, comma-delimited sequence
of selectors enclosed in square brackets.
Paragraph (version A):
contains a comma-delimited sequence of selectors, each of which
selects zero or more children of the input value.
Paragraph (version A):
is the concatenation of the nodelists from each of its selectors in
the order that the selectors appear in the list.  Note that any node
matched by more than one selector is kept as many times in the
nodelist.
Paragraph (version A):
selects zero or more descendants of the input value.
Paragraph (version B):
A child segment contains a comma-delimited sequence of selectors,
each of which selects zero or more children of the input value.
Paragraph (version B):
Selectors of different kinds may be combined within a single child
segment.
Paragraph (version B):
The resulting nodelist of a child segment is the concatenation of the
nodelists from each of its selectors in the order that the selectors
appear in the list.  Note that any node matched by more than one
selector is kept as many times in the nodelist.
Paragraph (version B):
The descendant segment consists of a double dot ".." followed by a
child segment ("descendant-segment").
Paragraph (version B):
Shortand notations are also provided that correspond to the shorthand
forms of the child segment.
Paragraph (version B):
Note that ".." on its own is not a valid segment.
Paragraph (version B):
A descendant segment selects zero or more descendants of the input
value.
Paragraph (version A):
"[<selectors>]" to a descendant nodelist.
Paragraph (version B):
The resultant nodelist of a descendant segment of the form
"..[<selectors>]" is the result of applying the child segment
"[<selectors>]" to a descendant nodelist.
Paragraph (version B):
Attacks on availability may attempt to trigger unusually expensive
runtime performance exhibited by certain implementations in certain
cases.  (See RFC8949 for issues in hash-table implementations, and I-
D.draft-ietf-jsonpath-iregexp for performance issues in regular
expression implementations.)  Implementers need to be aware that good
average performance is not sufficient as long as an attacker can
choose to submit specially crafted JSONPath queries or arguments that
trigger surprisingly high, possibly exponential, CPU usage or, for
example via a naive recursive implementation of the descendant
segment, stack overflow.  Implementations need to have appropriate
resource management to mitigate these attacks.