mbj4668 / pyang

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

UML Plugin: Add new options to allow more control as to how the PlantUML code is rendered #868

Closed nkhancock closed 8 months ago

nkhancock commented 1 year ago

Companies may have their own guidelines on how YANG models are rendered in UML, such as rendering the relationship from an interior node to a choice statement as composition rather than a dotted line. This pull requests adds new UML-specific options to control some aspects of the rendering of UML and extends the --uml-no option to suppress additional parts of the diagram as detailed below.

--uml-no: Adds the following new values

--uml-max-bits: Currently pyang renders a bits typedef as a class with the \<\<typedef>> stereotype. The presence of this new option enables the rendering of a bits typedef as a class with the \<\<bits>> stereotype and also sets the maximum number of bit values to display.

--uml-more-values: pyang indicates that more values are present within a typedef class through the text "MORE". This new option allows this to be changed to "..." to align with some best practices.

--uml-unbounded: pyang indicates an unbounded upper limit of multiplicity (maxelements) using an "N". UML defines this generally using a "*" as do many best practice guidelines. This new option allows the rendering of an unbounded multiplicity as a "*" rather than an "N".

--uml-choice, --uml-case, --uml-uses: pyang uses a dotted line relation between an interior node and a choice and between a choice and its cases and uses a navigable association to a grouping to indicate a uses statement. Some best practice guidelines and other tools use other relationships such as composition between an interior node and a choice or a dependency relationship for a uses statement. These new options allow a user to define how the relations for choice, case and uses are rendered. If the uses statement is to be rendered as a UML dependency, the label on the relation also changes from "uses" to "\<\<uses>>" to indicate the type of dependency according to UML notation.

All changes are backwards compatible, that is the rendering of PlantUML code does not change unless one or more of these new options are specified.