Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Need way to hide curl command from swagger response using configuration #5020

Closed
Anujg1983 opened this issue Nov 13, 2018 · 4 comments
Closed

Comments

@Anujg1983
Copy link

Content & configuration

Swagger/OpenAPI definition:

# your YAML here

Swagger-UI configuration options:

SwaggerUI({
  // your config options here
})
?yourQueryStringConfig

Is your feature request related to a problem?

Describe the solution you'd like

Describe alternatives you've considered

Additional context

@hkosova
Copy link
Contributor

hkosova commented Jul 4, 2020

Here's a plugin that hides the "Curl" section from responses:

// index.html

  const HideCurlPlugin = () => {
    return {
      wrapComponents: {
        curl: () => () => null
      }
    }
  }

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

@lsloan
Copy link

lsloan commented Sep 28, 2021

  const HideCurlPlugin = () => {
    return {
      wrapComponents: {
        curl: () => () => null
      }
    }
  }

Is there any way to make a plugin like this that makes the "Curl" section collapsible rather than remove it completely?

@wh81752
Copy link

wh81752 commented Jul 11, 2023

Very good request!

The curl section leaks by default the API-KEY (if applicable of course). This is a no go. Think about a little presentation demonstrating a given API to a wider audience and - voila, key is leaked.

The first option is to just turn curl off. Works, but I guess we want to see curl once a while.
Second is to collapse. That's a decent solution.
The best is probably to only partially show the API-KEY or show a hash or something,

@armyofmarkness
Copy link

I too, would love to see this as a configurable option.

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

No branches or pull requests

6 participants