Open line-o opened 12 months ago
It seems that there is discussion in the XQuery 4 working group to allow sequences to be serialised to JSON arrays.
This only requires one change: serializing a sequence of length >1 should output the sequence as if it were an array, rather than raising an error.
from https://github.com/qt4cg/qtspecs/issues/576
We could keep our implementation as-is, knowing it will be part of the upcoming spec. Which means this is the current, shared understanding of the correct approach.
As discussed in the Community Call, perhaps this issue should be resolved as a “won’t fix” - since, as Michael Kay proposes, XQuery 4 is going to behave as eXist already does.
As discussed in the Community Call, perhaps this issue should be resolved as a “won’t fix”
@joewiz I feel that that is a bit of a dangerous proposition. At the moment:
As eXist-db is aiming for XQuery 3.1 compliance, I think we should fix this for eXist-db 7.0.0.
This issue came up today in the working group meeting.
In the related issue qt4cg/qtspecs#641 the discussion went further. Allowing sequences to be serialised to JSON has implications on the streamability of of the output as we have to look ahead, and buffer, the data before we can output the first character as it might be [
or not depending on the length of the sequence.
Describe the bug
This query
evaluates to
[1,2,3,4,5]
.The XQuery specification of the JSON serialization method says that an error should be raised instead: A sequence of length greater than one in the data model instance will result in a serialization error [err:SERE0023].
Expected behavior
JSON serialization to be spec compliant.
To Reproduce
Context (please always complete the following information)
Build: eXist-6.2.0 (c8fa4958b6d4a50bd0cba7f3e76a150226414187) Java: 11.0.18 (Debian) OS: Linux 5.15.49-linuxkit-pr (aarch64)
Additional context
conf.xml
? none