Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Hide info.description #5267

Closed
Leon99 opened this issue Mar 27, 2019 · 2 comments
Closed

Hide info.description #5267

Leon99 opened this issue Mar 27, 2019 · 2 comments

Comments

@Leon99
Copy link

Leon99 commented Mar 27, 2019

It would be great to have an option to not show info.description.
Use case: we use ReDoc to present API's documentation, however, we still want to have Swagger UI to be able to execute operations. Swagger UI, unlike ReDoc, doesn't generate anchors for Markdown headers, which gives an impression that the documentation is broken. Besides, it requires a user to scroll through the description to get to the operation list.

@hkosova
Copy link
Contributor

hkosova commented Jul 4, 2020

Here's a plugin that hides the info.description text:

// index.html

const HideInfoDescriptionPlugin = () => {
  return {
    wrapComponents: {
      info: (Original, system) => (props) => {
        return system.React.createElement(Original, {
          ...props,
          info: props.info.set("description", "")
        })
      }
    }
  }
}

// Build a system
const ui = SwaggerUIBundle({
  url: "https://petstore.swagger.io/v2/swagger.json",
  ...
  plugins: [
    HideInfoDescriptionPlugin    // <------
  ],
  ...
})

@Yahayasabiyu
Copy link

intitle:"Swagger UI - " + "Show/Hide"

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

4 participants