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
JSONPath response data model #156
Comments
Would not be a string (single attribute) just a TD fragment? is still a part of a major TD, why should it not be a TD fragment? |
It will not always be a set of TD fragments. The result could be a single fragment: 5 for counting or "urn:example:some-td" for querying just an id. Note that the above are valid JSONs; see https://datatracker.ietf.org/doc/html/rfc8259#section-13. |
For JSONPath, this seems to be implementation-specific right now. Picking a single object/element is not always returned as an array: See Nebhale: https://jsonpath.herokuapp.com/ But the IETF draft suggests returning list always so our text would be correct: |
Note there is a new version now: https://datatracker.ietf.org/doc/html/draft-ietf-jsonpath-base-01 |
Problem is, JSONPath is currently a moving target and the IETF RFC is unlikely to be finalized prior to our (original) target date for a Discovery PR. So we have a couple of choices:
|
|
During the F2F Carsten Bormann noted that the JSONPath group was seeking feedback but this is needed immediately (the next IETF meeting is next week, and there are various deadlines for locking down the specs imminent). So we should immediately review the JSONPath document and provide feedback on our primary use cases (e.g. limited keyword search, perhaps string matching). @relu91 had volunteered to do this during the F2F so I will reach out to him via email. |
(I apologize for not being able to respond in the last meeting due to equipment trouble.) @farshidtz has summarized the issue I had when I tried to query using JSONPath in my previous integration with Node-RED: w3c/wot-testing#29 . |
I'm reviewing the spec as @mmccool asked and I think this is a JSONPath limitation. So as @farshidtz noted JSONPath has a special operator to access descendants of a particular node, the so-called Descendant Selector (which is basically rel-path = "@" *(dot-selector / index-selector) ; <--- here we are missing "descendant-selector" rule So my conclusion would be that is a JSONPath limitation. What is not clear to me (and maybe we might need to ask for help) is that inside the filter selector as a boolean expression we can use as a path a valid basic-expr = exist-expr / paren-expr / (neg-op paren-expr) / relation-expr ; expression rule
exist-expr = [neg-op] path
path = rel-path / json-path ; notice how we can use a valid json path as argument.
rel-path = "@" *(dot-selector / index-selector) The document is not really clear about how a json-path should be evaluated inside a Filter Selector. |
Digging further on the problem it seems that major JSON-path implementations do not really support filtering with recursive descent: https://cburgmer.github.io/json-path-comparison/results/filter_expression_after_dot_notation_with_wildcard_after_recursive_descent.html ; |
I moved the discussion to #232, cause I'm feeling that we are a little bit out of topic for this issue. It seems that the original question is already addressed by @farshidtz comment:
What I can say is that even in the new document I got the impression that implementers are required to return always a list too. |
I've split the XPath concern to another issue: #247 To summarize: According to the draft IETF JSONPath spec, the responses are always lists and there is no support for aggregation functions. This is inline with the statements in the discovery spec. Other topics discussed here are not relevant and can be continued elsewhere (see references above). |
The current spec has the following assertion for both JSONPath and XPath responses:
We need to check if this is valid.
What happens when a single attribute is selected? What about functions (e.g. count)?
Raised in #153
For XPath, please refer to #247
The text was updated successfully, but these errors were encountered: