OpenAPITools / OpenAPITools/openapi-generator

[jaxrs-spec][quarkus] Add an option to use "org.jboss.resteasy.reactive.RestResponse"

Open
#21,424 4 comments 14 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

I'm using jaxrs-spec generator with library=quarkus which is the best generator I have found for Quarkus (compared to jaxrs-resteasy and https://github.com/quarkiverse/quarkus-openapi-generator). However, I can't find the proper way to generate Api methods to specify a status code.
When I use the option returnResponse=true, it generates this kind of method signature (the implementation should return code 201 for CREATED:

@POST
@Produces({ "application/json" })
Response create();

Unfortunatly jakarta.ws.rs.core.Response is not generic, and allows returning any type, which prevents an API-first approach.

Without this option, we are not able to specify the CREATED status code.

It would be great to generate the return type org.jboss.resteasy.reactive.RestResponse instead, as documented here, either by modifying the actual behavior, or with a new option useJbossResponse).

This feature is somehow related to https://github.com/OpenAPITools/openapi-generator/issues/21360, but the approach is more generic.

I can help with a PR ;-)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the jaxrs-spec generator's quarkus library implementation and trace how the returnResponse=true option determines generated method signatures. Compare the generated Response signature with Quarkus's documented RestResponse usage; done means the generator can produce a typed RestResponse for status-code-aware methods, either through the existing option or a new option such as useJbossResponse.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.