swagger-ui-flat-model-plugin
v0.4.0
Published
Plugin for swagger-ui to render models like swagger-ui-2
Downloads
6
Maintainers
Readme
swagger-ui-flat-model-plugin
Plugin for swagger-ui to add an additional way to display the request/responses models inspired by swagger-ui-2.
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
.