N/A
N/A
Considering an API that returns a stream of data (XML or JSON) as a file Content-disposition: attachment;filename=xxx.json.
We would like Swagger to generate:
Is it something possible?
Thank you for any response :)
Kinda related to #6206
To complete my original question: what we would want is actually to handle the download file through the browser native download popup.
Maybe something we can achieve with a plugin?
I've read the doc about plugins but it feels quite hard to know in which direction to look without knowing the internals of Swagger UI.
Giving it a second thought, I think this is not possible anyway because if you need to send headers, a basic "download link" won't work.
And I don't know if there is a way to trigger the "Save as" dialog from Javascript?
Maybe with the Download API
For anyone interested, we ended up using the userFetch attribute that you can set on a Swagger request (using a requestInterceptor). See https://github.com/swagger-api/swagger-js/blob/master/docs/usage/http-client.md#custom-fetch.
With this custom fetch method, we used StreamSaver.js library.
Quite elegant and working fine although we would have loved some kind of native support.
Most helpful comment
For anyone interested, we ended up using the
userFetchattribute that you can set on a Swagger request (using arequestInterceptor). See https://github.com/swagger-api/swagger-js/blob/master/docs/usage/http-client.md#custom-fetch.With this custom fetch method, we used StreamSaver.js library.
Quite elegant and working fine although we would have loved some kind of native support.