openapi-mermaid
v3.226.1
Published
Creates Mermaid diagrams using OpenApi v3 docs
Downloads
1,160
Maintainers
Readme
openapi-mermaid
Generates Mermaid diagrams from OpenApi Docs
OpenApi-mermaid
NPM package use to generate mermaid diagram documentation for endpoints documented by swagger using the OpenAPI spec.
TypeScript usage with a hosted OpenApi Spec document.
import { generateDiagrams } from 'openapi-mermaid';
generateDiagrams({
openApiJsonUrl: '{Your Swagger Enpoint URL here}',
outputPath: './{outputFolder}/',
outputFileName: 'class-diagram', /* This is an optional parameter */
});
TypeScript usage with an OpenApi Spec document stored on your local computer.
import { generateDiagrams } from 'openapi-mermaid';
generateDiagrams({
openApiJsonFileName: '{location and file name of your OpenApi document}',
outputPath: './{outputFolder}/',
outputFileName: 'class-diagram', /* This is an optional parameter */
});
Javascript usage with a hosted OpenApi Spec document.
const generator = require('openapi-mermaid');
generator.generateDiagrams({
openApiJsonUrl: '{Your Swagger Enpoint URL here}',
outputPath: './{outputFolder}/',
});
Javascript usage with an OpenApi Spec document stored on your local computer.
const generator = require('openapi-mermaid');
generator.generateDiagrams({
openApiJsonFileName: '{location and file name of your OpenApi document}',
outputPath: './{outputFolder}/',
});
Working example with NRSRx based service
import { generateDiagrams } from 'openapi-mermaid';
generateDiagrams({
openApiJsonUrl: 'https://im-wa-cmpo-nrsr.azurewebsites.net/swagger/v1/swagger.json',
outputPath: './models/',
typeFilterCallBack: (val, i, arr) => !val.name.endsWith('ODataEnvelope'),
valuePropertyTypeFilterCallBack: (val, i, arr) => !val.name.startsWith('created') && !val.name.startsWith('updated'),
});