diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java index 0f1f20634537..b67ea15c72c4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java @@ -343,6 +343,19 @@ public ModelsMap postProcessModels(ModelsMap objs) { public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); removeImport(objs, "java.util.List"); + if (QUARKUS_LIBRARY.equals(library) && !returnResponse && !returnJbossResponse) { + for (CodegenOperation op : objs.getOperations().getOperation()) { + op.responses.stream() + .filter(r -> r.is2xx || r.is3xx) + .findFirst() + .ifPresent(r -> op.vendorExtensions.put("x-java-success-response-code", r.code)); + } + if (objs.getOperations().getOperation().stream() + .anyMatch(op -> op.vendorExtensions.containsKey("x-java-success-response-code"))) { + objs.put("hasResponseStatusAnnotations", true); + additionalProperties.put("hasResponseStatusAnnotations", true); + } + } return objs; } diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/api.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/api.mustache index c1c7eb97682b..16f94796bd35 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/api.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/api.mustache @@ -6,6 +6,7 @@ package {{package}}; import {{javaxPackage}}.ws.rs.*; import {{javaxPackage}}.ws.rs.core.Response; {{#returnJBossResponse}}import org.jboss.resteasy.reactive.RestResponse;{{/returnJBossResponse}} +{{#hasResponseStatusAnnotations}}import org.jboss.resteasy.reactive.ResponseStatus;{{/hasResponseStatusAnnotations}} {{#useGzipFeature}} import org.jboss.resteasy.annotations.GZIP; @@ -116,4 +117,4 @@ public {{#interfaceOnly}}interface{{/interfaceOnly}}{{^interfaceOnly}}class{{/in {{#interfaceOnly}}{{>apiInterface}}{{/interfaceOnly}}{{^interfaceOnly}}{{>apiMethod}}{{/interfaceOnly}} {{/operation}} } -{{/operations}} \ No newline at end of file +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiInterface.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiInterface.mustache index 730d8141a18c..373d0ef14d71 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiInterface.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiInterface.mustache @@ -44,4 +44,5 @@ {{^vendorExtensions.x-java-is-response-void}}@org.eclipse.microprofile.openapi.annotations.media.Content(schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = {{{baseType}}}.class{{#vendorExtensions.x-microprofile-open-api-return-schema-container}}, type = {{{.}}} {{/vendorExtensions.x-microprofile-open-api-return-schema-container}}{{#vendorExtensions.x-microprofile-open-api-return-unique-items}}, uniqueItems = true {{/vendorExtensions.x-microprofile-open-api-return-unique-items}})){{/vendorExtensions.x-java-is-response-void}} }){{^-last}},{{/-last}}{{/responses}} }){{/hasProduces}}{{/useMicroProfileOpenAPIAnnotations}} - {{#supportAsync}}{{>returnAsyncTypeInterface}}{{/supportAsync}}{{^supportAsync}}{{#returnJBossResponse}}{{>returnResponseTypeInterface}}{{/returnJBossResponse}}{{^returnJBossResponse}}{{#returnResponse}}Response{{/returnResponse}}{{^returnResponse}}{{>returnTypeInterface}}{{/returnResponse}}{{/returnJBossResponse}}{{/supportAsync}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>cookieParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}); \ No newline at end of file + {{#vendorExtensions.x-java-success-response-code}}@ResponseStatus({{{vendorExtensions.x-java-success-response-code}}}) + {{/vendorExtensions.x-java-success-response-code}}{{#supportAsync}}{{>returnAsyncTypeInterface}}{{/supportAsync}}{{^supportAsync}}{{#returnJBossResponse}}{{>returnResponseTypeInterface}}{{/returnJBossResponse}}{{^returnJBossResponse}}{{#returnResponse}}Response{{/returnResponse}}{{^returnResponse}}{{>returnTypeInterface}}{{/returnResponse}}{{/returnJBossResponse}}{{/supportAsync}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>cookieParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}); diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiMethod.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiMethod.mustache index 40790c7fab92..50b89b8c91a4 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiMethod.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiMethod.mustache @@ -44,6 +44,7 @@ {{^vendorExtensions.x-java-is-response-void}}@org.eclipse.microprofile.openapi.annotations.media.Content(schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = {{{baseType}}}.class{{#vendorExtensions.x-microprofile-open-api-return-schema-container}}, type = {{{.}}} {{/vendorExtensions.x-microprofile-open-api-return-schema-container}}{{#vendorExtensions.x-microprofile-open-api-return-unique-items}}, uniqueItems = true {{/vendorExtensions.x-microprofile-open-api-return-unique-items}})){{/vendorExtensions.x-java-is-response-void}} }){{^-last}},{{/-last}}{{/responses}} }){{/hasProduces}}{{/useMicroProfileOpenAPIAnnotations}} - public {{#supportAsync}}{{#useMutiny}}Uni{{/useMutiny}}{{^useMutiny}}CompletionStage{{/useMutiny}}<{{/supportAsync}}{{#returnJBossResponse}}{{>returnResponseTypeInterface}}{{/returnJBossResponse}}{{^returnJBossResponse}}Response{{/returnJBossResponse}}{{#supportAsync}}>{{/supportAsync}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>cookieParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}) { + {{#vendorExtensions.x-java-success-response-code}}@ResponseStatus({{{vendorExtensions.x-java-success-response-code}}}) + {{/vendorExtensions.x-java-success-response-code}}public {{#supportAsync}}{{#useMutiny}}Uni{{/useMutiny}}{{^useMutiny}}CompletionStage{{/useMutiny}}<{{/supportAsync}}{{#returnJBossResponse}}{{>returnResponseTypeInterface}}{{/returnJBossResponse}}{{^returnJBossResponse}}Response{{/returnJBossResponse}}{{#supportAsync}}>{{/supportAsync}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>cookieParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}) { return {{#supportAsync}}{{#useMutiny}}Uni.createFrom().item({{/useMutiny}}{{^useMutiny}}CompletableFuture.supplyAsync(() -> {{/useMutiny}}{{/supportAsync}}Response.ok().entity("magic!").build(){{#supportAsync}}){{/supportAsync}}; - } \ No newline at end of file + } diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache index 1250219c970b..c31c9768b4b7 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache @@ -90,6 +90,14 @@ io.quarkus.resteasy.reactive resteasy-reactive +{{/returnJBossResponse}} +{{^returnJBossResponse}} +{{#hasResponseStatusAnnotations}} + + io.quarkus.resteasy.reactive + resteasy-reactive + +{{/hasResponseStatusAnnotations}} {{/returnJBossResponse}} jakarta.ws.rs @@ -104,6 +112,20 @@ {{/useJakartaEe}} {{^useJakartaEe}} +{{#returnJBossResponse}} + + io.quarkus.resteasy.reactive + resteasy-reactive + +{{/returnJBossResponse}} +{{^returnJBossResponse}} +{{#hasResponseStatusAnnotations}} + + io.quarkus.resteasy.reactive + resteasy-reactive + +{{/hasResponseStatusAnnotations}} +{{/returnJBossResponse}} javax.ws.rs javax.ws.rs-api diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecServerCodegenTest.java index 246366ec84ea..0355fc1a6b43 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecServerCodegenTest.java @@ -1236,7 +1236,7 @@ public void disableGenerateJsonCreator() throws Exception { assertFileNotContains(files.get("RequiredProperties.java").toPath(), "@JsonCreator"); } - + @Test public void testDiscriminatorMappingUsedInJsonTypeName() throws Exception { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); @@ -1273,38 +1273,170 @@ public void testDiscriminatorMappingUsedInJsonTypeName() throws Exception { public void testGenerateJsonNullableListFieldsHelperMethodReferences_issue23251() throws Exception { Map properties = new HashMap<>(); properties.put(OPENAPI_NULLABLE, "true"); - + File output = Files.createTempDirectory("test").toFile(); - + final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("jaxrs-spec") .setAdditionalProperties(properties) .setInputSpec("src/test/resources/bugs/issue_23251.yaml") .setOutputDir(output.getAbsolutePath().replace("\\", "/")); - + final ClientOptInput clientOptInput = configurator.toClientOptInput(); DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(clientOptInput).generate(); - + validateJavaSourceFiles(files); - + TestUtils.ensureContainsFile(files, output, "src/gen/java/org/openapitools/model/BugResponse.java"); - + // Assert that the generated model contains JsonNullable fields assertFileContains(output.toPath().resolve("src/gen/java/org/openapitools/model/BugResponse.java"), "private JsonNullable nullableField = JsonNullable.undefined();", "private JsonNullable> nullableList = JsonNullable.>undefined();", "private JsonNullable> nullableObjectList = JsonNullable.>undefined();" ); - + // Assert that the generated model contains correct add and remove helper methods reference for JsonNullable fields assertFileContains(output.toPath().resolve("src/gen/java/org/openapitools/model/BugResponse.java"), "this.nullableList.get().add(nullableListItem);", "this.nullableList.get().remove(nullableListItem);", "this.nullableObjectList.get().add(nullableObjectListItem);", "this.nullableObjectList.get().remove(nullableObjectListItem);"); - + + output.deleteOnExit(); + } + + /** + * Verify that when using the quarkus library with interfaceOnly=true, the generated interface + * method is always annotated with {@code @ResponseStatus()} for any 2xx or 3xx response, + * including 200, for explicit documentation purposes. + * ping.yaml has a 201 response. + */ + @Test + public void generateQuarkusInterfaceAddsResponseStatusAnnotationForSuccessCode() throws Exception { + final File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + + final OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_0/ping.yaml", null, new ParseOptions()).getOpenAPI(); + + codegen.setOutputDir(output.getAbsolutePath()); + codegen.setLibrary(QUARKUS_LIBRARY); //Given the quarkus library is used + codegen.additionalProperties().put(INTERFACE_ONLY, true); //And only interfaces are generated + // returnResponse and returnJBossResponse are both false (defaults) + + final ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); + + final DefaultGenerator generator = new DefaultGenerator(); + final List files = generator.opts(input).generate(); + + validateJavaSourceFiles(files); + + //Then the generated interface contains the ResponseStatus import and annotation with code 201 + TestUtils.ensureContainsFile(files, output, "src/gen/java/org/openapitools/api/PingApi.java"); + assertFileContains(output.toPath().resolve("src/gen/java/org/openapitools/api/PingApi.java"), + "import org.jboss.resteasy.reactive.ResponseStatus;", + "@ResponseStatus(201)"); + } + + /** + * Verify that {@code @ResponseStatus(200)} IS emitted even for the default 200 status code, + * for explicit documentation purposes. + */ + @Test + public void generateQuarkusInterfaceAddsResponseStatusAnnotationFor200Response() throws Exception { + final File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + + final OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_0/petstore.yaml", null, new ParseOptions()).getOpenAPI(); + + codegen.setOutputDir(output.getAbsolutePath()); + codegen.setLibrary(QUARKUS_LIBRARY); + codegen.additionalProperties().put(INTERFACE_ONLY, true); + + final ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); + + final DefaultGenerator generator = new DefaultGenerator(); + final List files = generator.opts(input).generate(); + + validateJavaSourceFiles(files); + + //Then @ResponseStatus(200) IS present for explicit documentation + TestUtils.ensureContainsFile(files, output, "src/gen/java/org/openapitools/api/PetApi.java"); + assertFileContains(output.toPath().resolve("src/gen/java/org/openapitools/api/PetApi.java"), + "import org.jboss.resteasy.reactive.ResponseStatus;", + "@ResponseStatus(200)"); + } + + /** + * Verify that the {@code @ResponseStatus} annotation is NOT emitted when returnResponse=true, + * because the user controls the status code via the {@code Response} builder in that mode. + */ + @Test + public void generateQuarkusInterfaceDoesNotAddResponseStatusAnnotationWhenReturnResponse() throws Exception { + final File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + + final OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_0/ping.yaml", null, new ParseOptions()).getOpenAPI(); + + codegen.setOutputDir(output.getAbsolutePath()); + codegen.setLibrary(QUARKUS_LIBRARY); + codegen.additionalProperties().put(INTERFACE_ONLY, true); + codegen.additionalProperties().put(RETURN_RESPONSE, true); //Given returnResponse is true + + final ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); + + final DefaultGenerator generator = new DefaultGenerator(); + final List files = generator.opts(input).generate(); + + validateJavaSourceFiles(files); + + //Then the annotation must NOT appear + TestUtils.ensureContainsFile(files, output, "src/gen/java/org/openapitools/api/PingApi.java"); + assertFileNotContains(output.toPath().resolve("src/gen/java/org/openapitools/api/PingApi.java"), + "@ResponseStatus", + "import org.jboss.resteasy.reactive.ResponseStatus"); + } + + /** + * Verify that when using the quarkus library with interfaceOnly=true and a 3xx response, + * the generated interface method is annotated with {@code @ResponseStatus()}. + */ + @Test + public void generateQuarkusInterfaceAddsResponseStatusAnnotationFor3xxResponseCode() throws Exception { + final File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); output.deleteOnExit(); + + final OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_0/jaxrs-spec-quarkus-redirect.yaml", null, new ParseOptions()).getOpenAPI(); + + codegen.setOutputDir(output.getAbsolutePath()); + codegen.setLibrary(QUARKUS_LIBRARY); + codegen.additionalProperties().put(INTERFACE_ONLY, true); + + final ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); + + final DefaultGenerator generator = new DefaultGenerator(); + final List files = generator.opts(input).generate(); + + validateJavaSourceFiles(files); + + //Then the generated interface contains the ResponseStatus import and annotation with code 302 + TestUtils.ensureContainsFile(files, output, "src/gen/java/org/openapitools/api/RedirectApi.java"); + assertFileContains(output.toPath().resolve("src/gen/java/org/openapitools/api/RedirectApi.java"), + "import org.jboss.resteasy.reactive.ResponseStatus;", + "@ResponseStatus(302)"); } } diff --git a/modules/openapi-generator/src/test/resources/3_0/jaxrs-spec-quarkus-redirect.yaml b/modules/openapi-generator/src/test/resources/3_0/jaxrs-spec-quarkus-redirect.yaml new file mode 100644 index 000000000000..af845556d73f --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/jaxrs-spec-quarkus-redirect.yaml @@ -0,0 +1,18 @@ +openapi: 3.0.1 +info: + title: redirect test + version: '1.0' +servers: + - url: 'http://localhost:8000/' +paths: + /redirect: + get: + operationId: redirectGet + responses: + '302': + description: Temporary Redirect + headers: + Location: + schema: + type: string + diff --git a/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/pom.xml b/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/pom.xml index fd737c53e543..6ef099cc3ce0 100644 --- a/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/pom.xml +++ b/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/pom.xml @@ -54,6 +54,10 @@ io.quarkus quarkus-smallrye-openapi + + io.quarkus.resteasy.reactive + resteasy-reactive + javax.ws.rs javax.ws.rs-api diff --git a/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/api/PetApi.java index 6fc697707bcc..02a55921415d 100644 --- a/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/api/PetApi.java @@ -7,6 +7,7 @@ import javax.ws.rs.*; import javax.ws.rs.core.Response; +import org.jboss.resteasy.reactive.ResponseStatus; @@ -68,10 +69,12 @@ public class PetApi { @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) public Response addPet(@Valid @NotNull Pet pet) { return Response.ok().entity("magic!").build(); } + @DELETE @Path("/{petId}") @org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={ @@ -88,6 +91,7 @@ public Response deletePet(@PathParam("petId") @org.eclipse.microprofile.openapi. return Response.ok().entity("magic!").build(); } + @GET @Path("/findByStatus") @Produces({ "application/xml", "application/json" }) @@ -106,10 +110,12 @@ public Response deletePet(@PathParam("petId") @org.eclipse.microprofile.openapi. @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) public Response findPetsByStatus(@QueryParam("status") @NotNull @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Status values that need to be considered for filter") List status) { return Response.ok().entity("magic!").build(); } + @GET @Path("/findByTags") @Produces({ "application/xml", "application/json" }) @@ -128,10 +134,12 @@ public Response findPetsByStatus(@QueryParam("status") @NotNull @org.eclipse.mi @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) public Response findPetsByTags(@QueryParam("tags") @NotNull @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Tags to filter by") List tags) { return Response.ok().entity("magic!").build(); } + @GET @Path("/{petId}") @Produces({ "application/xml", "application/json" }) @@ -154,10 +162,12 @@ public Response findPetsByTags(@QueryParam("tags") @NotNull @org.eclipse.microp @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) public Response getPetById(@PathParam("petId") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet to return") Long petId) { return Response.ok().entity("magic!").build(); } + @PUT @Consumes({ "application/json", "application/xml" }) @Produces({ "application/xml", "application/json" }) @@ -184,10 +194,12 @@ public Response getPetById(@PathParam("petId") @org.eclipse.microprofile.openapi @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) public Response updatePet(@Valid @NotNull Pet pet) { return Response.ok().entity("magic!").build(); } + @POST @Path("/{petId}") @Consumes({ "application/x-www-form-urlencoded" }) @@ -205,6 +217,7 @@ public Response updatePetWithForm(@PathParam("petId") @org.eclipse.microprofile. return Response.ok().entity("magic!").build(); } + @POST @Path("/{petId}/uploadImage") @Consumes({ "multipart/form-data" }) @@ -219,7 +232,9 @@ public Response updatePetWithForm(@PathParam("petId") @org.eclipse.microprofile. @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = ModelApiResponse.class)) }) }) + @ResponseStatus(200) 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) { return Response.ok().entity("magic!").build(); } + } diff --git a/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/api/StoreApi.java index ae74490aded3..ba7423d608c5 100644 --- a/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/api/StoreApi.java @@ -6,6 +6,7 @@ import javax.ws.rs.*; import javax.ws.rs.core.Response; +import org.jboss.resteasy.reactive.ResponseStatus; @@ -66,6 +67,7 @@ public Response deleteOrder(@PathParam("orderId") @org.eclipse.microprofile.open return Response.ok().entity("magic!").build(); } + @GET @Path("/inventory") @Produces({ "application/json" }) @@ -79,10 +81,12 @@ public Response deleteOrder(@PathParam("orderId") @org.eclipse.microprofile.open @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = Map.class)) }) }) + @ResponseStatus(200) public Response getInventory() { return Response.ok().entity("magic!").build(); } + @GET @Path("/order/{orderId}") @Produces({ "application/xml", "application/json" }) @@ -103,10 +107,12 @@ public Response getInventory() { @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) 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) { return Response.ok().entity("magic!").build(); } + @POST @Path("/order") @Consumes({ "application/json" }) @@ -124,7 +130,9 @@ public Response getOrderById(@PathParam("orderId") @Min(1L) @Max(5L) @org.eclips @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) public Response placeOrder(@Valid @NotNull Order order) { return Response.ok().entity("magic!").build(); } + } diff --git a/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/api/UserApi.java index e4fa4662f6dd..4c495174351f 100644 --- a/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-spec-microprofile-openapi-annotations/src/gen/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ import javax.ws.rs.*; import javax.ws.rs.core.Response; +import org.jboss.resteasy.reactive.ResponseStatus; @@ -65,6 +66,7 @@ public Response createUser(@Valid @NotNull User user) { return Response.ok().entity("magic!").build(); } + @POST @Path("/createWithArray") @Consumes({ "application/json" }) @@ -82,6 +84,7 @@ public Response createUsersWithArrayInput(@Valid @NotNull List<@Valid User> user return Response.ok().entity("magic!").build(); } + @POST @Path("/createWithList") @Consumes({ "application/json" }) @@ -99,6 +102,7 @@ public Response createUsersWithListInput(@Valid @NotNull List<@Valid User> user) return Response.ok().entity("magic!").build(); } + @DELETE @Path("/{username}") @org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={ @@ -118,6 +122,7 @@ public Response deleteUser(@PathParam("username") @org.eclipse.microprofile.open return Response.ok().entity("magic!").build(); } + @GET @Path("/{username}") @Produces({ "application/xml", "application/json" }) @@ -138,10 +143,12 @@ public Response deleteUser(@PathParam("username") @org.eclipse.microprofile.open @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) 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) { return Response.ok().entity("magic!").build(); } + @GET @Path("/login") @Produces({ "application/xml", "application/json" }) @@ -162,10 +169,12 @@ public Response getUserByName(@PathParam("username") @org.eclipse.microprofile.o @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) 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) { return Response.ok().entity("magic!").build(); } + @GET @Path("/logout") @org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={ @@ -182,6 +191,7 @@ public Response logoutUser() { return Response.ok().entity("magic!").build(); } + @PUT @Path("/{username}") @Consumes({ "application/json" }) @@ -201,4 +211,5 @@ public Response logoutUser() { public Response updateUser(@PathParam("username") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="name that need to be deleted") String username,@Valid @NotNull User user) { return Response.ok().entity("magic!").build(); } + } diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/pom.xml b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/pom.xml index f1f984931f40..197c62ebf8a5 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/pom.xml +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/pom.xml @@ -55,6 +55,10 @@ io.quarkus quarkus-smallrye-openapi + + io.quarkus.resteasy.reactive + resteasy-reactive + javax.ws.rs javax.ws.rs-api diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/AnotherFakeApi.java index 34c96aecd7d7..0f68b190ed74 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -5,6 +5,7 @@ import javax.ws.rs.*; import javax.ws.rs.core.Response; +import org.jboss.resteasy.reactive.ResponseStatus; @@ -75,7 +76,9 @@ public class AnotherFakeApi { @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = Client.class)) }) }) + @ResponseStatus(200) public Response call123testSpecialTags(@Valid @NotNull Client client) { return Response.ok().entity("magic!").build(); } + } diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/FakeApi.java index 260a3fe7bed9..dc7f64b5f951 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/FakeApi.java @@ -21,6 +21,7 @@ import javax.ws.rs.*; import javax.ws.rs.core.Response; +import org.jboss.resteasy.reactive.ResponseStatus; @@ -91,10 +92,12 @@ public class FakeApi { @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="*/*", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = FakeBigDecimalMap200Response.class)) }) }) + @ResponseStatus(200) public Response fakeBigDecimalMap() { return Response.ok().entity("magic!").build(); } + @GET @Path("/health") @Produces({ "application/json" }) @@ -106,10 +109,12 @@ public Response fakeBigDecimalMap() { @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = HealthCheckResult.class)) }) }) + @ResponseStatus(200) public Response fakeHealthGet() { return Response.ok().entity("magic!").build(); } + @GET @Path("/http-signature-test") @Consumes({ "application/json", "application/xml" }) @@ -123,10 +128,12 @@ public Response fakeHealthGet() { }) }) + @ResponseStatus(200) 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) { return Response.ok().entity("magic!").build(); } + @POST @Path("/outer/boolean") @Consumes({ "application/json" }) @@ -139,10 +146,12 @@ public Response fakeHttpSignatureTest(@Valid @NotNull Pet pet,@QueryParam("query @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="*/*", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = Boolean.class)) }) }) + @ResponseStatus(200) public Response fakeOuterBooleanSerialize(@Valid Boolean body) { return Response.ok().entity("magic!").build(); } + @POST @Path("/outer/composite") @Consumes({ "application/json" }) @@ -155,10 +164,12 @@ public Response fakeOuterBooleanSerialize(@Valid Boolean body) { @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="*/*", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = OuterComposite.class)) }) }) + @ResponseStatus(200) public Response fakeOuterCompositeSerialize(@Valid OuterComposite outerComposite) { return Response.ok().entity("magic!").build(); } + @POST @Path("/outer/number") @Consumes({ "application/json" }) @@ -171,10 +182,12 @@ public Response fakeOuterCompositeSerialize(@Valid OuterComposite outerComposite @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="*/*", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = BigDecimal.class)) }) }) + @ResponseStatus(200) public Response fakeOuterNumberSerialize(@Valid BigDecimal body) { return Response.ok().entity("magic!").build(); } + @POST @Path("/outer/string") @Consumes({ "application/json" }) @@ -187,10 +200,12 @@ public Response fakeOuterNumberSerialize(@Valid BigDecimal body) { @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="*/*", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = String.class)) }) }) + @ResponseStatus(200) public Response fakeOuterStringSerialize(@Valid String body) { return Response.ok().entity("magic!").build(); } + @POST @Path("/property/enum-int") @Consumes({ "application/json" }) @@ -203,10 +218,12 @@ public Response fakeOuterStringSerialize(@Valid String body) { @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="*/*", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = OuterObjectWithEnumProperty.class)) }) }) + @ResponseStatus(200) public Response fakePropertyEnumIntegerSerialize(@Valid @NotNull OuterObjectWithEnumProperty outerObjectWithEnumProperty) { return Response.ok().entity("magic!").build(); } + @POST @Path("/additionalProperties-reference") @Consumes({ "application/json" }) @@ -218,10 +235,12 @@ public Response fakePropertyEnumIntegerSerialize(@Valid @NotNull OuterObjectWith }) }) + @ResponseStatus(200) public Response testAdditionalPropertiesReference(@Valid @NotNull Map requestBody) { return Response.ok().entity("magic!").build(); } + @PUT @Path("/body-with-binary") @Consumes({ "image/png" }) @@ -233,10 +252,12 @@ public Response testAdditionalPropertiesReference(@Valid @NotNull Map requestBody) { return Response.ok().entity("magic!").build(); } + @POST @Path("/inline-freeform-additionalProperties") @Consumes({ "application/json" }) @@ -359,10 +391,12 @@ public Response testInlineAdditionalProperties(@Valid @NotNull Map pipe,@QueryParam("ioutil") @NotNull List ioutil,@QueryParam("http") @NotNull List http,@QueryParam("url") @NotNull List url,@QueryParam("context") @NotNull List context,@QueryParam("allowEmpty") @NotNull String allowEmpty,@QueryParam("language") Map language) { return Response.ok().entity("magic!").build(); } + @POST @Path("/stringMap-reference") @Consumes({ "application/json" }) @@ -418,10 +458,12 @@ public Response testQueryParameterCollectionFormat(@QueryParam("pipe") @NotNull }) }) + @ResponseStatus(200) public Response testStringMapReference(@Valid @NotNull Map requestBody) { return Response.ok().entity("magic!").build(); } + @POST @Path("/{petId}/uploadImageWithRequiredFile") @Consumes({ "multipart/form-data" }) @@ -436,7 +478,9 @@ public Response testStringMapReference(@Valid @NotNull Map reque @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = ModelApiResponse.class)) }) }) + @ResponseStatus(200) 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) { return Response.ok().entity("magic!").build(); } + } diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java index 96d56048417a..77d1952ca32e 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java @@ -5,6 +5,7 @@ import javax.ws.rs.*; import javax.ws.rs.core.Response; +import org.jboss.resteasy.reactive.ResponseStatus; @@ -77,7 +78,9 @@ public class FakeClassnameTestApi { @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = Client.class)) }) }) + @ResponseStatus(200) public Response testClassname(@Valid @NotNull Client client) { return Response.ok().entity("magic!").build(); } + } diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/FooApi.java b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/FooApi.java index 286131c287cb..f77627a4117d 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/FooApi.java +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/FooApi.java @@ -9,6 +9,7 @@ + import java.io.InputStream; import java.util.Map; import java.util.List; @@ -77,4 +78,5 @@ public class FooApi { public Response fooGet() { return Response.ok().entity("magic!").build(); } + } diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/PetApi.java index 3d05bda01d14..cb4510ff4461 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/PetApi.java @@ -8,6 +8,7 @@ import javax.ws.rs.*; import javax.ws.rs.core.Response; +import org.jboss.resteasy.reactive.ResponseStatus; @@ -82,10 +83,12 @@ public class PetApi { }) }) + @ResponseStatus(200) public Response addPet(@Valid @NotNull Pet pet) { return Response.ok().entity("magic!").build(); } + @DELETE @Path("/{petId}") @org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={ @@ -101,10 +104,12 @@ public Response addPet(@Valid @NotNull Pet pet) { }) }) + @ResponseStatus(200) public Response deletePet(@PathParam("petId") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Pet id to delete") Long petId) { return Response.ok().entity("magic!").build(); } + @GET @Path("/findByStatus") @Produces({ "application/xml", "application/json" }) @@ -123,10 +128,12 @@ public Response deletePet(@PathParam("petId") @org.eclipse.microprofile.openapi. @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) public Response findPetsByStatus(@QueryParam("status") @NotNull @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Status values that need to be considered for filter") List status) { return Response.ok().entity("magic!").build(); } + @GET @Path("/findByTags") @Produces({ "application/xml", "application/json" }) @@ -145,10 +152,12 @@ public Response findPetsByStatus(@QueryParam("status") @NotNull @org.eclipse.mi @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) public Response findPetsByTags(@QueryParam("tags") @NotNull @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="Tags to filter by") Set tags) { return Response.ok().entity("magic!").build(); } + @GET @Path("/{petId}") @Produces({ "application/xml", "application/json" }) @@ -171,10 +180,12 @@ public Response findPetsByTags(@QueryParam("tags") @NotNull @org.eclipse.microp @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) public Response getPetById(@PathParam("petId") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet to return") Long petId) { return Response.ok().entity("magic!").build(); } + @PUT @Consumes({ "application/json", "application/xml" }) @org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={ @@ -196,10 +207,12 @@ public Response getPetById(@PathParam("petId") @org.eclipse.microprofile.openapi }) }) + @ResponseStatus(200) public Response updatePet(@Valid @NotNull Pet pet) { return Response.ok().entity("magic!").build(); } + @POST @Path("/{petId}") @Consumes({ "application/x-www-form-urlencoded" }) @@ -216,10 +229,12 @@ public Response updatePet(@Valid @NotNull Pet pet) { }) }) + @ResponseStatus(200) public Response updatePetWithForm(@PathParam("petId") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet that needs to be updated") Long petId,@FormParam(value = "name") String name,@FormParam(value = "status") String status) { return Response.ok().entity("magic!").build(); } + @POST @Path("/{petId}/uploadImage") @Consumes({ "multipart/form-data" }) @@ -234,7 +249,9 @@ public Response updatePetWithForm(@PathParam("petId") @org.eclipse.microprofile. @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = ModelApiResponse.class)) }) }) + @ResponseStatus(200) 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) { return Response.ok().entity("magic!").build(); } + } diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/StoreApi.java index 1bee31fb7d45..81f020a9c058 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/StoreApi.java @@ -6,6 +6,7 @@ import javax.ws.rs.*; import javax.ws.rs.core.Response; +import org.jboss.resteasy.reactive.ResponseStatus; @@ -82,6 +83,7 @@ public Response deleteOrder(@PathParam("order_id") @org.eclipse.microprofile.ope return Response.ok().entity("magic!").build(); } + @GET @Path("/inventory") @Produces({ "application/json" }) @@ -95,10 +97,12 @@ public Response deleteOrder(@PathParam("order_id") @org.eclipse.microprofile.ope @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json", schema = @org.eclipse.microprofile.openapi.annotations.media.Schema(implementation = Map.class)) }) }) + @ResponseStatus(200) public Response getInventory() { return Response.ok().entity("magic!").build(); } + @GET @Path("/order/{order_id}") @Produces({ "application/xml", "application/json" }) @@ -119,10 +123,12 @@ public Response getInventory() { @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) public Response getOrderById(@PathParam("order_id") @Min(1L) @Max(5L) @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="ID of pet that needs to be fetched") Long orderId) { return Response.ok().entity("magic!").build(); } + @POST @Path("/order") @Consumes({ "application/json" }) @@ -140,7 +146,9 @@ public Response getOrderById(@PathParam("order_id") @Min(1L) @Max(5L) @org.eclip @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) public Response placeOrder(@Valid @NotNull Order order) { return Response.ok().entity("magic!").build(); } + } diff --git a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/UserApi.java index 4f1473e2100d..bd49be070377 100644 --- a/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-spec-quarkus-mutiny/src/gen/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ import javax.ws.rs.*; import javax.ws.rs.core.Response; +import org.jboss.resteasy.reactive.ResponseStatus; @@ -79,6 +80,7 @@ public Response createUser(@Valid @NotNull User user) { return Response.ok().entity("magic!").build(); } + @POST @Path("/createWithArray") @Consumes({ "application/json" }) @@ -94,6 +96,7 @@ public Response createUsersWithArrayInput(@Valid @NotNull List<@Valid User> user return Response.ok().entity("magic!").build(); } + @POST @Path("/createWithList") @Consumes({ "application/json" }) @@ -109,6 +112,7 @@ public Response createUsersWithListInput(@Valid @NotNull List<@Valid User> user) return Response.ok().entity("magic!").build(); } + @DELETE @Path("/{username}") @@ -126,6 +130,7 @@ public Response deleteUser(@PathParam("username") @org.eclipse.microprofile.open return Response.ok().entity("magic!").build(); } + @GET @Path("/{username}") @Produces({ "application/xml", "application/json" }) @@ -146,10 +151,12 @@ public Response deleteUser(@PathParam("username") @org.eclipse.microprofile.open @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) 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) { return Response.ok().entity("magic!").build(); } + @GET @Path("/login") @Produces({ "application/xml", "application/json" }) @@ -169,10 +176,12 @@ public Response getUserByName(@PathParam("username") @org.eclipse.microprofile.o @org.eclipse.microprofile.openapi.annotations.media.Content(mediaType="application/json") }) }) + @ResponseStatus(200) public Response loginUser(@QueryParam("username") @NotNull @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) { return Response.ok().entity("magic!").build(); } + @GET @Path("/logout") @@ -187,6 +196,7 @@ public Response logoutUser() { return Response.ok().entity("magic!").build(); } + @PUT @Path("/{username}") @Consumes({ "application/json" }) @@ -204,4 +214,5 @@ public Response logoutUser() { public Response updateUser(@PathParam("username") @org.eclipse.microprofile.openapi.annotations.parameters.Parameter(description="name that need to be deleted") String username,@Valid @NotNull User user) { return Response.ok().entity("magic!").build(); } + }