Created by: spallister
PR checklist
-
Read the contribution guidelines. -
Ran the shell script under ./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
. -
Filed the PR against the correct branch: master
,3.4.x
,4.0.x
. Default:master
. -
Copied the technical committee to review the pull request if your PR is targeting a particular programming language. @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @nicokoenig (2018/09) @topce (2018/10)
Description of the PR
This is a copy of a similar PR I submitted to the swagger-codgen repo here. A while back, @wing328 reached out to let me know the majority of the community moved over here, where I might want to consider re-submitting my PR.
The purpose of this PR is to return application/octet-stream
response types as File
s, instead of processing them as JSON. In the PR I had submitted to the swagger-codegen repo, I was returning such response types as Blob
s, but soon after had a need to obtain the file's name (i.e. which File
supports, but Blob
does not).
Note that this PR includes a change for DefaultGenerator.java
, as I needed to add a property to the mustache template model to determine whether the API contained at least one 'File Response'-type Operation. In particular, this was needed so that I could conditionally include a responseToFile
helper method within api.mustache
as necessary (i.e. our TS linter would otherwise throw an unused method warning for applications where no 'File Response'-type Operations were in use).
It looks like there is a TypeScript-fetch rewrite taking place over at #569, but figured I'd submit this in case it can be merged in the interim, or incorporated into that rewrite.
Fixes #531