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

Use JMESPath for Airnode _path reserved parameter #690

Closed
37Rb opened this issue Nov 24, 2021 · 5 comments
Closed

Use JMESPath for Airnode _path reserved parameter #690

37Rb opened this issue Nov 24, 2021 · 5 comments

Comments

@37Rb
Copy link

37Rb commented Nov 24, 2021

Description

It would be powerful if we could pass JMESPath queries (or something similar) in the _path parameter so that JSON responses can be transformed and filtered before the data is put on-chain.

See examples here: https://jmespath.org/examples.html

Version

All

Present Behaviour

Currently _path is processed by a (seemingly) basic query processor.

Expected Behaviour

We should be able to use a more powerful off-the-shelf JSON query language to select data from responses. If the _path value is fed into JMESPath then users would have more control over API responses.

@Siegrift
Copy link
Contributor

Relates to #507

@bbenligiray
Copy link
Member

Reminds me of https://docs.paralink.network/developer-guide/paralink-query-language.html
There are three issues with this approach:

  • Requires requester to learn thing
  • It's still limited, for example lacks date operations, which are needed for a lot of use cases
  • The packages that will be used to implement the feature tends to be under-maintainted (for example https://github.com/jmespath/jmespath.js)
    But this is still an issue that needs to be addressed as Emanuel linked above. I sent you an invite to the call that we will be talking about the feasibility of a solution that potentially doesn't have the issues above.

@37Rb
Copy link
Author

37Rb commented Nov 24, 2021

Requires requester to learn thing

I don't see that as a problem if it's a commonly used thing intended for this purpose.

The packages that will be used to implement the feature tends to be under-maintainted (for example https://github.com/jmespath/jmespath.js)

Good point but it does seem heavily used with 6M+ weekly downloads. https://www.npmjs.com/package/jmespath

It's still limited, for example lacks date operations, which are needed for a lot of use cases.

Agreed.

Sure, happy to join the call. I'm not a fan of a particular solution. Just learning to be an Airnode user and it's pretty clear that I would like to be able to manipulate API responses as a requester. This seemed like an easy way to get there.

@37Rb
Copy link
Author

37Rb commented Nov 24, 2021

This is relevant. jmespath/jmespath.site#65 (comment)

@37Rb
Copy link
Author

37Rb commented Dec 1, 2021

Closing due to a better solution being looked at.

@37Rb 37Rb closed this as completed Dec 1, 2021
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

3 participants