Giter Site home page Giter Site logo

OpenAPI2Puml

Build Status codecov Gitpod ready-to-code

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.

The original developers of Swagger2puml are:

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

  • openapi2puml-core

Following are the tools which this project internally uses:

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 --rm -it --name openapi2puml \
    -v $PWD/examples:/specs \
    openapi2puml/openapi2puml -i /specs/swagger.yaml -o /specs

A dockerhub repo exists here: https://hub.docker.com/r/openapi2puml/openapi2puml

To build and run a local copy, do the following:

# Obtain base image for build
$ sudo docker pull maven:3-jdk-11  # needed since docker-hub pull restrictions

# Build the image from the project
$ sudo docker build -t openapi2puml .

# Run a docker container
$ sudo docker run --rm -it --name openapi2puml \
    -v $PWD/examples:/specs \
    openapi2puml -i /specs/swagger.yaml -o /specs

Running in GitPod

You can directly run this code in GitPod by clicking this link and Running

and then using this command line:

java -cp /workspace/openapi2puml/openapi2puml-core/target/dependency/*:/workspace/openapi2puml/openapi2puml-core/target/openapi-plantuml-core-0.0.1-SNAPSHOT.jar org.openapi2puml.openapi.OpenApi2PlantUML -i /workspace/openapi2puml/examples/swagger.yaml -o /workspace/openapi2puml/examples

License

Apacahe 2.0

openapi2puml's Projects

openapi2puml icon openapi2puml

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.