-
Notifications
You must be signed in to change notification settings - Fork 25
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
Problem with jmespath: unexpected behavior with single items (not arrays) #323
Comments
Another example is described in biothings/biothings_explorer#316 (comment) |
I've updated the opening post to match the discussions in Slack/add the json documents. The proposed fix is to adjust the BioThings API's always_list parameter behavior (so it works before jmespath). Then adjust x-bte annotations to add it to queries using jmespath as a just-in-case. The syntax is |
Assigning to myself to review and see if this is fixed. |
Using always_list fixes this behavior! Going to add to all jmespath operations while doing biothings/biothings_explorer#733... so track updates there. |
I'm trying to query MyChem's drugcentral info and only keep
drugcentral.bioactivity
objects with the matching action_type value (POSITIVE MODULATOR). So I'm setting the parameterjmespath
todrugcentral.bioactivity|[?action_type=='POSITIVE MODULATOR']
But if I try using that jmespath on this document C0017845_doesnt_work.json, I end up with
drugcentral.bioactivity: null
which is unexpected. (To retrieve this document yourself, use this GET query))POST-query with chemical C0017845 that returns null
VS when I try using jmespath on a different document C0018549_works.json, it works as-intended. (To retrieve this document yourself, use this GET query))
A POST query with chemical C0018549 that works as-intended
I do notice a different between these two documents that may account for this:
If this is the key, I'd like jmespath to be able to gracefully handle both situations...
The text was updated successfully, but these errors were encountered: