Skip to content

lyd_validate_minmax(): always return a valid data path if available #2354

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

Closed
wants to merge 1 commit into from

Conversation

bradh352
Copy link
Contributor

@bradh352 bradh352 commented Feb 21, 2025

The current code never returns a data path, only a schema path for
failures where the 'min' value is not reached. Integrators may need
to obtain both a LIST key as well as the leaf name to present proper
error messages.

When we don't have a full valid data path, the code now will return
the parent's data path with the current schema node name appended.

Only if there is no parent (not a realworld issue, but the test
system does this) will the schema path be used.

This fix was inspired by porting of SONiC's sonic-mgmt-common which
is utilizing this feature which previously worked with libyang1.

Fixes #2353

@bradh352
Copy link
Contributor Author

guess I need to update test cases to look at the 'better' paths returned :)

@bradh352 bradh352 force-pushed the validate-minmax branch 3 times, most recently from 66a2dae to 1cc6c49 Compare February 21, 2025 20:28
@bradh352 bradh352 changed the title lyd_validate_minmax(): always return a valid data path lyd_validate_minmax(): always return a valid data path if available Feb 21, 2025
@bradh352
Copy link
Contributor Author

ok, test cases are passing now. the actual test cases that were failing were due to 'parent' being NULL. Only in those cases does it now return a schema path, since parent would never be NULL if it was a child of a list.

The current code never returns a data path, only a schema path for
failures where the 'min' value is not reached.  Integrators may need
to obtain both a LIST key as well as the leaf name to present proper
error messages.

When we don't have a full valid data path, the code now will return
the parent's data path with the current schema node name appended.

Only if there is no parent (not a realworld issue, but the test
system does this) will the schema path be used.

This fix was inspired by porting of SONiC's sonic-mgmt-common which
is utilizing this feature which previously worked with libyang1.

Signed-off-by: Brad House <[email protected]>
@michalvasko
Copy link
Member

Fixed the path myself.

@bradh352 bradh352 deleted the validate-minmax branch March 3, 2025 11:11
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

Successfully merging this pull request may close these issues.

2 participants