mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
530 stars 343 forks source link

'strict' validation doesn't visit nodes defined in groupings? #804

Closed wlupton closed 2 years ago

wlupton commented 2 years ago

We've got a lint-like plugin that adds 'strict' phase validators, but were perplexed that it doesn't seem to visit nodes that are defined in groupings.

After a while we realised that 'strict' validation visits sub-statements rather than child nodes, so it descends into the groupings rather than into the nodes that have been expanded from the groupings.

The 'fix' is to use the 'reference_2' phase rather than 'strict' but:

mbj4668 commented 2 years ago

Yes this is intentional. The dict _v_i_children defines which phases are run over the expanded nodes.

A plugin can add its own phases with add_validation_phase(), and use set_phase_i_children() to make it run over the expanded nodes.

wlupton commented 2 years ago

ok; thanks!