-
Notifications
You must be signed in to change notification settings - Fork 62
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
Extend CrudApiPlugin with JMESPath #680
Comments
I suggest that we apply this as a breaking change so that we can remove the obsolete Newtonsoft.Json package. |
It seems like JMESPath and JSONPath aren't equivalent. JMESPath supports retrieving items so from CRUD, supports only R. To support CUD we need to convert the data into an object, such as Newtonsoft JArray which we've got now. Unfortunately, Newtonsoft only supports JSONPath, so we can't replace it with JMESPath. What we could do, is to keep the current functionality based on JSONPath and offer the ability to use JMESPath queries for getOne and getMany operations. It would allow users to have richer select functionality, including paging at the cost of having to write slightly different queries for R than CUD. Thoughts @garrytrinder? |
I'm not a fan of mixing concepts, to me it would feel odd constructing a query one way for one action and another way for another. We could look into using https://github.com/jdevillard/JmesPath.Net which is a fully compliant JMESPath library that uses Newtonsoft as an alternative way of parsing and extracting items from JSON documents. |
We decided to:
|
It turns out that AST only applies to expressions not JSON. While the parser supports JTokens, this way of work is deprecated and the returned nodes are disconnected from the source document so it's not suitable for what we need. |
The .NET implementation of JSONPath is limited and only allows us to do basic filtering. In comparison, using JMESPath.net we can use the full power of JMESPath including implementing more complex scenarios such as paging ($top) or changing shape of the response ($select).
Let's switch to JMESPath and update the documentation accordingly.
The text was updated successfully, but these errors were encountered: