localhost/swagger is loading as expected for me but remoteserver/swagger is having issues. Is it possible for me to save an offline copy of the swagger documentation that's generated? I can just send a zip file to a few users while I'm trying to debug the remote issue.
There are lots of ways to provide API docs to your users if you for some reason cannot host Swagger UI yourself. All suggestions assume you have an OpenAPI (Swagger) definition, that is the YAML/JSON file. If you don't know the location of the YAML/JSON file, you can infer it from the Swagger UI web page.
In no particular order:
Send the YAML/JSON file to your users and tell them to load it in http://editor.swagger.io in order to preview the API docs.
Import your OpenAPI definition file into SwaggerHub and host your API docs there.
Disclosure: SwaggerHub is made by the company I work for.
Put your OpenAPI definition file on any public web server, e.g. create a gist on GitHub. Then you can render API docs by loading it into Swagger UI public demo, like so:
http://petstore.swagger.io?url=YOUR_YAML_or_JSON_URL
If using a gist, make sure to specify a raw gist link (https://gist.githubusercontent.com/...). If using another hosting, make sure the hosting server supports CORS.
"Pack" Swagger UI and your OpenAPI definition into a single dependency-less file as explained here, and send the resulting file to your users.
Generate static HTML docs (not Swagger UI, but a static HTML page without "try it out"): load your OpenAPI definition into http://editor.swagger.io, then select the menu item Generate Client > html or html2 or dynamic-html.
The "Generate Client" feature uses Swagger Codegen, so you can also use the CLI version of the Codegen to generate the desired output.
See also:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With