-
-
Notifications
You must be signed in to change notification settings - Fork 7k
feat (JAVA NATIVE): add support for useSingleRequestParameter to java native client #21331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,7 +106,7 @@ public class {{classname}} { | |
/** | ||
* {{summary}} | ||
* {{notes}} | ||
* @param apiRequest {@link API{{operationId}}Request} | ||
* @param apiRequest {@link API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request} | ||
{{#returnType}} | ||
* @return {{#asyncNative}}CompletableFuture<{{/asyncNative}}{{returnType}}{{#asyncNative}}>{{/asyncNative}} | ||
{{/returnType}} | ||
|
@@ -127,7 +127,7 @@ public class {{classname}} { | |
{{#isDeprecated}} | ||
@Deprecated | ||
{{/isDeprecated}} | ||
public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void>{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}(API{{operationId}}Request apiRequest) throws ApiException { | ||
public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void>{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest) throws ApiException { | ||
{{#allParams}} | ||
{{>nullable_var_annotations}} | ||
{{{dataType}}} {{paramName}} = apiRequest.{{paramName}}(); | ||
|
@@ -138,7 +138,7 @@ public class {{classname}} { | |
/** | ||
* {{summary}} | ||
* {{notes}} | ||
* @param apiRequest {@link API{{operationId}}Request} | ||
* @param apiRequest {@link API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request} | ||
* @return {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} | ||
* @throws ApiException if fails to make API call | ||
{{#isDeprecated}} | ||
|
@@ -152,7 +152,7 @@ public class {{classname}} { | |
{{#isDeprecated}} | ||
@Deprecated | ||
{{/isDeprecated}} | ||
public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo(API{{operationId}}Request apiRequest) throws ApiException { | ||
public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest) throws ApiException { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for the PR why do you need to wrap operationId with titlecase lambda? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wing328 Without it the operationId as part of the parameter class name would be starting with lowercase. For example it would be “APIdeletePetRequest” without it and “APIDeletePetRequest”. The second one is more camel case and Java typical in my opinion. :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so this PR is more like "correcting" the parameter class naming, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wing328 I "corrected" the parameter class name, yes but I also enabled the generation for the java native client (see the changes in JavaClientCodegen). Before this PR this part was never generated. |
||
{{#allParams}} | ||
{{{dataType}}} {{paramName}} = apiRequest.{{paramName}}(); | ||
{{/allParams}} | ||
|
@@ -574,7 +574,7 @@ public class {{classname}} { | |
{{#vendorExtensions.x-group-parameters}} | ||
{{#hasParams}} | ||
|
||
public static final class API{{operationId}}Request { | ||
public static final class API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request { | ||
{{#requiredParams}} | ||
{{>nullable_var_annotations}} | ||
private {{{dataType}}} {{paramName}}; // {{description}} (required) | ||
|
@@ -584,7 +584,7 @@ public class {{classname}} { | |
private {{{dataType}}} {{paramName}}; // {{description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}) | ||
{{/optionalParams}} | ||
|
||
private API{{operationId}}Request(Builder builder) { | ||
private API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request(Builder builder) { | ||
{{#requiredParams}} | ||
this.{{paramName}} = builder.{{paramName}}; | ||
{{/requiredParams}} | ||
|
@@ -616,8 +616,8 @@ public class {{classname}} { | |
return this; | ||
} | ||
{{/allParams}} | ||
public API{{operationId}}Request build() { | ||
return new API{{operationId}}Request(this); | ||
public API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request build() { | ||
return new API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request(this); | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1501,11 +1501,11 @@ private HttpRequest.Builder testEnumParametersRequestBuilder(@javax.annotation.N | |
/** | ||
* Fake endpoint to test group parameters (optional) | ||
* Fake endpoint to test group parameters (optional) | ||
* @param apiRequest {@link APItestGroupParametersRequest} | ||
* @param apiRequest {@link APITestGroupParametersRequest} | ||
* @return CompletableFuture<Void> | ||
* @throws ApiException if fails to make API call | ||
*/ | ||
public CompletableFuture<Void> testGroupParameters(APItestGroupParametersRequest apiRequest) throws ApiException { | ||
public CompletableFuture<Void> testGroupParameters(APITestGroupParametersRequest apiRequest) throws ApiException { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Nicklas2751 fyi. i saw this change, which may become a breaking change for other users for the time, we will consider this as a bug fix to correct the naming and see if there's a need to provide a fallback later (one way to fallback is to use customized templates) |
||
@javax.annotation.Nonnull | ||
Integer requiredStringGroup = apiRequest.requiredStringGroup(); | ||
@javax.annotation.Nonnull | ||
|
@@ -1524,11 +1524,11 @@ public CompletableFuture<Void> testGroupParameters(APItestGroupParametersRequest | |
/** | ||
* Fake endpoint to test group parameters (optional) | ||
* Fake endpoint to test group parameters (optional) | ||
* @param apiRequest {@link APItestGroupParametersRequest} | ||
* @param apiRequest {@link APITestGroupParametersRequest} | ||
* @return CompletableFuture<ApiResponse<Void>> | ||
* @throws ApiException if fails to make API call | ||
*/ | ||
public CompletableFuture<ApiResponse<Void>> testGroupParametersWithHttpInfo(APItestGroupParametersRequest apiRequest) throws ApiException { | ||
public CompletableFuture<ApiResponse<Void>> testGroupParametersWithHttpInfo(APITestGroupParametersRequest apiRequest) throws ApiException { | ||
Integer requiredStringGroup = apiRequest.requiredStringGroup(); | ||
Boolean requiredBooleanGroup = apiRequest.requiredBooleanGroup(); | ||
Long requiredInt64Group = apiRequest.requiredInt64Group(); | ||
|
@@ -1662,7 +1662,7 @@ private HttpRequest.Builder testGroupParametersRequestBuilder(@javax.annotation. | |
} | ||
|
||
|
||
public static final class APItestGroupParametersRequest { | ||
public static final class APITestGroupParametersRequest { | ||
@javax.annotation.Nonnull | ||
private Integer requiredStringGroup; // Required String in group parameters (required) | ||
@javax.annotation.Nonnull | ||
|
@@ -1676,7 +1676,7 @@ public static final class APItestGroupParametersRequest { | |
@javax.annotation.Nullable | ||
private Long int64Group; // Integer in group parameters (optional) | ||
|
||
private APItestGroupParametersRequest(Builder builder) { | ||
private APITestGroupParametersRequest(Builder builder) { | ||
this.requiredStringGroup = builder.requiredStringGroup; | ||
this.requiredBooleanGroup = builder.requiredBooleanGroup; | ||
this.requiredInt64Group = builder.requiredInt64Group; | ||
|
@@ -1744,8 +1744,8 @@ public Builder int64Group(@javax.annotation.Nullable Long int64Group) { | |
this.int64Group = int64Group; | ||
return this; | ||
} | ||
public APItestGroupParametersRequest build() { | ||
return new APItestGroupParametersRequest(this); | ||
public APITestGroupParametersRequest build() { | ||
return new APITestGroupParametersRequest(this); | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wing328 This PR enables the generation of the single parameter class for the Java native client. Before this PR, enabling ‘useSingleRequestParameter’ doesn’t changed anything for the Java native client.