Atomic roots are not given as a result for an empty query $
#160
Labels
area: result
Improvements in query result reporting
good first issue
Good for newcomers
help wanted
External contributions welcome
type: bug
Something isn't working
Milestone
Package
CLI
Describe the bug
The empty query
$
should return the root of the document. Currently it does that only if the document is a complex object.Minimal Reproducible Example
Command:
rq '$'
Inputs:
"string"
42
true
null
Output:
Expected behavior
The output should be the same as for the documents
{}
and[]
, i.e. a single match of the root. Atomic values are valid JSON documents.Workarounds (optional)
No response
Proposed solution (optional)
Both engines have a dedicated
empty_query
function that special-cases the query$
by looking for an opening character. That's wrong, the actual special case should be checking if the input contains any non-whitespace character.I'm not actually sure it's needed to be special-cased. We should check if we can remove it and let the core code paths deal with it. If not, then the impl of that function should be fixed.
Version of the release
v0.5.0
Rust version
1.70.0
Target triple
x86_64-unkown-linux-gnu
Features enabled
default
Codegen options
No response
Additional context (optional)
No response
The text was updated successfully, but these errors were encountered: