swagger-to-plantuml

1.0.0 • Public • Published

Swagger to PlantUML

This package allows to create a UML diagram that represents the structure of the API.

It supports both Swagger 2.0 schema and OpenAPI 3.0 Schema

Usage

const { swaggerToPlantUML } = require('swagger-to-plantuml')
// ...
const pumlCode = await swaggerToPlantUML(swaggerOrOASSpecPath)

Then you can use some library like node-plantuml to create the actual diagram.

const fs = require('fs')
const puml = require('node-plantuml')
// ...
const gen = puml.generate(pumlCode, { format: 'png' })
gen.out.pipe(fs.createWriteStream(outputPath))

swaggerToPlantUML(api)

It creates the PlantUML definition for

  • api(required) string

    The file path or URL of your Swagger API.

  • Return value Promise<string>

    PlantUML diagram definition text.

Example Diagrams

Swagger 2.0

Diagram

Swagger 2.0 Specification

OpenAPI 3.0

Diagram

OpenAPI 3.0 Specification

Readme

Keywords

none

Package Sidebar

Install

npm i swagger-to-plantuml

Weekly Downloads

3

Version

1.0.0

License

Apache-2.0

Unpacked Size

297 kB

Total Files

9

Last publish

Collaborators

  • standlove