Skip to content

Commit ccaad06

Browse files
committed
fix(jaxrs-spec/quarkus): add resteasy-reactive dep for ResponseStatus annotation
The @ResponseStatus annotation lives in org.jboss.resteasy.reactive, which is not provided by quarkus-resteasy (classic). Add resteasy-reactive to pom.mustache when hasResponseStatusAnnotations is set, and update both Quarkus sample poms accordingly. Also ensure objs.put("hasResponseStatusAnnotations", ...) is always set explicitly (true or false) so Mustache does not fall through to the global additionalProperties value for API files with no annotated operations.
1 parent 9ed1d01 commit ccaad06

4 files changed

Lines changed: 22 additions & 3 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,14 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
350350
.findFirst()
351351
.ifPresent(r -> op.vendorExtensions.put("x-java-success-response-code", r.code));
352352
}
353-
if (objs.getOperations().getOperation().stream()
354-
.anyMatch(op -> op.vendorExtensions.containsKey("x-java-success-response-code"))) {
355-
objs.put("hasResponseStatusAnnotations", true);
353+
boolean hasAnnotations = objs.getOperations().getOperation().stream()
354+
.anyMatch(op -> op.vendorExtensions.containsKey("x-java-success-response-code"));
355+
// Always set explicitly so Mustache does not fall through to the global additionalProperties
356+
// value when this file has no annotated operations.
357+
objs.put("hasResponseStatusAnnotations", hasAnnotations);
358+
if (hasAnnotations) {
359+
// Global flag used by pom.mustache, which is rendered once per project.
360+
additionalProperties.put("hasResponseStatusAnnotations", true);
356361
}
357362
}
358363
return objs;

modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@
8484
<groupId>io.quarkus</groupId>
8585
<artifactId>quarkus-smallrye-openapi</artifactId>
8686
</dependency>
87+
{{#hasResponseStatusAnnotations}}
88+
<dependency>
89+
<groupId>io.quarkus.resteasy.reactive</groupId>
90+
<artifactId>resteasy-reactive</artifactId>
91+
</dependency>
92+
{{/hasResponseStatusAnnotations}}
8793
{{#useJakartaEe}}
8894
{{#returnJBossResponse}}
8995
<dependency>

samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
<groupId>io.quarkus</groupId>
5555
<artifactId>quarkus-smallrye-openapi</artifactId>
5656
</dependency>
57+
<dependency>
58+
<groupId>io.quarkus.resteasy.reactive</groupId>
59+
<artifactId>resteasy-reactive</artifactId>
60+
</dependency>
5761
<dependency>
5862
<groupId>javax.ws.rs</groupId>
5963
<artifactId>javax.ws.rs-api</artifactId>

samples/server/petstore/jaxrs-spec-quarkus-mutiny/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555
<groupId>io.quarkus</groupId>
5656
<artifactId>quarkus-smallrye-openapi</artifactId>
5757
</dependency>
58+
<dependency>
59+
<groupId>io.quarkus.resteasy.reactive</groupId>
60+
<artifactId>resteasy-reactive</artifactId>
61+
</dependency>
5862
<dependency>
5963
<groupId>javax.ws.rs</groupId>
6064
<artifactId>javax.ws.rs-api</artifactId>

0 commit comments

Comments
 (0)