Closed farshidtz closed 2 years ago
Since there can be responses (e.g. counts) that don't actually come from TDs removing this restriction makes sense. There is a general problem with defining the data model of query responses, but I don't see any good solution.
I did make the suggestion on the PR to add a sentence saying the data schema is implied by the query and the XPath specification. In the TM we would have to omit the data schema or just use "object" (with no members). Is the returned JSON always enclosed in an object, at least? Or could there be raw JSON fragments, like numbers or strings with no enclosing object? Can there be a top-level array? In which case we might need a more complex schema in the TM using "oneOf", etc.
For now we can just add the sentence "schema is implied" as I suggested in the PR. When we get around to doing the TM we can worry about defining a concrete schema (but should at least document requirements for it, here is good).
I did try scanning the XPath3.1 spec to see if there was an obvious section defining the output schema. It's not obvious, anyway: https://www.w3.org/TR/xpath-31/. XQuery 3.1 spec seems similar: https://www.w3.org/TR/xquery-31/
This splits from #156
The current spec has the following assertion for both XPath responses:
How to model the response when a single attribute is selected? What about functions (e.g. count) calls?
Raised in #153