Skip to content

Commit b7d9bd7

Browse files
committed
Polish
1 parent 92690ea commit b7d9bd7

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

docs/generators/jaxrs-spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
6666
| parentVersion | parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect | |null|
6767
| prependFormOrBodyParameters | Add form or body parameters to the beginning of the parameter list. | |false|
6868
| returnResponse | Whether generate API interface should return `javax.ws.rs.core.Response` instead of a deserialized entity. Only useful if interfaceOnly is true. | |false|
69-
| returnJbossResponse | Whether generate API interface should return `org.jboss.resteasy.reactive.RestResponse` instead of a deserialized entity. Only useful if interfaceOnly is true. This flag has the priority over the `returnResponse` flag | |false|
69+
| returnJBossResponse | Whether generate API interface should return `org.jboss.resteasy.reactive.RestResponse` instead of a deserialized entity. Only useful if interfaceOnly is true. This flag has the priority over the `returnResponse` flag | |false|
7070
| scmConnection | SCM connection in generated pom.xml | |scm:git:git@github.com:openapitools/openapi-generator.git|
7171
| scmDeveloperConnection | SCM developer connection in generated pom.xml | |scm:git:git@github.com:openapitools/openapi-generator.git|
7272
| scmUrl | SCM URL in generated pom.xml | |https://github.com/openapitools/openapi-generator|

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
@@ -130,7 +130,7 @@ public JavaJAXRSSpecServerCodegen() {
130130
cliOptions.add(CliOption.newBoolean(GENERATE_POM, "Whether to generate pom.xml if the file does not already exist.").defaultValue(String.valueOf(generatePom)));
131131
cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files.").defaultValue(String.valueOf(interfaceOnly)));
132132
cliOptions.add(CliOption.newBoolean(RETURN_RESPONSE, "Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true.").defaultValue(String.valueOf(returnResponse)));
133-
cliOptions.add(CliOption.newBoolean(RETURN_JBOSS_RESPONSE, "Whether generate API interface should return `org.jboss.resteasy.reactive.RestResponse` instead of a deserialized entity. Only useful if interfaceOnly is true. This flag has the priority over the 'returnResponse' flag.").defaultValue(String.valueOf(returnJbossResponse)));
133+
cliOptions.add(CliOption.newBoolean(RETURN_JBOSS_RESPONSE, "Whether generate API interface should return org.jboss.resteasy.reactive.RestResponse instead of a deserialized entity. Only useful if interfaceOnly is true. This flag has the priority over the returnResponse flag.").defaultValue(String.valueOf(returnJbossResponse)));
134134
cliOptions.add(CliOption.newBoolean(USE_SWAGGER_ANNOTATIONS, "Whether to generate Swagger annotations.", useSwaggerAnnotations));
135135
cliOptions.add(CliOption.newBoolean(USE_MICROPROFILE_OPENAPI_ANNOTATIONS, "Whether to generate Microprofile OpenAPI annotations. Only valid when library is set to quarkus.", useMicroProfileOpenAPIAnnotations));
136136
cliOptions.add(CliOption.newString(OPEN_API_SPEC_FILE_LOCATION, "Location where the file containing the spec will be generated in the output folder. No file generated when set to null or empty string."));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@
4040
{{^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}}
4141
}){{^-last}},{{/-last}}{{/responses}}
4242
}){{/hasProduces}}{{/useMicroProfileOpenAPIAnnotations}}
43-
public {{#supportAsync}}{{#useMutiny}}Uni{{/useMutiny}}{{^useMutiny}}CompletionStage{{/useMutiny}}<{{/supportAsync}}{{#returnJBossResponse}}{{{returnType}}}{{/returnJBossResponse}}{{^returnJBossResponse}}Response{{/returnJBossResponse}}{{#supportAsync}}>{{/supportAsync}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>cookieParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}) {
43+
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}}) {
4444
return {{#supportAsync}}{{#useMutiny}}Uni.createFrom().item({{/useMutiny}}{{^useMutiny}}CompletableFuture.supplyAsync(() -> {{/useMutiny}}{{/supportAsync}}Response.ok().entity("magic!").build(){{#supportAsync}}){{/supportAsync}};
4545
}

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ public void generateApiWithAsyncSupportAndInterfaceOnlyAndJBossResponse() throws
536536
codegen.setLibrary(QUARKUS_LIBRARY);
537537
codegen.additionalProperties().put(SUPPORT_ASYNC, true); //Given support async is enabled
538538
codegen.additionalProperties().put(INTERFACE_ONLY, true); //And only interfaces are generated
539-
codegen.additionalProperties().put(RETURN_JBOSS_RESPONSE, true); //And return type is Response
539+
codegen.additionalProperties().put(RETURN_JBOSS_RESPONSE, true); //And return type is RestResponse
540540

541541
final ClientOptInput input = new ClientOptInput()
542542
.openAPI(openAPI)
@@ -548,9 +548,10 @@ public void generateApiWithAsyncSupportAndInterfaceOnlyAndJBossResponse() throws
548548
//Then the java files are compilable
549549
validateJavaSourceFiles(files);
550550

551-
//And the generated interface contains CompletionStage<Response>
551+
//And the generated interface contains CompletionStage<RestResponse<Pet>>
552552
TestUtils.ensureContainsFile(files, output, "src/gen/java/org/openapitools/api/PetApi.java");
553553
assertFileContains(output.toPath().resolve("src/gen/java/org/openapitools/api/PetApi.java"),
554+
"\nimport org.jboss.resteasy.reactive.RestResponse;\n",
554555
"\nimport java.util.concurrent.CompletionStage;\n",
555556
"CompletionStage<RestResponse<Pet>> addPet", "CompletionStage<RestResponse<Void>> deletePet");
556557
}
@@ -1034,9 +1035,9 @@ public void generateSpecInterfaceWithJBossResponse() throws Exception {
10341035
//And the generated interfaces contains RestResponse
10351036
TestUtils.ensureContainsFile(files, output, "src/gen/java/org/openapitools/api/PetApi.java");
10361037
assertFileContains(output.toPath().resolve("src/gen/java/org/openapitools/api/PetApi.java"),
1037-
"\nimport org.jboss.resteasy.reactive.RestResponse;\n", "RestResponse<Pet> addPet",
1038-
"RestResponse<Void> deletePet", "RestResponse<List<Pet>> findPetsByStatus",
1039-
"RestResponse<Void> updatePetWithForm", "RestResponse<ModelApiResponse> uploadFile");
1038+
"\nimport org.jboss.resteasy.reactive.RestResponse;\n",
1039+
"RestResponse<Pet> addPet", "RestResponse<Void> deletePet", "RestResponse<List<Pet>> findPetsByStatus",
1040+
"RestResponse<Void> updatePetWithForm", "RestResponse<ModelApiResponse> uploadFile");
10401041
}
10411042

10421043
@Test

0 commit comments

Comments
 (0)