Swagger-UI: add download buton for JSON response?

When using other companies’ Swagger, I usually see a download button for the JSON response (see screenshot).

Is this possible with the ServiceStack Swagger-UI?

I’m assuming that’s a different version to what’s embedded in ServiceStack .dll’s.

If the new UI still supports the previous Open API v2 format you should be able to use it with your /openapi JSON endpoint, but you’d need to download & run it separately from https://github.com/swagger-api/swagger-ui

The alternative is to try and customize the existing version, info on customizing Swagger UI and running custom JS hooks is documented at:
https://docs.servicestack.net/openapi#overriding-openapi-embedded-resources

Sorry, maybe my screenshot caused confusion.

It was taken from a third-party (non-ServiceStack) application. I included it to clarify what I was asking about.

My answer assumed it wasn’t the version of Swagger UI that’s shipped in ServiceStack’s .dll’s.

Sorry (again), but does your answer mean that the Swagger version shipped with ServiceStack does not support a download button?

And, if I want the button I should follow your earlier answer?

I downloaded the latest swagger 3.43.0, simply opened it’s index.html (in dist folder). Then pointed to my /openapi endpoint, as you suggested, and I have an updated swagger-UI page with the all important download button.

Thank you for the pointers.

1 Like