swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

Topbar plugin is only included in Standalone

Open brpeterman opened this issue 6 years ago • 5 comments

Q&A

  • Method of installation: npm
  • Swagger-UI version: 3.21.0

Content & configuration

Swagger-UI configuration options:

        SwaggerUI({
            urls: [/* ... */],
            dom_id: '#swagger-ui',
            deepLinking: true,
            presets: [
                SwaggerUI.presets.apis,
                SwaggerUIStandalonePreset // Brings in TopbarPlugin
            ],
            plugins: [/* ... */],
            layout: 'CustomLayoutUsingTopbar',
            validatorUrl: null,
            displayOperationId: true,
            filter: true,
            operationsSorter: 'alpha',
            defaultModelsExpandDepth: 0
        });

Describe the bug you're encountering

The Topbar plugin is not available in the plugins property of the Swagger UI object. It seems to live in its own directory and only gets imported in the standalone preset.

To reproduce...

Steps to reproduce the behavior:

  1. In your Swagger UI configuration, import swagger-ui as SwaggerUI.
  2. Add SwaggerUI.plugins.Topbar to your plugin configuration.
  3. Use a layout that includes Topbar.
  4. Load your Swagger UI website.

Expected behavior

The website renders, topbar and all.

Actual behavior

The website does not render and there's an error in the console:

Could not find component Topbar

Additional context or thoughts

As you can see from my configuration, I can work around this by including the Standalone preset. However, that forces me to serve a whole bunch of code that does not need to go to the browser at all.

brpeterman avatar Mar 08 '19 22:03 brpeterman

Any updates on this?

MJLHThomassen-Sorama avatar Dec 17 '20 10:12 MJLHThomassen-Sorama

Bump...

Juarrow avatar Jun 18 '21 09:06 Juarrow

Having the exact same issue

JarvisCraft avatar Jul 01 '21 20:07 JarvisCraft

Same Issue

Axiloom avatar Jan 11 '22 18:01 Axiloom

Same Issue on Swagger-UI v4.14.0.

devpreview avatar Sep 09 '22 10:09 devpreview