1.0.2 • Published 3 years ago

swagger-ui-plugin-extra-description v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Introduction

This Swagger-UI plugin allows to display multiple collapsible sections between the documentation's info and the paths list.

It works by wrapping the InfoContainer component to inject custom components.

Installation

npm i swagger-ui-plugin-extra-description

Usage

Add the plugin in the configuration object of SwaggerUI, and provides a list of sections like this :

import { ExtraDescriptionPluginFactory } from 'swagger-ui-plugin-extra-description';

SwaggerUI({
  // ...
  plugins: [
    ExtraDescriptionPluginFactory([
      {
        title: "Important section",
        content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis ...",
        forceOpen: true
      }, {
        title: "Changelog",
        content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis ..."
      }
    ]
  ]
})

Once the plugin has been applied, two components will be accessible if needed : ExtraDescriptions and ExtraDescription