Skip to content
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

Atomic roots are not given as a result for an empty query $ #160

Closed
V0ldek opened this issue Jun 18, 2023 · 2 comments · Fixed by #283
Closed

Atomic roots are not given as a result for an empty query $ #160

V0ldek opened this issue Jun 18, 2023 · 2 comments · Fixed by #283
Assignees
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

Comments

@V0ldek
Copy link
Member

V0ldek commented Jun 18, 2023

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

@V0ldek V0ldek added the type: bug Something isn't working label Jun 18, 2023
@github-actions github-actions bot added the acceptance: triage Waiting for owner's input label Jun 18, 2023
@github-actions
Copy link

Tagging @V0ldek for notifications

@V0ldek V0ldek added this to the v1.0.0 milestone Jun 18, 2023
@github-actions github-actions bot added acceptance: go ahead Reviewed, implementation can start and removed acceptance: triage Waiting for owner's input labels Jun 18, 2023
@V0ldek V0ldek added help wanted External contributions welcome good first issue Good for newcomers mod: engine area: result Improvements in query result reporting labels Jun 18, 2023
@V0ldek V0ldek assigned V0ldek and unassigned V0ldek Aug 30, 2023
@V0ldek V0ldek self-assigned this Sep 20, 2023
V0ldek added a commit that referenced this issue Sep 22, 2023
- Previously only object and array roots were supported.

Ref: #160
@V0ldek V0ldek mentioned this issue Sep 22, 2023
3 tasks
V0ldek added a commit that referenced this issue Sep 22, 2023
- Previously only object and array roots were supported.

Ref: #160
charles-paperman pushed a commit that referenced this issue Sep 22, 2023
* First jab at atomic roots fix.

* feat: fixed empty query on atomic roots

- Previously only object and array roots were supported.

Ref: #160

* fix invalid span end tests on x86
@github-actions github-actions bot removed the acceptance: go ahead Reviewed, implementation can start label Sep 22, 2023
@V0ldek
Copy link
Member Author

V0ldek commented Sep 23, 2023

Fixed in v0.8.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
Status: Released
Development

Successfully merging a pull request may close this issue.

1 participant