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

Returning malformed xpath key when key with null value is passed in the path. #605

Open
LightBringer3six opened this issue Feb 17, 2025 · 2 comments

Comments

@LightBringer3six
Copy link

Request : -p /A/B[x=1][y='']/C

error is given- building get request failed: invalid value: malformed xpath key
Error: one or more path failed

I am requesting a list B for which one of the keys, say y='', has null value. When I pass this key in the path, it returns the error.

@karimra
Copy link
Collaborator

karimra commented Feb 17, 2025

Typically keys must have values if your gNMI server is backed by a YANG schema:

https://datatracker.ietf.org/doc/html/rfc7950#section-7.8.2

The combined values of all the leafs specified in the key are used to
   uniquely identify a list entry.  All key leafs MUST be given values
   when a list entry is created.  Thus, any default values in the key
   leafs or their types are ignored.  Any "mandatory" statements in the
   key leafs are ignored.

But your issue is really shell quoting and escape rules, it gets rid of '' and passes it as en empty string.
If should work as expected if you change the path to /A/B[x=1][y=\'\']/C

@LightBringer3six
Copy link
Author

LightBringer3six commented Feb 18, 2025

Thanks for the RFC @karimra .
About that last bit you added regarding escape rules!. When I requested the above-mentioned path with [y=''] it said "Unexpected data after path". I guess without \ is working for me. It's just I need to have values for all the keys. Please add if anything I need to know.

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