Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tools): add composition, aggregation relationships in UML #595

Merged
merged 1 commit into from
Jan 24, 2023

Conversation

mttrbrts
Copy link
Member

Closes #166

Adds support for Composition and Aggregation relationships in UML output formats (Mermaid & PlantUML).

Current Behaviour

classDiagram
class `org.acme.Root` {
<< concept>>
   + `String` `firstName`
   + `String` `lastName`
   + `DateTime` `dob`
   + `Integer` `age`
   + `Double` `height`
   + `Children[]` `children`
}

`org.acme.Root` "1" o-- "1" `org.acme.Company` : company
`org.acme.Root` --|> `[email protected]`
class `org.acme.Person`
<< concept>> `org.acme.Person`

`org.acme.Person` --|> `[email protected]`
class `org.acme.Children` {
<< concept>>
   + `String` `name`
   + `Integer` `age`
   + `String` `hairColor`
   + `Boolean` `coolDude`
   + `String` `missing`
   + `Pet` `pet`
   + `String[]` `favoriteColors`
   + `Integer[]` `favoriteNumbers`
   + `String[]` `mixed`
   + `String[]` `arrayOfNull`
   + `String[]` `emptyArray`
   + `Pet[]` `favoritePets`
   + `Stuff[]` `stuff`
}

`org.acme.Children` --|> `org.acme.Person`
class `org.acme.Pet` {
<< concept>>
   + `String` `name`
   + `String` `breed`
}

`org.acme.Pet` --|> `[email protected]`
class `org.acme.Stuff` {
<< concept>>
   + `String` `ssn`
   + `String` `firstName`
   + `String` `sku`
   + `Double` `price`
   + `Pet` `product`
}

`org.acme.Stuff` --|> `[email protected]`
class `org.acme.Company` {
<< concept>>
   + `String` `name`
   + `Employee[]` `employees`
}

`org.acme.Company` --|> `[email protected]`
class `org.acme.Employee` {
<< concept>>
   + `String` `name`
}

`org.acme.Employee` --|> `org.acme.Person`

Loading

New Behaviour

classDiagram
class `org.acme.Root` {
<< concept>>
   + `String` `firstName`
   + `String` `lastName`
   + `DateTime` `dob`
   + `Integer` `age`
   + `Double` `height`
   + `Children[]` `children`
}

`org.acme.Root` "1" *-- "*" `org.acme.Children`
`org.acme.Root` "1" o-- "1" `org.acme.Company` : company
class `org.acme.Person`
<< concept>> `org.acme.Person`

class `org.acme.Children` {
<< concept>>
   + `String` `name`
   + `Integer` `age`
   + `String` `hairColor`
   + `Boolean` `coolDude`
   + `String` `missing`
   + `Pet` `pet`
   + `String[]` `favoriteColors`
   + `Integer[]` `favoriteNumbers`
   + `String[]` `mixed`
   + `String[]` `arrayOfNull`
   + `String[]` `emptyArray`
   + `Pet[]` `favoritePets`
   + `Stuff[]` `stuff`
}

`org.acme.Children` "1" *-- "1" `org.acme.Pet`
`org.acme.Children` "1" *-- "*" `org.acme.Pet`
`org.acme.Children` "1" *-- "*" `org.acme.Stuff`
`org.acme.Children` --|> `org.acme.Person`
class `org.acme.Pet` {
<< concept>>
   + `String` `name`
   + `String` `breed`
}

class `org.acme.Stuff` {
<< concept>>
   + `String` `ssn`
   + `String` `firstName`
   + `String` `sku`
   + `Double` `price`
   + `Pet` `product`
}

`org.acme.Stuff` "1" *-- "1" `org.acme.Pet`
class `org.acme.Company` {
<< concept>>
   + `String` `name`
   + `Employee[]` `employees`
}

`org.acme.Company` "1" *-- "*" `org.acme.Employee`
class `org.acme.Employee` {
<< concept>>
   + `String` `name`
}

`org.acme.Employee` --|> `org.acme.Person`

Loading

Changes

  • Refactors and standardises the output of Mermaid and PlantUML diagrams (both now support the same UML features and have a common base class)
  • Improves treatment of escaped characters in both formats
  • Adds two new CLI parameters to expose the new options showCompositionRelationships, and hideBaseModel. The existing behaviour is retained for backwards compatibility. A candidate for change in Planned deprecations #554 .
  • Increases test coverage, and refactors tests to show individual format failures

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

@mttrbrts mttrbrts requested a review from a team January 23, 2023 09:58
Copy link
Contributor

@dselman dselman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it!

@mttrbrts mttrbrts merged commit 8a40502 into accordproject:main Jan 24, 2023
@mttrbrts mttrbrts deleted the mr-tools-diagrams branch January 24, 2023 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for class diagram relationships in PlantUML generation.
2 participants