Plant UML using Visual Studio code

Scenario:

Create uml diagram declarative using Plant UML in Visual Studio code.

Solution:

You need to install.

  1. Install:
    1. Visual studio code -> Extension -> PlantUML
    2. To create UML's other than sequenc diagram, download Graphviz (https://graphviz.gitlab.io/_pages/Download/Download_windows.html) and install.
    3. Visual studio code > Preferences > Settings > Plantuml ->  Command Args -> Edit [settings.json].
    4. In settings.json add "plantuml.commandArgs": [
              "-DGRAPHVIZ_DOT=..graphviz-2.38\\..\\bin\\dot.exe",
          ]
    5. Close and reopen Visual studio code 
  2. File -> New File -> Save as (with .wsd extension)

  3. Add below to generate Class diagram for User class

  4. @startuml UserRoles
    abstract class BaseUser
    class Shopper #Yellow
    class User #Yellow
    {
        + CreateUser (namehashPassword): id
        + UpdateUser (iduserData) : id
    }
    class Role
    {
       + CreateRole (nameid 
    }
    class UserRole #Yellow
    {
         - User user
         + AssociateRole (userIdroleIdvoid
    }
    UserRole .up.> Role
    UserRole .up.> User
    BaseUser <|-- User
    User <|-- Shopper
    @enduml
    
    

  5. Ctrl + Shift + p -> PlantUML: Preview Current Diagram 
  6. To save to file Ctrl + Shift + p -> Export Current File Diagrams
     



No comments:

Post a Comment

Move Github Sub Repository back to main repo

 -- delete .gitmodules git rm --cached MyProject/Core git commit -m 'Remove myproject_core submodule' rm -rf MyProject/Core git remo...