nestia icon indicating copy to clipboard operation
nestia copied to clipboard

[Suggestion] Support API responses in file stream format.

Open rojiwon123 opened this issue 1 year ago • 1 comments

Description

There are cases where API responses come in file (stream) format. Regardless of the NestJS Controller handler's return type, I want to change the response content type in Swagger or SDK documentation by recognizing the Header information. In the NestJS official documentation, they guide both methods: directly connecting to the express or fastify response object using express(or fastify) res.pipe, and using the StreamableFile class as the handler return.

Can you please review support for some response content types (e.g. image/ ~ , video/ ~)?

@nestia/sdk v4.6.1

Image

Image

Suggestion

  • nest.Header("Content-Type", "image/*")
  • If the content-type is specified with a specific prefix (e.g., image, video), expect the API response to be in stream format, regardless of the controller handler's return type. Image
  • Swagger Example Image
  • Specify the sdk response body type as ReadableStream<Uint8Array<ArrayBufferLike>>.

rojiwon123 avatar Jan 31 '25 05:01 rojiwon123

current workaround would be to use SwaggerCustomizer decorator

shahriar-shojib avatar Jul 10 '25 09:07 shahriar-shojib