1.0.0 • Published 4 years ago

swagger-to-plantuml v1.0.0

Weekly downloads
24
License
Apache-2.0
Repository
-
Last release
4 years ago

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