diff --git a/docs/generators/java-microprofile.md b/docs/generators/java-microprofile.md index 978dba2030c..d46dc94cf1c 100644 --- a/docs/generators/java-microprofile.md +++ b/docs/generators/java-microprofile.md @@ -100,7 +100,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useRuntimeException|Use RuntimeException instead of Exception. Only jersey2, jersey3, okhttp-gson, vertx, microprofile support this option.| |false| |useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false| |useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false| -|useSingleRequestParameter|Setting this property to "true" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to "static" does the same as "true", but also makes the generated arguments class static. Only WebClient supports this option.| |false| +|useSingleRequestParameter|Setting this property to "true" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to "static" does the same as "true", but also makes the generated arguments class static with single parameter instantiation.| |false| |webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false| |withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| diff --git a/docs/generators/java.md b/docs/generators/java.md index 5038eb608aa..d89024f923d 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -100,7 +100,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useRuntimeException|Use RuntimeException instead of Exception. Only jersey2, jersey3, okhttp-gson, vertx, microprofile support this option.| |false| |useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false| |useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false| -|useSingleRequestParameter|Setting this property to "true" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to "static" does the same as "true", but also makes the generated arguments class static. Only WebClient supports this option.| |false| +|useSingleRequestParameter|Setting this property to "true" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to "static" does the same as "true", but also makes the generated arguments class static with single parameter instantiation.| |false| |webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false| |withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index e00a31043ea..8f328e47404 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -236,7 +236,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen cliOptions.add(CliOption.newString(CONFIG_KEY_FROM_CLASS_NAME, "If true, set tag as key in @RegisterRestClient. Default to false. Only `microprofile` supports this option.")); cliOptions.add(CliOption.newBoolean(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC + " Only jersey2, jersey3, native, okhttp-gson support this option.")); cliOptions.add(CliOption.newString(MICROPROFILE_REST_CLIENT_VERSION, "Version of MicroProfile Rest Client API.")); - cliOptions.add(CliOption.newString(CodegenConstants.USE_SINGLE_REQUEST_PARAMETER, "Setting this property to \"true\" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to \"static\" does the same as \"true\", but also makes the generated arguments class static. Only WebClient supports this option.").defaultValue("false")); + cliOptions.add(CliOption.newString(CodegenConstants.USE_SINGLE_REQUEST_PARAMETER, "Setting this property to \"true\" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to \"static\" does the same as \"true\", but also makes the generated arguments class static with single parameter instantiation.").defaultValue("false")); cliOptions.add(CliOption.newBoolean(WEBCLIENT_BLOCKING_OPERATIONS, "Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync", this.webclientBlockingOperations)); cliOptions.add(CliOption.newBoolean(GENERATE_CLIENT_AS_BEAN, "For resttemplate, configure whether to create `ApiClient.java` and Apis clients as bean (with `@Component` annotation).", this.generateClientAsBean)); cliOptions.add(CliOption.newBoolean(SUPPORT_URL_QUERY, "Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient` libraries.")); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/restclient/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/api.mustache index 567ae4983e1..0fff00ec80e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/restclient/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/api.mustache @@ -56,7 +56,35 @@ public class {{classname}} { {{#hasParams}} {{^hasSingleParam}} + {{^staticRequest}} public record {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){} + {{/staticRequest}} + {{#staticRequest}} + public static class {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request { + {{#allParams}} + private {{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}; + {{/allParams}} + + public {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request() {} + + public {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) { + {{#allParams}} + this.{{paramName}} = {{paramName}}; + {{/allParams}} + } + + {{#allParams}} + public {{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}() { + return this.{{paramName}}; + } + public {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request {{paramName}}({{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}) { + this.{{paramName}} = {{paramName}}; + return this; + } + + {{/allParams}} + } + {{/staticRequest}} /** * {{summary}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache index 4c88bf7b411..0a412fb37ed 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache @@ -56,20 +56,27 @@ public class {{classname}} { {{#operation}}{{#singleRequestParameter}}{{#hasParams}}{{^hasSingleParam}} public {{#staticRequest}}static {{/staticRequest}}class {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request { {{#allParams}} - private final {{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}; + private {{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}; {{/allParams}} - public {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) { - {{#allParams}} - this.{{paramName}} = {{paramName}}; - {{/allParams}} - } + public {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request() {} - {{#allParams}} + public {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) { + {{#allParams}} + this.{{paramName}} = {{paramName}}; + {{/allParams}} + } + + {{#allParams}} public {{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}() { return this.{{paramName}}; } - {{/allParams}} + public {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request {{paramName}}({{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}) { + this.{{paramName}} = {{paramName}}; + return this; + } + + {{/allParams}} } /** diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java index 977871333ed..5c30fba69bc 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java @@ -3207,6 +3207,40 @@ public class JavaClientCodegenTest { ); } + @Test + public void testRestClientWithUseSingleRequestParameter_static_issue_20668() { + final Path output = newTempFolder(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("java") + .setLibrary(JavaClientCodegen.RESTCLIENT) + .setAdditionalProperties(Map.of( + CodegenConstants.API_PACKAGE, "xyz.abcdef.api", + CodegenConstants.USE_SINGLE_REQUEST_PARAMETER, "static" + )) + .setInputSpec("src/test/resources/3_1/java/petstore.yaml") + .setOutputDir(output.toString().replace("\\", "/")); + + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + TestUtils.assertFileContains( + output.resolve("src/main/java/xyz/abcdef/api/PetApi.java"), + "public static class DeletePetRequest {", + "DeletePetRequest(Long petId, String apiKey)", + "Long petId()", + "DeletePetRequest petId(Long petId) {", + "String apiKey()", + "DeletePetRequest apiKey(String apiKey) {", + "public void deletePet(DeletePetRequest requestParameters) throws RestClientResponseException {", + "public ResponseEntity deletePetWithHttpInfo(DeletePetRequest requestParameters) throws RestClientResponseException {", + "public ResponseSpec deletePetWithResponseSpec(DeletePetRequest requestParameters) throws RestClientResponseException {", + "public void deletePet(Long petId, String apiKey) throws RestClientResponseException {", + "public ResponseEntity deletePetWithHttpInfo(Long petId, String apiKey) throws RestClientResponseException {", + "public ResponseSpec deletePetWithResponseSpec(Long petId, String apiKey) throws RestClientResponseException {" + ); + TestUtils.assertFileNotContains(output.resolve("src/main/java/xyz/abcdef/api/PetApi.java"), + "public record DeletePetRequest(Long petId, String apiKey){}"); + } + @Test public void testDuplicatedOperationId() { final Path output = newTempFolder(); @@ -3244,7 +3278,8 @@ public class JavaClientCodegenTest { ); } - @Test public void testWebClientWithUseSingleRequestParameter_issue_19407() { + @Test + public void testWebClientWithUseSingleRequestParameter_issue_19407() { final Path output = newTempFolder(); final CodegenConfigurator configurator = new CodegenConfigurator() .setGeneratorName("java") @@ -3302,6 +3337,38 @@ public class JavaClientCodegenTest { ); } + @Test + public void testWebClientWithUseSingleRequestParameter_static_issue_20668() { + final Path output = newTempFolder(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("java") + .setLibrary(JavaClientCodegen.WEBCLIENT) + .setAdditionalProperties(Map.of( + CodegenConstants.API_PACKAGE, "xyz.abcdef.api", + CodegenConstants.USE_SINGLE_REQUEST_PARAMETER, "static" + )) + .setInputSpec("src/test/resources/3_1/java/petstore.yaml") + .setOutputDir(output.toString().replace("\\", "/")); + + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + TestUtils.assertFileContains( + output.resolve("src/main/java/xyz/abcdef/api/PetApi.java"), + "public static class DeletePetRequest {", + "DeletePetRequest(Long petId, String apiKey)", + "Long petId()", + "DeletePetRequest petId(Long petId) {", + "String apiKey()", + "DeletePetRequest apiKey(String apiKey) {", + "public Mono deletePet(DeletePetRequest requestParameters) throws WebClientResponseException {", + "public Mono> deletePetWithHttpInfo(DeletePetRequest requestParameters) throws WebClientResponseException {", + "public ResponseSpec deletePetWithResponseSpec(DeletePetRequest requestParameters) throws WebClientResponseException {", + "public Mono deletePet(Long petId, String apiKey) throws WebClientResponseException {", + "public Mono> deletePetWithHttpInfo(Long petId, String apiKey) throws WebClientResponseException {", + "public ResponseSpec deletePetWithResponseSpec(Long petId, String apiKey) throws WebClientResponseException {" + ); + } + @Test public void testGenerateParameterId() { final Path output = newTempFolder(); diff --git a/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/FakeApi.java index 285ce264204..0a164eef495 100644 --- a/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/FakeApi.java @@ -192,25 +192,42 @@ public class FakeApi { } public class FakeHttpSignatureTestRequest { - private final Pet pet; - private final String query1; - private final String header1; + private Pet pet; + private String query1; + private String header1; + + public FakeHttpSignatureTestRequest() {} public FakeHttpSignatureTestRequest(Pet pet, String query1, String header1) { - this.pet = pet; - this.query1 = query1; - this.header1 = header1; - } + this.pet = pet; + this.query1 = query1; + this.header1 = header1; + } public Pet pet() { return this.pet; } + public FakeHttpSignatureTestRequest pet(Pet pet) { + this.pet = pet; + return this; + } + public String query1() { return this.query1; } + public FakeHttpSignatureTestRequest query1(String query1) { + this.query1 = query1; + return this; + } + public String header1() { return this.header1; } + public FakeHttpSignatureTestRequest header1(String header1) { + this.header1 = header1; + return this; + } + } /** @@ -901,20 +918,32 @@ public class FakeApi { } public class TestBodyWithQueryParamsRequest { - private final String query; - private final User user; + private String query; + private User user; + + public TestBodyWithQueryParamsRequest() {} public TestBodyWithQueryParamsRequest(String query, User user) { - this.query = query; - this.user = user; - } + this.query = query; + this.user = user; + } public String query() { return this.query; } + public TestBodyWithQueryParamsRequest query(String query) { + this.query = query; + return this; + } + public User user() { return this.user; } + public TestBodyWithQueryParamsRequest user(User user) { + this.user = user; + return this; + } + } /** @@ -1108,80 +1137,152 @@ public class FakeApi { } public class TestEndpointParametersRequest { - private final BigDecimal number; - private final Double _double; - private final String patternWithoutDelimiter; - private final byte[] _byte; - private final Integer integer; - private final Integer int32; - private final Long int64; - private final Float _float; - private final String string; - private final File binary; - private final LocalDate date; - private final OffsetDateTime dateTime; - private final String password; - private final String paramCallback; + private BigDecimal number; + private Double _double; + private String patternWithoutDelimiter; + private byte[] _byte; + private Integer integer; + private Integer int32; + private Long int64; + private Float _float; + private String string; + private File binary; + private LocalDate date; + private OffsetDateTime dateTime; + private String password; + private String paramCallback; + + public TestEndpointParametersRequest() {} public TestEndpointParametersRequest(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) { - this.number = number; - this._double = _double; - this.patternWithoutDelimiter = patternWithoutDelimiter; - this._byte = _byte; - this.integer = integer; - this.int32 = int32; - this.int64 = int64; - this._float = _float; - this.string = string; - this.binary = binary; - this.date = date; - this.dateTime = dateTime; - this.password = password; - this.paramCallback = paramCallback; - } + this.number = number; + this._double = _double; + this.patternWithoutDelimiter = patternWithoutDelimiter; + this._byte = _byte; + this.integer = integer; + this.int32 = int32; + this.int64 = int64; + this._float = _float; + this.string = string; + this.binary = binary; + this.date = date; + this.dateTime = dateTime; + this.password = password; + this.paramCallback = paramCallback; + } public BigDecimal number() { return this.number; } + public TestEndpointParametersRequest number(BigDecimal number) { + this.number = number; + return this; + } + public Double _double() { return this._double; } + public TestEndpointParametersRequest _double(Double _double) { + this._double = _double; + return this; + } + public String patternWithoutDelimiter() { return this.patternWithoutDelimiter; } + public TestEndpointParametersRequest patternWithoutDelimiter(String patternWithoutDelimiter) { + this.patternWithoutDelimiter = patternWithoutDelimiter; + return this; + } + public byte[] _byte() { return this._byte; } + public TestEndpointParametersRequest _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + public Integer integer() { return this.integer; } + public TestEndpointParametersRequest integer(Integer integer) { + this.integer = integer; + return this; + } + public Integer int32() { return this.int32; } + public TestEndpointParametersRequest int32(Integer int32) { + this.int32 = int32; + return this; + } + public Long int64() { return this.int64; } + public TestEndpointParametersRequest int64(Long int64) { + this.int64 = int64; + return this; + } + public Float _float() { return this._float; } + public TestEndpointParametersRequest _float(Float _float) { + this._float = _float; + return this; + } + public String string() { return this.string; } + public TestEndpointParametersRequest string(String string) { + this.string = string; + return this; + } + public File binary() { return this.binary; } + public TestEndpointParametersRequest binary(File binary) { + this.binary = binary; + return this; + } + public LocalDate date() { return this.date; } + public TestEndpointParametersRequest date(LocalDate date) { + this.date = date; + return this; + } + public OffsetDateTime dateTime() { return this.dateTime; } + public TestEndpointParametersRequest dateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + public String password() { return this.password; } + public TestEndpointParametersRequest password(String password) { + this.password = password; + return this; + } + public String paramCallback() { return this.paramCallback; } + public TestEndpointParametersRequest paramCallback(String paramCallback) { + this.paramCallback = paramCallback; + return this; + } + } /** @@ -1390,55 +1491,102 @@ public class FakeApi { } public class TestEnumParametersRequest { - private final List enumHeaderStringArray; - private final String enumHeaderString; - private final List enumQueryStringArray; - private final String enumQueryString; - private final Integer enumQueryInteger; - private final Double enumQueryDouble; - private final List enumQueryModelArray; - private final List enumFormStringArray; - private final String enumFormString; + private List enumHeaderStringArray; + private String enumHeaderString; + private List enumQueryStringArray; + private String enumQueryString; + private Integer enumQueryInteger; + private Double enumQueryDouble; + private List enumQueryModelArray; + private List enumFormStringArray; + private String enumFormString; + + public TestEnumParametersRequest() {} public TestEnumParametersRequest(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumQueryModelArray, List enumFormStringArray, String enumFormString) { - this.enumHeaderStringArray = enumHeaderStringArray; - this.enumHeaderString = enumHeaderString; - this.enumQueryStringArray = enumQueryStringArray; - this.enumQueryString = enumQueryString; - this.enumQueryInteger = enumQueryInteger; - this.enumQueryDouble = enumQueryDouble; - this.enumQueryModelArray = enumQueryModelArray; - this.enumFormStringArray = enumFormStringArray; - this.enumFormString = enumFormString; - } + this.enumHeaderStringArray = enumHeaderStringArray; + this.enumHeaderString = enumHeaderString; + this.enumQueryStringArray = enumQueryStringArray; + this.enumQueryString = enumQueryString; + this.enumQueryInteger = enumQueryInteger; + this.enumQueryDouble = enumQueryDouble; + this.enumQueryModelArray = enumQueryModelArray; + this.enumFormStringArray = enumFormStringArray; + this.enumFormString = enumFormString; + } public List enumHeaderStringArray() { return this.enumHeaderStringArray; } + public TestEnumParametersRequest enumHeaderStringArray(List enumHeaderStringArray) { + this.enumHeaderStringArray = enumHeaderStringArray; + return this; + } + public String enumHeaderString() { return this.enumHeaderString; } + public TestEnumParametersRequest enumHeaderString(String enumHeaderString) { + this.enumHeaderString = enumHeaderString; + return this; + } + public List enumQueryStringArray() { return this.enumQueryStringArray; } + public TestEnumParametersRequest enumQueryStringArray(List enumQueryStringArray) { + this.enumQueryStringArray = enumQueryStringArray; + return this; + } + public String enumQueryString() { return this.enumQueryString; } + public TestEnumParametersRequest enumQueryString(String enumQueryString) { + this.enumQueryString = enumQueryString; + return this; + } + public Integer enumQueryInteger() { return this.enumQueryInteger; } + public TestEnumParametersRequest enumQueryInteger(Integer enumQueryInteger) { + this.enumQueryInteger = enumQueryInteger; + return this; + } + public Double enumQueryDouble() { return this.enumQueryDouble; } + public TestEnumParametersRequest enumQueryDouble(Double enumQueryDouble) { + this.enumQueryDouble = enumQueryDouble; + return this; + } + public List enumQueryModelArray() { return this.enumQueryModelArray; } + public TestEnumParametersRequest enumQueryModelArray(List enumQueryModelArray) { + this.enumQueryModelArray = enumQueryModelArray; + return this; + } + public List enumFormStringArray() { return this.enumFormStringArray; } + public TestEnumParametersRequest enumFormStringArray(List enumFormStringArray) { + this.enumFormStringArray = enumFormStringArray; + return this; + } + public String enumFormString() { return this.enumFormString; } + public TestEnumParametersRequest enumFormString(String enumFormString) { + this.enumFormString = enumFormString; + return this; + } + } /** @@ -1598,40 +1746,72 @@ public class FakeApi { } public class TestGroupParametersRequest { - private final Integer requiredStringGroup; - private final Boolean requiredBooleanGroup; - private final Long requiredInt64Group; - private final Integer stringGroup; - private final Boolean booleanGroup; - private final Long int64Group; + private Integer requiredStringGroup; + private Boolean requiredBooleanGroup; + private Long requiredInt64Group; + private Integer stringGroup; + private Boolean booleanGroup; + private Long int64Group; + + public TestGroupParametersRequest() {} public TestGroupParametersRequest(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) { - this.requiredStringGroup = requiredStringGroup; - this.requiredBooleanGroup = requiredBooleanGroup; - this.requiredInt64Group = requiredInt64Group; - this.stringGroup = stringGroup; - this.booleanGroup = booleanGroup; - this.int64Group = int64Group; - } + this.requiredStringGroup = requiredStringGroup; + this.requiredBooleanGroup = requiredBooleanGroup; + this.requiredInt64Group = requiredInt64Group; + this.stringGroup = stringGroup; + this.booleanGroup = booleanGroup; + this.int64Group = int64Group; + } public Integer requiredStringGroup() { return this.requiredStringGroup; } + public TestGroupParametersRequest requiredStringGroup(Integer requiredStringGroup) { + this.requiredStringGroup = requiredStringGroup; + return this; + } + public Boolean requiredBooleanGroup() { return this.requiredBooleanGroup; } + public TestGroupParametersRequest requiredBooleanGroup(Boolean requiredBooleanGroup) { + this.requiredBooleanGroup = requiredBooleanGroup; + return this; + } + public Long requiredInt64Group() { return this.requiredInt64Group; } + public TestGroupParametersRequest requiredInt64Group(Long requiredInt64Group) { + this.requiredInt64Group = requiredInt64Group; + return this; + } + public Integer stringGroup() { return this.stringGroup; } + public TestGroupParametersRequest stringGroup(Integer stringGroup) { + this.stringGroup = stringGroup; + return this; + } + public Boolean booleanGroup() { return this.booleanGroup; } + public TestGroupParametersRequest booleanGroup(Boolean booleanGroup) { + this.booleanGroup = booleanGroup; + return this; + } + public Long int64Group() { return this.int64Group; } + public TestGroupParametersRequest int64Group(Long int64Group) { + this.int64Group = int64Group; + return this; + } + } /** @@ -1916,20 +2096,32 @@ public class FakeApi { } public class TestJsonFormDataRequest { - private final String param; - private final String param2; + private String param; + private String param2; + + public TestJsonFormDataRequest() {} public TestJsonFormDataRequest(String param, String param2) { - this.param = param; - this.param2 = param2; - } + this.param = param; + this.param2 = param2; + } public String param() { return this.param; } + public TestJsonFormDataRequest param(String param) { + this.param = param; + return this; + } + public String param2() { return this.param2; } + public TestJsonFormDataRequest param2(String param2) { + this.param2 = param2; + return this; + } + } /** @@ -2121,45 +2313,82 @@ public class FakeApi { } public class TestQueryParameterCollectionFormatRequest { - private final List pipe; - private final List ioutil; - private final List http; - private final List url; - private final List context; - private final String allowEmpty; - private final Map language; + private List pipe; + private List ioutil; + private List http; + private List url; + private List context; + private String allowEmpty; + private Map language; + + public TestQueryParameterCollectionFormatRequest() {} public TestQueryParameterCollectionFormatRequest(List pipe, List ioutil, List http, List url, List context, String allowEmpty, Map language) { - this.pipe = pipe; - this.ioutil = ioutil; - this.http = http; - this.url = url; - this.context = context; - this.allowEmpty = allowEmpty; - this.language = language; - } + this.pipe = pipe; + this.ioutil = ioutil; + this.http = http; + this.url = url; + this.context = context; + this.allowEmpty = allowEmpty; + this.language = language; + } public List pipe() { return this.pipe; } + public TestQueryParameterCollectionFormatRequest pipe(List pipe) { + this.pipe = pipe; + return this; + } + public List ioutil() { return this.ioutil; } + public TestQueryParameterCollectionFormatRequest ioutil(List ioutil) { + this.ioutil = ioutil; + return this; + } + public List http() { return this.http; } + public TestQueryParameterCollectionFormatRequest http(List http) { + this.http = http; + return this; + } + public List url() { return this.url; } + public TestQueryParameterCollectionFormatRequest url(List url) { + this.url = url; + return this; + } + public List context() { return this.context; } + public TestQueryParameterCollectionFormatRequest context(List context) { + this.context = context; + return this; + } + public String allowEmpty() { return this.allowEmpty; } + public TestQueryParameterCollectionFormatRequest allowEmpty(String allowEmpty) { + this.allowEmpty = allowEmpty; + return this; + } + public Map language() { return this.language; } + public TestQueryParameterCollectionFormatRequest language(Map language) { + this.language = language; + return this; + } + } /** diff --git a/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java index ab7891d0b36..7f126dfeddb 100644 --- a/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java @@ -125,20 +125,32 @@ public class PetApi { } public class DeletePetRequest { - private final Long petId; - private final String apiKey; + private Long petId; + private String apiKey; + + public DeletePetRequest() {} public DeletePetRequest(Long petId, String apiKey) { - this.petId = petId; - this.apiKey = apiKey; - } + this.petId = petId; + this.apiKey = apiKey; + } public Long petId() { return this.petId; } + public DeletePetRequest petId(Long petId) { + this.petId = petId; + return this; + } + public String apiKey() { return this.apiKey; } + public DeletePetRequest apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + } /** @@ -586,25 +598,42 @@ public class PetApi { } public class UpdatePetWithFormRequest { - private final Long petId; - private final String name; - private final String status; + private Long petId; + private String name; + private String status; + + public UpdatePetWithFormRequest() {} public UpdatePetWithFormRequest(Long petId, String name, String status) { - this.petId = petId; - this.name = name; - this.status = status; - } + this.petId = petId; + this.name = name; + this.status = status; + } public Long petId() { return this.petId; } + public UpdatePetWithFormRequest petId(Long petId) { + this.petId = petId; + return this; + } + public String name() { return this.name; } + public UpdatePetWithFormRequest name(String name) { + this.name = name; + return this; + } + public String status() { return this.status; } + public UpdatePetWithFormRequest status(String status) { + this.status = status; + return this; + } + } /** @@ -735,25 +764,42 @@ public class PetApi { } public class UploadFileRequest { - private final Long petId; - private final String additionalMetadata; - private final File _file; + private Long petId; + private String additionalMetadata; + private File _file; + + public UploadFileRequest() {} public UploadFileRequest(Long petId, String additionalMetadata, File _file) { - this.petId = petId; - this.additionalMetadata = additionalMetadata; - this._file = _file; - } + this.petId = petId; + this.additionalMetadata = additionalMetadata; + this._file = _file; + } public Long petId() { return this.petId; } + public UploadFileRequest petId(Long petId) { + this.petId = petId; + return this; + } + public String additionalMetadata() { return this.additionalMetadata; } + public UploadFileRequest additionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + return this; + } + public File _file() { return this._file; } + public UploadFileRequest _file(File _file) { + this._file = _file; + return this; + } + } /** @@ -884,25 +930,42 @@ public class PetApi { } public class UploadFileWithRequiredFileRequest { - private final Long petId; - private final File requiredFile; - private final String additionalMetadata; + private Long petId; + private File requiredFile; + private String additionalMetadata; + + public UploadFileWithRequiredFileRequest() {} public UploadFileWithRequiredFileRequest(Long petId, File requiredFile, String additionalMetadata) { - this.petId = petId; - this.requiredFile = requiredFile; - this.additionalMetadata = additionalMetadata; - } + this.petId = petId; + this.requiredFile = requiredFile; + this.additionalMetadata = additionalMetadata; + } public Long petId() { return this.petId; } + public UploadFileWithRequiredFileRequest petId(Long petId) { + this.petId = petId; + return this; + } + public File requiredFile() { return this.requiredFile; } + public UploadFileWithRequiredFileRequest requiredFile(File requiredFile) { + this.requiredFile = requiredFile; + return this; + } + public String additionalMetadata() { return this.additionalMetadata; } + public UploadFileWithRequiredFileRequest additionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + return this; + } + } /** diff --git a/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/UserApi.java index 006f7e661bc..781ee3f5f40 100644 --- a/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/UserApi.java @@ -416,20 +416,32 @@ public class UserApi { } public class LoginUserRequest { - private final String username; - private final String password; + private String username; + private String password; + + public LoginUserRequest() {} public LoginUserRequest(String username, String password) { - this.username = username; - this.password = password; - } + this.username = username; + this.password = password; + } public String username() { return this.username; } + public LoginUserRequest username(String username) { + this.username = username; + return this; + } + public String password() { return this.password; } + public LoginUserRequest password(String password) { + this.password = password; + return this; + } + } /** @@ -621,20 +633,32 @@ public class UserApi { } public class UpdateUserRequest { - private final String username; - private final User user; + private String username; + private User user; + + public UpdateUserRequest() {} public UpdateUserRequest(String username, User user) { - this.username = username; - this.user = user; - } + this.username = username; + this.user = user; + } public String username() { return this.username; } + public UpdateUserRequest username(String username) { + this.username = username; + return this; + } + public User user() { return this.user; } + public UpdateUserRequest user(User user) { + this.user = user; + return this; + } + } /**