OpenAPITools / OpenAPITools/openapi-generator
[BUG][JAVA] Issue generating proper response type for file
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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
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.
Research direction
Start by reproducing the issue with the supplied OpenAPI 3.0 response schema using the openapi-generator Gradle plugin version 5.2.1 and the Java generator. Trace how an application/octet-stream binary response is mapped, then verify that generation produces ResponseEntity rather than ResponseEntity.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100