[typescript-angular] Support blob response types#11085
[typescript-angular] Support blob response types#11085macjohnny merged 8 commits intoOpenAPITools:masterfrom oaklandcorp:fix_issue11021
Conversation
…ders that don't match text or json.
amakhrov
left a comment
There was a problem hiding this comment.
Thanks for your PR!
The fix looks good, as it fixes the runtime behavior.
It looks like the type signature of the api service method remains incorrect in this case - in your example it stays Observable<string> instead of Observable<Blob>
I realize that a proper fix for the typings can be more involved (just look at those gazillions overloads in Angular's own HttpClient#request). So we can probably address it later - unless you feel like doing it and have a good approach for that in mind. Any thoughts?
modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache
Outdated
Show resolved
Hide resolved
Yes, I noticed that as well when throwing together this quick fix. I decided to keep things minimal so things would be easier to review. Also I believe that same issue plagues the support of a text response type as well, so I went into this thinking the fix wasn't introducing that as a new problem. I would love to have a solution that had an accurate TypeScript interface, but I don't think I'm familiar enough with the project yet to envision how I would make it happen. So I'd lean towards incremental improvement unless someone more experienced has a proposed solution they could walk me through. |
oaklandcorp-jkaiser
left a comment
There was a problem hiding this comment.
I believe I've addressed all PR feedback so far. If there are any other changes you all would suggest please let me know and I'll try to address them as well!
|
@macjohnny, does this need a milestone? |
|
@djnalluri it will automatically be part of the next release. Added milestone 5.4.0 for reference |
Fixes #11021
Generated service methods will try to decide its response type by pattern matching the accept header for text, then json, otherwise defaults to a blob.
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.For Windows users, please run the script in Git BASH.
master(5.3.0),6.0.xTechnical Committee:
@TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02)