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

JSON Path is getting an IETF spec! #10

Open
gregsdennis opened this issue Feb 26, 2023 · 7 comments
Open

JSON Path is getting an IETF spec! #10

gregsdennis opened this issue Feb 26, 2023 · 7 comments

Comments

@gregsdennis
Copy link

gregsdennis commented Feb 26, 2023

It looks like the spec draft that you've based your implementation on is old. Check out the details at https://github.com/ietf-wg-jsonpath/draft-ietf-jsonpath-base. There have been quite a few changes (with good reason) since you last looked.

Mainly:

  • in and =~ are no longer valid operators.
  • functions in expressions

Also, I would recommend hiding JsonPath-Plus features behind a default-off configuration option to align with the spec.

There's also a comparison website which lists a bunch of paths and various implementations' results. I've added an issue to add this lib. I'll be working on it (I am not a JS dev), but if you want to add it yourself, feel free. It'd be great to have another implementation there.

And if you want to join in the coversation for developing the spec, you'd be welcome!

@gregsdennis
Copy link
Author

JSON Path now has an RFC!

https://www.rfc-editor.org/rfc/rfc9535.html

@P0lip
Copy link
Owner

P0lip commented Mar 6, 2024

Hey!
Yup, I'm following the progress.
I have an almost spec-compliant parser ready and will need to adjust the codegen later on.
I don't know the timeline yet, but I'd really like to complete that work some time this year, hopefully before the spec is final.
At this point, I'm still not fully confident I'll add support for functions that take NodesType, but let's see. The parser itself will follow the official grammar.

I'll certainly hide JSONPath-plus additions behind the flag as I'm not a huge fan of them. The only reason I added them in the first place was because of https://github.com/stoplightio/spectral.

@gregsdennis
Copy link
Author

Yeah, I understand having a large client like that can drive features. Let's hope they get on board.

We're also putting together a test suite. I don't think it can be "official," but the people who worked on the spec are building it, so that's close enough.

@P0lip
Copy link
Owner

P0lip commented Dec 3, 2024

I'm working on it right now and have the vast majority of the spec implemented.
However, I will most likely introduce a new library as there's no reasonable way to make the new spec work while retaining backward compatibility.
The test suite was pretty useful!

@gregsdennis
Copy link
Author

Can you just release a major version bump of this lib? This lib has a fair number of significant users, and the idea is to pull them along.

@P0lip
Copy link
Owner

P0lip commented Dec 8, 2024

The new package is here https://github.com/P0lip/jsonpath-rfc9535 and folks looking for a compliant implementation can use it.

Can you just release a major version bump of this lib?

I might do it, but nimma would never be fully compliant anyway due to how it works.
Moreover, filter-query is arguably difficult to optimize in its current form, and it would require an overhaul of Nimma to make it work nicely.

@gregsdennis
Copy link
Author

I guess now, you need to push Spectral Too use the new lib. They'll need to know that it will break people. The RFC paths are not entirely backwards compatible with all the added features that variation libs added.

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

No branches or pull requests

2 participants