Skip to content

Commit c258cbc

Browse files
Ignacio-Vidalclaude
andcommitted
fix(jaxrs-spec/quarkus): gate @ResponseStatus on useJakartaEe to fix CI
The resteasy-reactive dep in quarkus-universe-bom 1.13.7.Final resolves to a version that does not include ResponseStatus, causing compilation failures in jaxrs-spec-microprofile-openapi-annotations. Gate the annotation and its pom dependency on useJakartaEe (Quarkus 3+), where the BOM properly manages the dep and RESTEasy Reactive is the default stack. Update tests to set useJakartaEe=true where @ResponseStatus is expected, and regenerate affected samples. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ccaad06 commit c258cbc

14 files changed

Lines changed: 61 additions & 65 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ public ModelsMap postProcessModels(ModelsMap objs) {
343343
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels) {
344344
objs = super.postProcessOperationsWithModels(objs, allModels);
345345
removeImport(objs, "java.util.List");
346-
if (QUARKUS_LIBRARY.equals(library) && !returnResponse && !returnJbossResponse) {
346+
if (QUARKUS_LIBRARY.equals(library) && !returnResponse && !returnJbossResponse && useJakartaEe) {
347347
for (CodegenOperation op : objs.getOperations().getOperation()) {
348348
op.responses.stream()
349349
.filter(r -> r.is2xx && r.code.matches("\\d+"))

modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecServerCodegenTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,6 +1359,7 @@ public void generateQuarkusInterfaceAddsResponseStatusAnnotationForSuccessCode()
13591359
codegen.setOutputDir(output.getAbsolutePath());
13601360
codegen.setLibrary(QUARKUS_LIBRARY); //Given the quarkus library is used
13611361
codegen.additionalProperties().put(INTERFACE_ONLY, true); //And only interfaces are generated
1362+
codegen.additionalProperties().put(USE_JAKARTA_EE, true); //Required: @ResponseStatus is only emitted for Jakarta EE (Quarkus 3+)
13621363
// returnResponse and returnJBossResponse are both false (defaults)
13631364

13641365
final ClientOptInput input = new ClientOptInput()
@@ -1392,6 +1393,7 @@ public void generateQuarkusInterfaceAddsResponseStatusAnnotationFor200Response()
13921393
codegen.setOutputDir(output.getAbsolutePath());
13931394
codegen.setLibrary(QUARKUS_LIBRARY);
13941395
codegen.additionalProperties().put(INTERFACE_ONLY, true);
1396+
codegen.additionalProperties().put(USE_JAKARTA_EE, true); //Required: @ResponseStatus is only emitted for Jakarta EE (Quarkus 3+)
13951397

13961398
final ClientOptInput input = new ClientOptInput()
13971399
.openAPI(openAPI)
@@ -1425,6 +1427,7 @@ public void generateQuarkusInterfaceDoesNotAddResponseStatusAnnotationWhenReturn
14251427
codegen.setOutputDir(output.getAbsolutePath());
14261428
codegen.setLibrary(QUARKUS_LIBRARY);
14271429
codegen.additionalProperties().put(INTERFACE_ONLY, true);
1430+
codegen.additionalProperties().put(USE_JAKARTA_EE, true); //Enabled so returnResponse is the only disabling factor
14281431
codegen.additionalProperties().put(RETURN_RESPONSE, true); //Given returnResponse is true
14291432

14301433
final ClientOptInput input = new ClientOptInput()
@@ -1523,6 +1526,7 @@ public void generateQuarkusConcreteClassAddsResponseStatusAnnotation() throws Ex
15231526

15241527
codegen.setOutputDir(output.getAbsolutePath());
15251528
codegen.setLibrary(QUARKUS_LIBRARY);
1529+
codegen.additionalProperties().put(USE_JAKARTA_EE, true); //Required: @ResponseStatus is only emitted for Jakarta EE (Quarkus 3+)
15261530
codegen.additionalProperties().put(INTERFACE_ONLY, false); //Given the concrete class is generated
15271531

15281532
final ClientOptInput input = new ClientOptInput()

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@
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>
6157
<dependency>
6258
<groupId>javax.ws.rs</groupId>
6359
<artifactId>javax.ws.rs-api</artifactId>

samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/api/PetApi.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import javax.ws.rs.*;
88
import javax.ws.rs.core.Response;
99

10-
import org.jboss.resteasy.reactive.ResponseStatus;
10+
1111

1212

1313

@@ -68,7 +68,7 @@ public class PetApi {
6868
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
6969
})
7070
})
71-
@ResponseStatus(200)
71+
7272
public Response addPet(@Valid @NotNull Pet pet) {
7373
return Response.ok().entity("magic!").build();
7474
}
@@ -110,7 +110,7 @@ public Response deletePet(@PathParam("petId") @org.eclipse.microprofile.openapi.
110110
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
111111
})
112112
})
113-
@ResponseStatus(200)
113+
114114
public Response findPetsByStatus(@Deprecated @QueryParam("status") @NotNull @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Status values that need to be considered for filter") List<String> status) {
115115
return Response.ok().entity("magic!").build();
116116
}
@@ -135,7 +135,7 @@ public Response findPetsByStatus(@Deprecated @QueryParam("status") @NotNull @or
135135
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
136136
})
137137
})
138-
@ResponseStatus(200)
138+
139139
public Response findPetsByTags(@QueryParam("tags") @NotNull @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Tags to filter by") List<String> tags) {
140140
return Response.ok().entity("magic!").build();
141141
}
@@ -163,7 +163,7 @@ public Response findPetsByTags(@QueryParam("tags") @NotNull @org.eclipse.microp
163163
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
164164
})
165165
})
166-
@ResponseStatus(200)
166+
167167
public Response getPetById(@PathParam("petId") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet to return") Long petId) {
168168
return Response.ok().entity("magic!").build();
169169
}
@@ -195,7 +195,7 @@ public Response getPetById(@PathParam("petId") @org.eclipse.microprofile.openapi
195195
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
196196
})
197197
})
198-
@ResponseStatus(200)
198+
199199
public Response updatePet(@Valid @NotNull Pet pet) {
200200
return Response.ok().entity("magic!").build();
201201
}
@@ -234,7 +234,7 @@ public Response updatePetWithForm(@PathParam("petId") @org.eclipse.microprofile.
234234
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = ModelApiResponse.class))
235235
})
236236
})
237-
@ResponseStatus(200)
237+
238238
public Response uploadFile(@PathParam("petId") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet to update") Long petId,@FormParam(value = "additionalMetadata") String additionalMetadata,@FormParam(value = "file") InputStream _fileInputStream) {
239239
return Response.ok().entity("magic!").build();
240240
}

samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/api/StoreApi.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import javax.ws.rs.*;
77
import javax.ws.rs.core.Response;
88

9-
import org.jboss.resteasy.reactive.ResponseStatus;
9+
1010

1111

1212

@@ -81,7 +81,7 @@ public Response deleteOrder(@PathParam("orderId") @org.eclipse.microprofile.open
8181
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = Map.class))
8282
})
8383
})
84-
@ResponseStatus(200)
84+
8585
public Response getInventory() {
8686
return Response.ok().entity("magic!").build();
8787
}
@@ -107,7 +107,7 @@ public Response getInventory() {
107107
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
108108
})
109109
})
110-
@ResponseStatus(200)
110+
111111
public Response getOrderById(@PathParam("orderId") @Min(1L) @Max(5L) @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet that needs to be fetched") Long orderId) {
112112
return Response.ok().entity("magic!").build();
113113
}
@@ -130,7 +130,7 @@ public Response getOrderById(@PathParam("orderId") @Min(1L) @Max(5L) @org.eclips
130130
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
131131
})
132132
})
133-
@ResponseStatus(200)
133+
134134
public Response placeOrder(@Valid @NotNull Order order) {
135135
return Response.ok().entity("magic!").build();
136136
}

samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/api/UserApi.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import javax.ws.rs.*;
77
import javax.ws.rs.core.Response;
88

9-
import org.jboss.resteasy.reactive.ResponseStatus;
9+
1010

1111

1212

@@ -146,7 +146,7 @@ public Response deleteUser(@PathParam("username") @org.eclipse.microprofile.open
146146
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
147147
})
148148
})
149-
@ResponseStatus(200)
149+
150150
public Response getUserByName(@PathParam("username") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="The name that needs to be fetched. Use user1 for testing.") String username) {
151151
return Response.ok().entity("magic!").build();
152152
}
@@ -172,7 +172,7 @@ public Response getUserByName(@PathParam("username") @org.eclipse.microprofile.o
172172
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json")
173173
})
174174
})
175-
@ResponseStatus(200)
175+
176176
public Response loginUser(@QueryParam("username") @NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="The user name for login") String username,@QueryParam("password") @NotNull @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="The password for login in clear text") String password) {
177177
return Response.ok().entity("magic!").build();
178178
}

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@
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>
6258
<dependency>
6359
<groupId>javax.ws.rs</groupId>
6460
<artifactId>javax.ws.rs-api</artifactId>

samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/AnotherFakeApi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import javax.ws.rs.*;
66
import javax.ws.rs.core.Response;
77

8-
import org.jboss.resteasy.reactive.ResponseStatus;
8+
99

1010

1111

@@ -75,7 +75,7 @@ public class AnotherFakeApi {
7575
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = Client.class))
7676
})
7777
})
78-
@ResponseStatus(200)
78+
7979
public Response call123testSpecialTags(@Valid @NotNull Client client) {
8080
return Response.ok().entity("magic!").build();
8181
}

samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/FakeApi.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import javax.ws.rs.*;
2222
import javax.ws.rs.core.Response;
2323

24-
import org.jboss.resteasy.reactive.ResponseStatus;
24+
2525

2626

2727

@@ -91,7 +91,7 @@ public class FakeApi {
9191
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="*/*", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = FakeBigDecimalMap200Response.class))
9292
})
9393
})
94-
@ResponseStatus(200)
94+
9595
public Response fakeBigDecimalMap() {
9696
return Response.ok().entity("magic!").build();
9797
}
@@ -108,7 +108,7 @@ public Response fakeBigDecimalMap() {
108108
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = HealthCheckResult.class))
109109
})
110110
})
111-
@ResponseStatus(200)
111+
112112
public Response fakeHealthGet() {
113113
return Response.ok().entity("magic!").build();
114114
}
@@ -127,7 +127,7 @@ public Response fakeHealthGet() {
127127

128128
})
129129
})
130-
@ResponseStatus(200)
130+
131131
public Response fakeHttpSignatureTest(@Valid @NotNull Pet pet,@QueryParam("query_1") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="query parameter") String query1,@HeaderParam("header_1") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="header parameter") String header1) {
132132
return Response.ok().entity("magic!").build();
133133
}
@@ -145,7 +145,7 @@ public Response fakeHttpSignatureTest(@Valid @NotNull Pet pet,@QueryParam("query
145145
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="*/*", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = Boolean.class))
146146
})
147147
})
148-
@ResponseStatus(200)
148+
149149
public Response fakeOuterBooleanSerialize(@Valid Boolean body) {
150150
return Response.ok().entity("magic!").build();
151151
}
@@ -163,7 +163,7 @@ public Response fakeOuterBooleanSerialize(@Valid Boolean body) {
163163
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="*/*", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = OuterComposite.class))
164164
})
165165
})
166-
@ResponseStatus(200)
166+
167167
public Response fakeOuterCompositeSerialize(@Valid OuterComposite outerComposite) {
168168
return Response.ok().entity("magic!").build();
169169
}
@@ -181,7 +181,7 @@ public Response fakeOuterCompositeSerialize(@Valid OuterComposite outerComposite
181181
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="*/*", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = BigDecimal.class))
182182
})
183183
})
184-
@ResponseStatus(200)
184+
185185
public Response fakeOuterNumberSerialize(@Valid BigDecimal body) {
186186
return Response.ok().entity("magic!").build();
187187
}
@@ -199,7 +199,7 @@ public Response fakeOuterNumberSerialize(@Valid BigDecimal body) {
199199
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="*/*", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = String.class))
200200
})
201201
})
202-
@ResponseStatus(200)
202+
203203
public Response fakeOuterStringSerialize(@Valid String body) {
204204
return Response.ok().entity("magic!").build();
205205
}
@@ -217,7 +217,7 @@ public Response fakeOuterStringSerialize(@Valid String body) {
217217
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="*/*", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = OuterObjectWithEnumProperty.class))
218218
})
219219
})
220-
@ResponseStatus(200)
220+
221221
public Response fakePropertyEnumIntegerSerialize(@Valid @NotNull OuterObjectWithEnumProperty outerObjectWithEnumProperty) {
222222
return Response.ok().entity("magic!").build();
223223
}
@@ -234,7 +234,7 @@ public Response fakePropertyEnumIntegerSerialize(@Valid @NotNull OuterObjectWith
234234

235235
})
236236
})
237-
@ResponseStatus(200)
237+
238238
public Response testAdditionalPropertiesReference(@Valid @NotNull Map<String, Object> requestBody) {
239239
return Response.ok().entity("magic!").build();
240240
}
@@ -251,7 +251,7 @@ public Response testAdditionalPropertiesReference(@Valid @NotNull Map<String, Ob
251251

252252
})
253253
})
254-
@ResponseStatus(200)
254+
255255
public Response testBodyWithBinary(@Valid File body) {
256256
return Response.ok().entity("magic!").build();
257257
}
@@ -268,7 +268,7 @@ public Response testBodyWithBinary(@Valid File body) {
268268

269269
})
270270
})
271-
@ResponseStatus(200)
271+
272272
public Response testBodyWithFileSchema(@Valid @NotNull FileSchemaTestClass fileSchemaTestClass) {
273273
return Response.ok().entity("magic!").build();
274274
}
@@ -285,7 +285,7 @@ public Response testBodyWithFileSchema(@Valid @NotNull FileSchemaTestClass fileS
285285

286286
})
287287
})
288-
@ResponseStatus(200)
288+
289289
public Response testBodyWithQueryParams(@QueryParam("query") @NotNull String query,@Valid @NotNull User user) {
290290
return Response.ok().entity("magic!").build();
291291
}
@@ -302,7 +302,7 @@ public Response testBodyWithQueryParams(@QueryParam("query") @NotNull String q
302302
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = Client.class))
303303
})
304304
})
305-
@ResponseStatus(200)
305+
306306
public Response testClientModel(@Valid @NotNull Client client) {
307307
return Response.ok().entity("magic!").build();
308308
}
@@ -376,7 +376,7 @@ public Response testGroupParameters(@QueryParam("required_string_group") @NotNul
376376

377377
})
378378
})
379-
@ResponseStatus(200)
379+
380380
public Response testInlineAdditionalProperties(@Valid @NotNull Map<String, String> requestBody) {
381381
return Response.ok().entity("magic!").build();
382382
}
@@ -393,7 +393,7 @@ public Response testInlineAdditionalProperties(@Valid @NotNull Map<String, Strin
393393

394394
})
395395
})
396-
@ResponseStatus(200)
396+
397397
public Response testInlineFreeformAdditionalProperties(@Valid @NotNull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) {
398398
return Response.ok().entity("magic!").build();
399399
}
@@ -410,7 +410,7 @@ public Response testInlineFreeformAdditionalProperties(@Valid @NotNull TestInlin
410410

411411
})
412412
})
413-
@ResponseStatus(200)
413+
414414
public Response testJsonFormData(@FormParam(value = "param") String param,@FormParam(value = "param2") String param2) {
415415
return Response.ok().entity("magic!").build();
416416
}
@@ -427,7 +427,7 @@ public Response testJsonFormData(@FormParam(value = "param") String param,@Form
427427

428428
})
429429
})
430-
@ResponseStatus(200)
430+
431431
public Response testNullable(@Valid @NotNull ChildWithNullable childWithNullable) {
432432
return Response.ok().entity("magic!").build();
433433
}
@@ -443,7 +443,7 @@ public Response testNullable(@Valid @NotNull ChildWithNullable childWithNullable
443443

444444
})
445445
})
446-
@ResponseStatus(200)
446+
447447
public Response testQueryParameterCollectionFormat(@QueryParam("pipe") @NotNull List<String> pipe,@QueryParam("ioutil") @NotNull List<String> ioutil,@QueryParam("http") @NotNull List<String> http,@QueryParam("url") @NotNull List<String> url,@QueryParam("context") @NotNull List<String> context,@QueryParam("allowEmpty") @NotNull String allowEmpty,@QueryParam("language") Map<String, String> language) {
448448
return Response.ok().entity("magic!").build();
449449
}
@@ -460,7 +460,7 @@ public Response testQueryParameterCollectionFormat(@QueryParam("pipe") @NotNull
460460

461461
})
462462
})
463-
@ResponseStatus(200)
463+
464464
public Response testStringMapReference(@Valid @NotNull Map<String, String> requestBody) {
465465
return Response.ok().entity("magic!").build();
466466
}
@@ -480,7 +480,7 @@ public Response testStringMapReference(@Valid @NotNull Map<String, String> reque
480480
@org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = ModelApiResponse.class))
481481
})
482482
})
483-
@ResponseStatus(200)
483+
484484
public Response uploadFileWithRequiredFile(@PathParam("petId") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet to update") Long petId,@FormParam(value = "requiredFile") InputStream requiredFileInputStream,@FormParam(value = "additionalMetadata") String additionalMetadata) {
485485
return Response.ok().entity("magic!").build();
486486
}

0 commit comments

Comments
 (0)