swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.41k stars 8.93k forks source link

Loading spinner should show when using the Spec parameter #4512

Open mckennajones opened 6 years ago

mckennajones commented 6 years ago
Q A
Bug or feature request? Feature
Which Swagger-UI version? 03.14.0
How did you install Swagger-UI? NPM
Which browser & version? Firefox 61
Which operating system? Win 10

Configuration (browser query string, constructor, config.yaml)

const ui = SwaggerUI({
      spec: JSON.parse(json),
      validatorUrl: '',
      domNode: this.el.nativeElement.querySelector('.swagger-container'),
      docExpansion: 'none',
      presets: [
        SwaggerUI.presets.apis,
      ]
    });

Expected Behavior

If you supply a large JSON spec to the spec parameter, which causes Swagger-UI to take a few seconds to render, it would be nice to show the same loading spinner that is displayed when loading a spec from a URL.

Current Behavior

Currently nothing is shown.

Possible Solution

Use the same spinner that is shown when waiting for the spec to download if you are using the URL parameter.

mckennajones commented 6 years ago

I can probably tackle this one