swagger-api / swagger-api/swagger-ui

Topbar not showing

Open
#7,895 9 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A (please complete the following information)
  • OS: ubuntu 20
  • Browser: chrome
  • Version: 99.0
  • Method of installation: npm (with webpack)
  • Swagger-UI version: 4.6.1
  • Swagger/OpenAPI version: n/a
Content & configuration

I cannot get mulitple swagger urls to work. I am getting "No API definition provided.".
It works with a single url just fine, but I can't get the Topbar to show either way. I am using a very basic setup based on the getting started repo: https://github.com/swagger-api/swagger-ui/tree/master/docs/samples/webpack-getting-started

I have tried with or without the preset/plugins shown below.

My complete index.json (includes Swagger-UI configuration options):

import SwaggerUI from 'swagger-ui'
import 'swagger-ui/dist/swagger-ui.css';

SwaggerUI({
    dom_id: "#swagger-ui",
    urls: [
        {
            url: "http://petstore.swagger.io/v2/swagger.json",
            name: "test1",
        },
        {
            url: "http://petstore.swagger.io/v2/swagger.json",
            name: "test2",
        },
    ],
    queryConfigEnabled: true,
    presets: [
        SwaggerUI.presets.apis,
        SwaggerUI.SwaggerUIStandalonePreset
    ],
    plugins: [
        SwaggerUI.plugins.Topbar
    ]
});

Screenshots
How can we help?

Explain how i can get the topbar to show, so i can switch between multiple openapi json files.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the webpack getting-started sample and reproduce the provided SwaggerUI configuration using its two URLs, presets, and Topbar plugin. Check why the Topbar does not appear and why multiple definitions produce “No API definition provided.” Done means the sample displays the Topbar and allows switching between the configured OpenAPI files.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.