Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Converts OpenAPI 3.0 definitions to Plant UML text for visualisation of your API.

License

Notifications You must be signed in to change notification settings

VRDate/openapi-to-plantuml

Repository files navigation

openapi-to-plantuml


codecov
Maven Central

Java library to generate a PlantUML Class Diagram (supplemented with path information) from an OpenAPI 3.0 definition (YAML or JSON). Try it online here.

Features

Supports all features of OpenAPI 3.0 including

  • Mixed types (oneOf, anyOf, allOf)
  • Multiple levels of indirection ($ref -> $ref for example)
  • Multiple response content types

Status: Released to Maven Central

Limitations

  • Only handles internal references ("#/*"), that is the yaml file should be self-contained. As of 0.1.9 external refs are displayed but not exploded. Full external reference support is being considered.

TODO

  • Model Callbacks
  • Model additionalProperties

openapi-example.yml:

How to build

mvn clean install

How to quickly convert your OpenAPI definition

The easiest thing to do is to use the online converter. If your definition is large then PlantText may refuse to render it (the Plant UML text is encoded and added to the PlantText url which can get too long). In that case just add your yaml file to src/test/resources/demo/ directory and run mvn test. The generated image will be saved in target/demos.

Getting started

Add this dependency to your pom.xml:

<dependency>
 <groupId>com.github.davidmoten</groupId>
 <artifactId>openapi-to-plantuml</artifactId>
 <version>VERSION_HERE</version>
</dependency>

Or use the standalone jar-with-dependencies artifact from Maven Central (or from the target directory if you have built the project locally):

java -jar openapi-to-plantuml-VERSION_HERE-jar-with-dependencies.jar openapi.yaml PNG openapi.png

Usage

import com.github.davidmoten.oas3.puml.Converter;
String puml = Converter.openApiToPuml(openapi);

Examples

Unit test examples are here.

petstore-expanded.yml:

bookstore.yml:

ecommerce.yml

news.yml:

strava.yml:

twitter.yml:

ebay.yml:

About

Converts OpenAPI 3.0 definitions to Plant UML text for visualisation of your API.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 98.6%
  • Shell 1.4%

AltStyle によって変換されたページ (->オリジナル) /