cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
403 stars 134 forks source link

Blob response should not be typed like a json #331

Closed Xample closed 2 days ago

Xample commented 1 month ago

Hello, unlike json request which should be typed properly, the "blob" responseType should have a "Blob" resultType.

the resultType must be "Blob" (PascalCase) if the responseType is a "blob" (lowercase).

I can imagine this possible 2 lines fix:

  this.responseType = this.inferResponseType(successResponse, operation, options);
  this.resultType = this.responseType === "blob" ? "Blob" : successResponse.type;
luisfpg commented 2 days ago

Can you share the openapi definition?

Xample commented 2 days ago

Hello, I will take a look tomorrow. The Mime type of the content was probably application/* or application/octet-stream.

Xample commented 2 days ago

Ok it was « application/json » but I realized I was missing the « format : binary » in the schema part. Using format : binary generates a proper blob object type.