Skip to content

Commit

Permalink
Added RxJava2 to java-vertx server codegen. (OpenAPITools#3240)
Browse files Browse the repository at this point in the history
  • Loading branch information
jharmelink authored and wing328 committed Jul 2, 2019
1 parent dd0c2a8 commit c012dcd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/generators/java-vertx.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.|<dl><dt>**true**</dt><dd>Use a SnapShot Version</dd><dt>**false**</dt><dd>Use a Release Version</dd><dl>|null|
|rxInterface|When specified, API interfaces are generated with RX and methods return Single&lt;&gt; 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|
Original file line number Diff line number Diff line change
Expand Up @@ -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";

/**
Expand Down Expand Up @@ -88,6 +89,9 @@ public JavaVertXServerCodegen() {
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"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c012dcd

Please sign in to comment.