Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ikemtz/openapi-mermaid
Generates Mermaid diagrams from OpenApi Docs
https://github.com/ikemtz/openapi-mermaid
class diagrams mermaid openapi swagger
Last synced: 14 days ago
JSON representation
Generates Mermaid diagrams from OpenApi Docs
- Host: GitHub
- URL: https://github.com/ikemtz/openapi-mermaid
- Owner: ikemtz
- License: mit
- Created: 2021-06-03T07:04:59.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-22T06:23:26.000Z (25 days ago)
- Last Synced: 2024-10-23T09:02:33.859Z (23 days ago)
- Topics: class, diagrams, mermaid, openapi, swagger
- Language: TypeScript
- Homepage:
- Size: 329 KB
- Stars: 10
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# openapi-mermaid
Generates Mermaid diagrams from OpenApi Docs[![Build Status](https://ikemtz.visualstudio.com/CI%20CD/_apis/build/status/openapi-mermaid?branchName=master)](https://ikemtz.visualstudio.com/CI%20CD/_build/latest?definitionId=20&branchName=master) [![npm version](https://badge.fury.io/js/openapi-mermaid.svg)](https://www.npmjs.com/package/openapi-mermaid) [![npm downloads](https://img.shields.io/npm/dt/openapi-mermaid)](https://www.npmjs.com/package/openapi-mermaid) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ikemtz_openapi-mermaid&metric=alert_status)](https://sonarcloud.io/dashboard?id=ikemtz_openapi-mermaid) [![Issues](https://img.shields.io/github/issues-raw/ikemtz/OpenApi-mermaid)](https://github.com/ikemtz/openapi-mermaid/issues) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=ikemtz_openapi-mermaid&metric=coverage)](https://sonarcloud.io/dashboard?id=ikemtz_openapi-mermaid) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=ikemtz_openapi-mermaid&metric=ncloc)](https://sonarcloud.io/dashboard?id=ikemtz_openapi-mermaid) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=ikemtz_openapi-mermaid&metric=security_rating)](https://sonarcloud.io/dashboard?id=ikemtz_openapi-mermaid)
# OpenApi-mermaid
NPM package use to generate mermaid diagram documentation for endpoints documented by swagger using the [OpenAPI spec](https://swagger.io/docs/specification/about/).
## TypeScript usage with a hosted OpenApi Spec document.
```javascript
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.
```javascript
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.
```javascript
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.
```javascript
const generator = require('openapi-mermaid');generator.generateDiagrams({
openApiJsonFileName: '{location and file name of your OpenApi document}',
outputPath: './{outputFolder}/',
});
```## Working example with NRSRx based service
```javascript
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'),
});
```