[YANGTOOLS-1431] Unsupported leaf under causes parsing failure Created: 03/May/22  Updated: 03/May/22  Resolved: 03/May/22

Status: Resolved
Project: yangtools
Component/s: parser
Affects Version/s: 8.0.3
Fix Version/s: 9.0.0, 8.0.4

Type: Bug Priority: Medium
Reporter: Peter Suna Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: regression
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Issue
Adding empty collection to Supported Features will break building EffectiveModelContext. The exception thrown when build is executed is informing that the root of the issue is an invalid YANG model:
`Leaf is missing a 'type' statement [at yangtools/parser/yang-parser-impl /target/test-classes/ietf-ip/ietf-ip@2018-02-22.yang:222:11]  `

Expected solution

If is not allowed providing empty collection, add condition which will check empty collection and throw actual root of issue.



 Comments   
Comment by Robert Varga [ 03/May/22 ]

So the problem here seems to be that the implicit undeclared case statement does not recognize the if-feature statement of its child – hence it gets built, which in turn attempts to build the leaf, which is not supported, leading to its substatements not being there, leading to the failure.

The problem is that we should not attempt to copy/build the leaf statement in the first place, but, more importantly, should not be building the case statement either. This will need a bit of magic to sort through.

Generated at Wed Feb 07 20:56:08 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.