Skip to content

Added comma for index + step in slice#102

Open
elrandira wants to merge 3 commits into
h2non:masterfrom
elrandira:master
Open

Added comma for index + step in slice#102
elrandira wants to merge 3 commits into
h2non:masterfrom
elrandira:master

Conversation

@elrandira

@elrandira elrandira commented May 13, 2022

Copy link
Copy Markdown

This is my proposition to add comma in index such as in $..books[1,2] and step in slice such as in $..books[::-1] or $..books[0:3:2]

for the comma in index, the code is similar to handling of comma in fields. #28

For step in slice, all the code was already there, just needed to implement the rule... ¯_(ツ)_/¯

All tests passed + new ones

juliannguyen4 added a commit to aerospike-community/jsonpath-ng that referenced this pull request Sep 12, 2022
@michaelmior

Copy link
Copy Markdown
Collaborator

@elrandira Sorry for the very long delay. If you're still interested in having this merged and you're able to update the PR, let me know!

@elrandira

Copy link
Copy Markdown
Author

sure, I'll try in the next days. I am going to need to setup the environment again for this.

@kurtmckee

Copy link
Copy Markdown

This will conflict with a documented JSONPath syntax for selecting multiple indexes simultaneously:

image

https://goessner.net/articles/JsonPath/index.html#e3

This PR should be closed to avoid introducing conflicting syntax.

@kurtmckee

Copy link
Copy Markdown

I think I misread this; my interpretation was that this was offering commas as an alternative to colons in slice syntax, but now that I've read the code that doesn't appear to be what's happening here.

I recommend merging #145 first, which heavily parametrizes the test suite. It will make it easier to integrate the tests introduced here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants