0.4.0 • Published 9 months ago

swagger-ui-flat-model-plugin v0.4.0

Weekly downloads
-
License
AGPL-3.0
Repository
github
Last release
9 months ago

swagger-ui-flat-model-plugin

Build status License

Plugin for swagger-ui to add an additional way to display the request/responses models inspired by swagger-ui-2.

Plugin Demo

Preview

How to use it

From npm

  • Install the dependency
npm install swagger-ui-flat-model-plugin
  • Use it in the SwaggerUI object initialization
import { SwaggerUiFlatModelPlugin } from 'swagger-ui-flat-model-plugin';

SwaggerUI({
    url: './data/openapi.json',
    dom_id: '#swagger-ui',
    plugins: [SwaggerUiFlatModelPlugin],
});

From source

  • Download the files in the dist folder:
dist/swagger-ui-flat-model-plugin.css
dist/swagger-ui-flat-model-plugin.js
  • Include them in your website:
<link rel="stylesheet" href="./css/swagger-ui-flat-model-plugin.css" />
<script type="module" src="./js/swagger-ui-flat-model-plugin.js"></script>
  • Initialize the swagger ui using this plugin
SwaggerUIBundle({
    url: './data/openapi.json',
    dom_id: '#swagger-ui',
    plugins: [swaggerUiFlatModelPlugin],
});

See the example in the test folder for more details.

How to contribute

Use pnpm to install the dependencies and start the example project:

pnpm install
pnpm dev

Before pushing the changes build the project to create a production type bundle

pnpm build

To create a new release tag and push the commit, then publish on npm.js.