Skip to content

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 <brad@brad-house.com>
@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