OpenAPITools / OpenAPITools/openapi-generator
Jaxrs-cxf generator generated code is not supporting different success codes
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
When we have defined 201 status code for POST success response. The interface is generated with return type mentioned in the response but always sends 200 status code instead of 201.
openapi-generator version
org.openapitools:openapi-generator-maven-plugin:3.3.1
OpenAPI declaration file content or url
post:
summary: Create a pet
operationId: createPets
tags:
- pets
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: #/components/schemas/responseWithId
Generated interface looks like below:
public ResponseWithId createPets(Pet pet) {
....
}
Command line used for generation
N/A
Steps to reproduce
Configure the plugin and language as below and run mvn clean install command.
org.openapitools:openapi-generator-maven-plugin:3.3.1
<language>jaxrs-cxf</language>
Related issues/PRs
N/A
Suggest a fix/enhancement
If it can use jaxrs.ws.Response as the return type instead of the Pojo, it will be good enough for usage.
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
Reproduce the issue with the openapi-generator Maven plugin using the jaxrs-cxf language and the provided POST response declaration, then inspect the generated interface. Done means a declared 201 success response is represented in generated behavior rather than always returning HTTP 200, while preserving the response payload type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100