Skip to content

Commit 51ef868

Browse files
wing328jpfinne
andauthored
[java] implement #18032 add builder pattern to java client and spring generator (#18650)
* add builder pattern to java client and spring generator * regenerate samples * update doc --------- Co-authored-by: jpfinne <jeanpaul@finne.be>
1 parent 2f73451 commit 51ef868

File tree

276 files changed

+12819
-38
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+12819
-38
lines changed

bin/configs/java-native.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ templateDir: modules/openapi-generator/src/main/resources/Java
66
additionalProperties:
77
artifactId: petstore-native
88
hideGenerationTimestamp: "true"
9+
generateBuilders: true

bin/configs/java-resttemplate.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ additionalProperties:
99
java8: true
1010
containerDefaultToNull: true
1111
generateConstructorWithAllArgs: true
12+
generateBuilders: true

bin/configs/spring-boot-3.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ additionalProperties:
1212
withXml: true
1313
hideGenerationTimestamp: "true"
1414
generateConstructorWithAllArgs: true
15+
generateBuilders: true

bin/configs/spring-boot-lombok-data.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ additionalProperties:
88
hideGenerationTimestamp: "true"
99
additionalModelTypeAnnotations: "@lombok.Data;@lombok.Builder;@lombok.NoArgsConstructor;@lombok.AllArgsConstructor"
1010
generateConstructorWithAllArgs: true
11+
generateBuilders: true

bin/configs/spring-boot-oneof.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ additionalProperties:
88
artifactId: springboot-oneof
99
snapshotVersion: "true"
1010
hideGenerationTimestamp: "true"
11+
generateBuilders: true

bin/configs/spring-boot-useoptional.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ additionalProperties:
88
useOptional: true
99
artifactId: spring-boot-useoptional
1010
hideGenerationTimestamp: "true"
11+
generateBuilders: true

docs/generators/groovy.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
3939
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
4040
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
4141
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
42+
|generateBuilders|Whether to generate builders for models| |false|
4243
|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
4344
|groupId|groupId in generated pom.xml| |org.openapitools|
4445
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|

docs/generators/java-camel.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
5555
|documentationProvider|Select the OpenAPI documentation provider.|<dl><dt>**none**</dt><dd>Do not publish an OpenAPI specification.</dd><dt>**source**</dt><dd>Publish the original input OpenAPI specification.</dd><dt>**springfox**</dt><dd>Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.</dd><dt>**springdoc**</dt><dd>Generate an OpenAPI 3 specification using SpringDoc.</dd></dl>|springdoc|
5656
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
5757
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
58+
|generateBuilders|Whether to generate builders for models| |false|
5859
|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
5960
|generatedConstructorWithRequiredArgs|Whether to generate constructors with required args for models| |true|
6061
|groupId|groupId in generated pom.xml| |org.openapitools|

docs/generators/java-helidon-client.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
3838
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
3939
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
4040
|fullProject|If set to true, it will generate all files; if set to false, it will only generate API files. If unspecified, the behavior depends on whether a project exists or not: if it does not, same as true; if it does, same as false. Note that test files are never overwritten.| ||
41+
|generateBuilders|Whether to generate builders for models| |false|
4142
|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
4243
|groupId|groupId in generated pom.xml| |org.openapitools|
4344
|helidonVersion|Helidon complete version identifier or major version number. The specified exact Helidon release or, if specified as a major version the latest release of that major version, is used in the generated code.| |Highest released version.|

docs/generators/java-helidon-server.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
3737
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
3838
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
3939
|fullProject|If set to true, it will generate all files; if set to false, it will only generate API files. If unspecified, the behavior depends on whether a project exists or not: if it does not, same as true; if it does, same as false. Note that test files are never overwritten.| ||
40+
|generateBuilders|Whether to generate builders for models| |false|
4041
|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
4142
|gradleProject|Whether to generate gradle project instead of maven.| |false|
4243
|groupId|groupId in generated pom.xml| |org.openapitools|

0 commit comments

Comments
 (0)