[BUG][JAVA] Issue generating proper response type for file
Description
I am using openapi-generator gradle plugin with version "5.2.1" to generate api from openApi spec 3.0. In one of the endpoint I have to return file as a response (.xls file), I have given the response content-type in openApi spec as shown below:-
/files/template:
get:
operationId: abc
summary: Returns file in .xls format
tags:
- abc
responses:
200:
description: The Contracted Rates Template file
content:
application/octet-stream:
schema:
type: string
format: binary
And I want the response type as ResponseEntity<Resource> but instead openApi generator generates ResponseEntity<MultipartFile> Please help!
openapi-generator version
openapi-generator version -> 5.2.1
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix
@nikhil-ojha-by could you please specify which .generator & library do you use? You can even post a part of yours build.gradle which configure openapi generator plugin
This is a pretty old thread but I am having the same issue. I am using the spring kotlin generator with gradle plugin version 7.2.0. I am using the following yaml snippet:
content:
application/octet-stream:
schema:
type: string
format: binary
but the generated code is always: fun getFileDownload(fileName: kotlin.String): ResponseEntity<Unit> {
I think the response should be either a BytArray or InputStreamResource or something more usable, but I may just be doing it wrong. Any help would be greatly appreciated.
Is there any advise on this? Is this a stale issue?