Skip to content

Commit c012dcd

Browse files
jharmelinkwing328
authored andcommitted
Added RxJava2 to java-vertx server codegen. (#3240)
1 parent dd0c2a8 commit c012dcd

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

docs/generators/java-vertx.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ sidebar_label: java-vertx
4242
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
4343
|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
4444
|snapshotVersion|Uses a SNAPSHOT version.|<dl><dt>**true**</dt><dd>Use a SnapShot Version</dd><dt>**false**</dt><dd>Use a Release Version</dd><dl>|null|
45-
|rxInterface|When specified, API interfaces are generated with RX and methods return Single&lt;&gt; and Comparable.| |false|
45+
|rxInterface|When specified, API interfaces are generated with RxJava and methods return Single<> and Completable.| |false|
46+
|rxVersion2|When specified in combination with **rxInterface**, package imports are generated for RxJava2.| |false|
4647
|vertxSwaggerRouterVersion|Specify the version of the swagger router library| |null|

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class JavaVertXServerCodegen extends AbstractJavaCodegen {
4444
public static final String ROOT_PACKAGE = "rootPackage";
4545

4646
public static final String RX_INTERFACE_OPTION = "rxInterface";
47+
public static final String RX_VERSION_2_OPTION = "rxVersion2";
4748
public static final String VERTX_SWAGGER_ROUTER_VERSION_OPTION = "vertxSwaggerRouterVersion";
4849

4950
/**
@@ -88,6 +89,9 @@ public JavaVertXServerCodegen() {
8889
cliOptions.add(CliOption.newBoolean(RX_INTERFACE_OPTION,
8990
"When specified, API interfaces are generated with RX "
9091
+ "and methods return Single<> and Comparable."));
92+
cliOptions.add(CliOption.newBoolean(RX_VERSION_2_OPTION,
93+
"When specified in combination with rxInterface, "
94+
+ "API interfaces are generated with RxJava2."));
9195
cliOptions.add(CliOption.newString(VERTX_SWAGGER_ROUTER_VERSION_OPTION,
9296
"Specify the version of the swagger router library"));
9397

modules/openapi-generator/src/main/resources/JavaVertXServer/api.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ package {{package}};
44
{{/imports}}
55

66
{{#rxInterface}}
7-
import rx.Completable;
8-
import rx.Single;
7+
import {{#rxVersion2}}io.reactivex{{/rxVersion2}}{{^rxVersion2}}rx{{/rxVersion2}}.Completable;
8+
import {{#rxVersion2}}io.reactivex{{/rxVersion2}}{{^rxVersion2}}rx{{/rxVersion2}}.Single;
99
{{/rxInterface}}
1010
{{^rxInterface}}
1111
import io.vertx.core.AsyncResult;

0 commit comments

Comments
 (0)