swagger-api / swagger-api/swagger-codegen
[Typescript-angular] responseType not set on Blob type responses
@HugoMario is already working on this.
Since May 8, 2020.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
If response is a blob (in schema defined with type string, format binary), the generated service fails to consume renspose (it tries to parse binary repsonse as blob):
return this.httpClient.get<Blob>(`${this.basePath}/api/Image/DesignPreview`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
Swagger-codegen version
We are transitioning to aspnetcore3, with that we need to transition to swagger-codegen-cli-3.0.13
This issue did not exist in cli-2.4.1-SNAPSHOT with schema v2
Swagger declaration file content or url
Relevant schema part:
"responses": {
"200": {
"description": "Success",
"content": {
"image/png": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
Command line used for generation
java -jar swagger/swagger-codegen-cli-3.0.13.jar generate -i https://localhost:5001/swagger/0.1-Dev/swagger.json -l typescript-angular -c swagger/config.json -o src/app/api -D io.swagger.parser.util.RemoteUrl.trustAll=true -D io.swagger.v3.parser.util.RemoteUrl.trustAll=true
config.json:
{
"ngVersion":"8"
}
Related issues/PRs
Very similar issue to #8399
Suggest a fix/enhancement
responseType: 'blob' and non generic httpClient.get should be used
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.