swagger-ui-bundle.js and swagger-ui-standalone-preset.js not shipped with swagger-ui

See original GitHub issue

I want to create a simple html page that use SwaggerUIBundle js class to setup the swagger ui interface, as demonstrated in this exemple.

I’m using webpack to package my project and all it’s dependencies.

When installing swagger-ui from npm, these two files are not installed (they seams to be excluded from the npm package through the .npmignore file) :

  • swagger-ui-bundle.js
  • swagger-ui-standalone-preset.js

Without these files i’m not able to reproduce the provided exemple.

The only solution i found was to import SwaggerUIBundle and SwaggerUIStandalonePreset from the swagger-ui-dist package instead of the swagger-ui.

I found the doc a bit unclear about which package to use:

swagger-ui is a traditional npm module intended for use in JavaScript web application projects that are capable of resolving dependencies (via Webpack, Browserify, etc).

This sentence sounds like i should use swagger-ui and not swagger-ui-dist in my situation.

I guess i’m not doing things the right way.

Which package should be effectivly installed ?

Thanks you

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
bryliecommented, Dec 18, 2017

I just ended up installing the swagger-ui-dist package, as it was easiest to get working.

0reactions
shockeycommented, Jan 11, 2018

Hmm - yeah, I don’t see any reason to not put the Standalone plugin into swagger-ui.

It was originally excluded based on the thought that most consumers would be embedding Swagger-UI into larger applications, and would have no use for the Topbar.

I’ll circle back on this before the end of the week, but if any of you want to beat me to a PR that would be fine 😉

Also, an FYI! If you’re using a module bundler, your app bundle will be significantly smaller if you use swagger-ui instead of swagger-ui-dist.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swagger-ui cannot access JS scripts - Stack Overflow
The problem is that java-script files are not accessible. It seems that the names are wrong - index.html expects SwaggerUiStandalonePreset.js ...
Read more >
Configuration - Swagger Documentation
Swagger UI accepts configuration parameters in four locations. From lowest to highest precedence: ... A JavaScript object describing the OpenAPI definition.
Read more >
Swagger UI tutorial | Documenting APIs - Idratherbewriting.com
Swagger UI provides a display framework that reads an OpenAPI specification document and generates an interactive documentation website.
Read more >
swagger-ui - npm
swagger-ui is a traditional npm module intended for use in JavaScript web application projects that are capable of resolving dependencies ...
Read more >
RESTful API documentation with Swagger | by Nukul Sharma
OAS 2.0 documentation is well supported whilst OAS 3.0 makes it ... The most useful file is `swagger-ui-bundle.js`, which is a build of ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found