diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md index ae329295a59..244e2315c9c 100644 --- a/docs/generators/java-vertx.md +++ b/docs/generators/java-vertx.md @@ -42,5 +42,6 @@ sidebar_label: java-vertx |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |snapshotVersion|Uses a SNAPSHOT version.|
**true**
Use a SnapShot Version
**false**
Use a Release Version
|null| -|rxInterface|When specified, API interfaces are generated with RX and methods return Single<> and Comparable.| |false| +|rxInterface|When specified, API interfaces are generated with RxJava and methods return Single<> and Completable.| |false| +|rxVersion2|When specified in combination with **rxInterface**, package imports are generated for RxJava2.| |false| |vertxSwaggerRouterVersion|Specify the version of the swagger router library| |null| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java index 8d484d379c4..a067e29d6bd 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java @@ -44,6 +44,7 @@ public class JavaVertXServerCodegen extends AbstractJavaCodegen { public static final String ROOT_PACKAGE = "rootPackage"; public static final String RX_INTERFACE_OPTION = "rxInterface"; + public static final String RX_VERSION_2_OPTION = "rxVersion2"; public static final String VERTX_SWAGGER_ROUTER_VERSION_OPTION = "vertxSwaggerRouterVersion"; /** @@ -88,6 +89,9 @@ public class JavaVertXServerCodegen extends AbstractJavaCodegen { cliOptions.add(CliOption.newBoolean(RX_INTERFACE_OPTION, "When specified, API interfaces are generated with RX " + "and methods return Single<> and Comparable.")); + cliOptions.add(CliOption.newBoolean(RX_VERSION_2_OPTION, + "When specified in combination with rxInterface, " + + "API interfaces are generated with RxJava2.")); cliOptions.add(CliOption.newString(VERTX_SWAGGER_ROUTER_VERSION_OPTION, "Specify the version of the swagger router library")); diff --git a/modules/openapi-generator/src/main/resources/JavaVertXServer/api.mustache b/modules/openapi-generator/src/main/resources/JavaVertXServer/api.mustache index bbef2645048..920bbd92ea0 100644 --- a/modules/openapi-generator/src/main/resources/JavaVertXServer/api.mustache +++ b/modules/openapi-generator/src/main/resources/JavaVertXServer/api.mustache @@ -4,8 +4,8 @@ package {{package}}; {{/imports}} {{#rxInterface}} -import rx.Completable; -import rx.Single; +import {{#rxVersion2}}io.reactivex{{/rxVersion2}}{{^rxVersion2}}rx{{/rxVersion2}}.Completable; +import {{#rxVersion2}}io.reactivex{{/rxVersion2}}{{^rxVersion2}}rx{{/rxVersion2}}.Single; {{/rxInterface}} {{^rxInterface}} import io.vertx.core.AsyncResult;