Repository navigation
fix(data-impl): validate unique in lists without schema paths - #53
Conversation
|
#50 is now merged. @Deepya1502, could you please rebase this onto the latest main and resolve the conflicts? Also, a reminder of the open question from my earlier review: why does |
Derive unique leaf paths from schema ancestors when a list has no absolute schema path. Add payload-list regression tests for duplicate and distinct nested unique values. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Delegate schema build phases to SchemaNodeSupport after the composition refactor. Restore structure and generated operation child paths, remove the unique ancestor fallback, and record unresolved unique paths as validation errors. Cover lifecycle paths and unique validation regressions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Combine the unique details leaf with upstream's existing item list, preserving mandatory and cardinality constraints. Supply valid required fields in unique regression inputs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9993deb to
527ac90
Compare
|
Thanks for the comment @lllyfeng , You’re right: this list should already have a schema path after SCHEMA_TREE . I traced the null back to the inheritance-to-composition refactor in c18dd66d : DataDefinitionImpl delegates schema getters to SchemaNodeSupport , but its build lifecycle never calls SchemaNodeSupport.buildSelf() . The phase completes without assigning paths. The paths are already null before anydata deserialization, and the codec reuses the original schema nodes, so this is not specific to anydata. |
lllyfeng
left a comment
There was a problem hiding this comment.
Thanks @Deepya1502, great root-cause analysis. Restoring the SchemaNodeSupport build lifecycle fixes the null schema paths introduced by c18dd66, which also caused an NPE in unique validation for any list on main. The tests fail on main and pass here, and CI is green. Approving and merging.
Two non-blocking follow-ups:
- Please update the PR title/description: the ancestor-walking workaround is gone, so it should describe restoring the schema path build lifecycle and fixing the unique-validation NPE (regression from c18dd66).
- When a unique constraint can't be resolved,
matchUniquerecords the same OPERATION_FAILED once per list entry. It would be cleaner to resolve the unique paths once before the entry loop and record a single error. A small follow-up PR would be welcome.
Summary
NullPointerException.unique "details/name"and test both duplicate and distinct values.This follows up the separate
uniquenull-schema-path review on #50; it does not change anydata strictness.Validation
mvn -q -pl yangkit-data-json-codec -am -Dtest=AnydataValidationOptionsJsonCodecTest,JsonCodecNotificationsTest -Dsurefire.failIfNoSpecifiedTests=false test