Repository navigation
Add JSON parsing support for YANG structures - #54
Deepya1502 wants to merge 3 commits into
Conversation
lllyfeng
left a comment
There was a problem hiding this comment.
Thanks for splitting this out. Two concerns:
- YangStructureDataJsonCodec.java:30-33 builds every field via JsonCodecUtil.buildChildData, but YangStructureMessageJsonCodec.parseHeader (L85) already builds the structure's fields. Result is double parsing: a notification with eventTime "not-a-date" now yields two identical BAD_ELEMENT records (one on main). Please avoid the double build, and report unknown fields instead of silently skipping them.
- YangStructure.java:7 now extends TreeNode — this changes getTreeNodeChild/XPath behavior for structures. Please explain the motivation, or drop it if not required.
Please add unit tests covering: valid structure data, an invalid leaf value (exactly one error), and an unknown member.
|
Addressed the review: structure fields are decoded only once, unknown structure members now produce an error, and notification tests verify one error for invalid |
lllyfeng
left a comment
There was a problem hiding this comment.
Thanks — structure fields are now decoded once (verified: invalid eventTime yields exactly one error), unknown members are reported, and the new tests cover both. One question before merging: removing TreeNode from YangStructure.java:7 still passes the full json-codec test suite locally, so the need isn't demonstrated by tests. Since it changes XPath/getTreeNodeChild behavior for structures, could you either add a test that requires it or drop it?
0d75e6f to
55c58b1
Compare
|
Addressed the latest review: |
Deepya1502
left a comment
There was a problem hiding this comment.
Addressed review comments
Summary
Separates YANG Structure JSON handling from the YANG Library integration PR, per review feedback on #48.
YangStructureunchanged; it does not extendTreeNode. Structure members are resolved through its existingSchemaNodeContainer.getSchemaNodeChild()API.YangStructureDataJsonCodeccreates the structure data node only.YangStructureMessageJsonCodecdecodes declared structure fields once, while message-specific content parsing handles notification payload fields.Verification
Tests cover valid structure messages, invalid
eventTimewith exactly one error, and an unknown structure member. A cleanmvn testpasses across the full reactor after rebasing onto currentmain.