mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
528 stars 342 forks source link

UML Plugin: Fix uses attributes not hidden when using UML option --uml-classes-only #892

Open nkhancock opened 3 months ago

nkhancock commented 3 months ago

When rendering YANG modules with 'uses' statements using the UML option --uml-classes-only, the {uses} attributes of the class representing the YANG statement in which the 'uses' statement is used are not suppressed as would be expected. This pull request fixes this issue.

The following examples illustrate what has been fixed.

The following YANG data models were used to test this fix:

test-groupings ``` module test-groupings { namespace "http://www.adtran.com/ns/yang/test-groupings"; prefix tst-grp; revision 2024-03-11 { description "Initial revision."; reference "None."; } grouping grouping-1 { description "A grouping with a top-level non-interior data node."; leaf a-top-level-leaf-in-a-grouping { type string; description "Bla bla bla."; } } grouping grouping-2 { description "A grouping with a top-level interior data node."; container a-top-level-container { leaf a-leaf-within-a-top-level-container-in-a-grouping { type string; description "Bla bla bla."; } } } } ```
test-uses-interior ``` module test-uses-interior { namespace "http://www.adtran.com/ns/yang/test-uses-interior"; prefix tst-uses-int; import test-groupings { prefix tst-grp; } revision 2024-03-11 { description "Initial revision."; reference "None."; } container top-level-container { description "A uses statement within a top-level interior node (container)."; uses tst-grp:grouping-1; uses tst-grp:grouping-2; } } ```

Example

--uml-classes-only not used

image

--uml-classes-only used

Before the fix:

image

After the fix:

image