Skip to content

Fork of the Swagger2PUML project to generate Class Diagrams (Plant UML) for a given OpenAPI (a.k.a Swagger) Definition

License

Notifications You must be signed in to change notification settings

klauswr/openapi2puml

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAPI2Puml

OpenApi to Plant UML conversion tool generates UML Class Diagrams from an Open API definition.

This is a fork of the original project Swagger2puml (https://github.com/kicksolutions/swagger2puml) which seems to have been dormant for some time.

This project is based on Maven. Following are modules we currently have

  • openapi2puml-core

Following are the tools which this project internally uses:

  • [Swagger Parser]
  • [Plant UML]
  • [Graphviz]
  • [Mustache]

How does it work

  • Input: Openapi2Puml parses the swagger definition from input using [Swagger Parser]
  • Transform: The swagger definition is built into an object model
  • Output: The object model is transformed into a [Plant UML] file using a [Mustache] template. Optionally a .svg image can be generated also.

openapi2puml-core:

This utility takes OpenAPI Yaml or JSON as input generates swagger.puml and swagger.svg files as output.

Below is the Sample Class Diagram generated by the application. To see the generated PUML file, please click here

Swagger-Class-Diagram-Sample

Building:

mvn package

The jar is built with dependencies and placed in the root of the project.

Usage:

java -jar openapi2puml.jar [options]

-i {Path of Swagger Definition (Can be either Yaml or json)}
-o {Target location where Puml File and Image should generated}
-generateDefinitionModelOnly {true/flase Defult False (Optional)}
-includeCardinality {true/flase Defult true (Optional)}
-generateSvg true/false; Default=true

Dockerized version of OpenAPI2Puml

It is also to use a docker container to run the tool. Simply mount a directory and add command line options by using docker run, e.g.

# Run a docker container
$ sudo docker run -d -p 7000:7000 --name openapi2puml klauswr/openapi2puml:latest

About

Fork of the Swagger2PUML project to generate Class Diagrams (Plant UML) for a given OpenAPI (a.k.a Swagger) Definition

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 97.3%
  • Mustache 1.7%
  • Dockerfile 1.0%