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

Means to prevent the display of the OpenAPI specification URL link. #4171

Closed
mikefidel opened this issue Jan 27, 2018 · 2 comments
Closed

Means to prevent the display of the OpenAPI specification URL link. #4171

mikefidel opened this issue Jan 27, 2018 · 2 comments

Comments

@mikefidel
Copy link
Contributor

mikefidel commented Jan 27, 2018

Wish to know if there is a way to prevent the display of the OpenAPI specification URL link.

The sponsor's preference is not to show the URL, if that can easily be avoided. This is a non-critical, low priority request for support.

Q A
Bug or feature request? Support
Which Swagger/OpenAPI version? 3.0.0
Which Swagger-UI version? 3.9.1
How did you install Swagger-UI? Copy the contents of Dist folder, and modify index.html
Which browser & version? current Chrome & Firefox
Which operating system? Windows 10

Configuration (index.html found in Dist folder)

Modifications to index.html found below:

<script>
window.onload = function() {
    
  // NdexOAS
  function HideTopbarPlugin() {
    return {
      components: {
        Topbar: function() { return null }
      }
    }
  }

  // Build a system
  const ui = SwaggerUIBundle({
    url: "http://ndexbio.oas.swagger-ui.custom.s3-website-us-west-2.amazonaws.com/ndex_openapi.json",  // NdexOAS
    dom_id: '#swagger-ui',
    deepLinking: true,
    docExpansion: 'none',  // NdexOAS
    presets: [
      SwaggerUIBundle.presets.apis,
      SwaggerUIStandalonePreset
    ],
    plugins: [
      SwaggerUIBundle.plugins.DownloadUrl,
      HideTopbarPlugin  // NdexOAS
    ],
    layout: "StandaloneLayout"
  })

  window.ui = ui
}
</script>

Current Behavior

The link to the OpenAPI document is displayed near the top of the info area. I believe this is done in ...src/core/components/info.jsx. Rendering appears to be determined on the field named "url". I could not chase where the contents of that field originates from. I'm reasonably sure it originates from the url parameter in SwaggerUIBundle({}). There are alternatives to the url parameter, and I wondered if one of them would prevent the link from being rendered. I experimented with configUrl, but the outcome was the same.

Here is a screen snapshot of the link, as outlined in a green box.
url

Desired Behavior

The link to the OpenAPI document is not rendered. That is, the url link shown in the above screen snapshot is not rendered.

@shockey
Copy link
Contributor

shockey commented Mar 14, 2018

Hey @mikefidel! Sorry for the delay here, I knew this was going to take some work in the core code.

I've just merged #4330, which creates some new plug points that you can use to ditch the URL line, like so:

const HideInfoUrlPartsPlugin = () => {
  return {
    wrapComponents: {
      InfoUrl: () => () => null,
      InfoBasePath: () => () => null, // this hides the `Base Url` part too, if you want that
    }
  }
}

This will work starting in the next release of Swagger-UI.

Closing for now since this addresses the question pretty directly - feel free to reply if there's anything outstanding.

Thanks for using OpenAPI and Swagger-UI!

@lock
Copy link

lock bot commented Jul 2, 2019

Locking due to inactivity.

This is done to avoid resurrecting old issues and bumping long threads with new, possibly unrelated content.

If you think you're experiencing something similar to what you've found here: please open a new issue, follow the template, and reference this issue in your report.

Thanks!

@lock lock bot locked and limited conversation to collaborators Jul 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants