diff --git a/bin/configs/java-native.yaml b/bin/configs/java-native.yaml index cac729a68aa5..ba1795d9de39 100644 --- a/bin/configs/java-native.yaml +++ b/bin/configs/java-native.yaml @@ -6,3 +6,4 @@ templateDir: modules/openapi-generator/src/main/resources/Java additionalProperties: artifactId: petstore-native hideGenerationTimestamp: "true" + generateBuilders: true diff --git a/bin/configs/java-resttemplate.yaml b/bin/configs/java-resttemplate.yaml index cedcc574dbb3..9d8bec574615 100644 --- a/bin/configs/java-resttemplate.yaml +++ b/bin/configs/java-resttemplate.yaml @@ -9,3 +9,4 @@ additionalProperties: java8: true containerDefaultToNull: true generateConstructorWithAllArgs: true + generateBuilders: true diff --git a/bin/configs/spring-boot-3.yaml b/bin/configs/spring-boot-3.yaml index 6096b1a50e10..472f660ac7ab 100644 --- a/bin/configs/spring-boot-3.yaml +++ b/bin/configs/spring-boot-3.yaml @@ -12,3 +12,4 @@ additionalProperties: withXml: true hideGenerationTimestamp: "true" generateConstructorWithAllArgs: true + generateBuilders: true diff --git a/bin/configs/spring-boot-lombok-data.yaml b/bin/configs/spring-boot-lombok-data.yaml index 51939d31d54d..57f54d71d3db 100644 --- a/bin/configs/spring-boot-lombok-data.yaml +++ b/bin/configs/spring-boot-lombok-data.yaml @@ -8,3 +8,4 @@ additionalProperties: hideGenerationTimestamp: "true" additionalModelTypeAnnotations: "@lombok.Data;@lombok.Builder;@lombok.NoArgsConstructor;@lombok.AllArgsConstructor" generateConstructorWithAllArgs: true + generateBuilders: true diff --git a/bin/configs/spring-boot-oneof.yaml b/bin/configs/spring-boot-oneof.yaml index a986fc8fabe3..f4a7ca7a99cc 100644 --- a/bin/configs/spring-boot-oneof.yaml +++ b/bin/configs/spring-boot-oneof.yaml @@ -8,3 +8,4 @@ additionalProperties: artifactId: springboot-oneof snapshotVersion: "true" hideGenerationTimestamp: "true" + generateBuilders: true diff --git a/bin/configs/spring-boot-useoptional.yaml b/bin/configs/spring-boot-useoptional.yaml index 2b3dbdc1a864..82530260d677 100644 --- a/bin/configs/spring-boot-useoptional.yaml +++ b/bin/configs/spring-boot-useoptional.yaml @@ -8,3 +8,4 @@ additionalProperties: useOptional: true artifactId: spring-boot-useoptional hideGenerationTimestamp: "true" + generateBuilders: true diff --git a/docs/generators/groovy.md b/docs/generators/groovy.md index f4d30d839d0f..12bc9a24ae90 100644 --- a/docs/generators/groovy.md +++ b/docs/generators/groovy.md @@ -39,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/java-camel.md b/docs/generators/java-camel.md index e1b5c883da21..1c7efa14ec82 100644 --- a/docs/generators/java-camel.md +++ b/docs/generators/java-camel.md @@ -55,6 +55,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**source**
Publish the original input OpenAPI specification.
**springfox**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.
**springdoc**
Generate an OpenAPI 3 specification using SpringDoc.
|springdoc| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generatedConstructorWithRequiredArgs|Whether to generate constructors with required args for models| |true| |groupId|groupId in generated pom.xml| |org.openapitools| diff --git a/docs/generators/java-helidon-client.md b/docs/generators/java-helidon-client.md index 2395a2415824..7f60cf91dbde 100644 --- a/docs/generators/java-helidon-client.md +++ b/docs/generators/java-helidon-client.md @@ -38,6 +38,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| |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.| || +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |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.| diff --git a/docs/generators/java-helidon-server.md b/docs/generators/java-helidon-server.md index 57105ba91cd6..2035bb8c6fbd 100644 --- a/docs/generators/java-helidon-server.md +++ b/docs/generators/java-helidon-server.md @@ -37,6 +37,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| |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.| || +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |gradleProject|Whether to generate gradle project instead of maven.| |false| |groupId|groupId in generated pom.xml| |org.openapitools| diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md index ef93ebfa9478..c97cc488b150 100644 --- a/docs/generators/java-inflector.md +++ b/docs/generators/java-inflector.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/java-micronaut-client.md b/docs/generators/java-micronaut-client.md index 5a02be5ce719..f8c968280ec4 100644 --- a/docs/generators/java-micronaut-client.md +++ b/docs/generators/java-micronaut-client.md @@ -50,6 +50,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generateOperationOnlyForFirstTag|When false, the operation method will be duplicated in each of the tags if multiple tags are assigned to this operation. If true, each operation will be generated only once in the first assigned tag.| |false| |generateSwaggerAnnotations|Specify if you want to generate swagger annotations and which version|
**swagger2**
Use io.swagger.core.v3:swagger-annotations for annotating operations and schemas
**true**
Equivalent to "swagger2"
**false**
Do not generate swagger annotations
**swagger1**
Use io.swagger:swagger-annotations for annotating operations and schemas
|false| diff --git a/docs/generators/java-micronaut-server.md b/docs/generators/java-micronaut-server.md index dbf99b6d81d8..9cb2ad4dbbcb 100644 --- a/docs/generators/java-micronaut-server.md +++ b/docs/generators/java-micronaut-server.md @@ -45,6 +45,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generateControllerAsAbstract|Generate an abstract class for controller to be extended. (apiPackage is then used for the abstract class, and controllerPackage is used for implementation that extends it.)| |false| |generateControllerFromExamples|Generate the implementation of controller and tests from parameter and return examples that will verify that the api works as desired (for testing)| |false| diff --git a/docs/generators/java-microprofile.md b/docs/generators/java-microprofile.md index 255ecb891ef5..dada45f96d53 100644 --- a/docs/generators/java-microprofile.md +++ b/docs/generators/java-microprofile.md @@ -49,6 +49,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| |errorObjectType|Error Object type. (This option is for okhttp-gson only)| |null| +|generateBuilders|Whether to generate builders for models| |false| |generateClientAsBean|For resttemplate, configure whether to create `ApiClient.java` and Apis clients as bean (with `@Component` annotation).| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |gradleProperties|Append additional Gradle properties to the gradle.properties file| |null| diff --git a/docs/generators/java-msf4j.md b/docs/generators/java-msf4j.md index ee7ede5d0829..52455c5fea16 100644 --- a/docs/generators/java-msf4j.md +++ b/docs/generators/java-msf4j.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/java-pkmst.md b/docs/generators/java-pkmst.md index 074ba58ea946..6ecb576ac901 100644 --- a/docs/generators/java-pkmst.md +++ b/docs/generators/java-pkmst.md @@ -43,6 +43,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| |eurekaUri|Eureka URI| |null| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |com.prokarma| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/java-play-framework.md b/docs/generators/java-play-framework.md index 91206d35863c..bfdef88970f0 100644 --- a/docs/generators/java-play-framework.md +++ b/docs/generators/java-play-framework.md @@ -44,6 +44,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |handleExceptions|Add a 'throw exception' to each controller function. Add also a custom error handler where you can put your custom logic| |true| diff --git a/docs/generators/java-undertow-server.md b/docs/generators/java-undertow-server.md index 7bbf2cc6f183..202f013209d0 100644 --- a/docs/generators/java-undertow-server.md +++ b/docs/generators/java-undertow-server.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/java-vertx-web.md b/docs/generators/java-vertx-web.md index 65af14ea9dc6..3144df23e1a1 100644 --- a/docs/generators/java-vertx-web.md +++ b/docs/generators/java-vertx-web.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md index 8456d54beaab..4592996516e1 100644 --- a/docs/generators/java-vertx.md +++ b/docs/generators/java-vertx.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/java-wiremock.md b/docs/generators/java-wiremock.md index 91d46a8c3cb4..1ae178f9927c 100644 --- a/docs/generators/java-wiremock.md +++ b/docs/generators/java-wiremock.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/java.md b/docs/generators/java.md index acf44d3854e6..028280b45621 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -49,6 +49,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| |errorObjectType|Error Object type. (This option is for okhttp-gson only)| |null| +|generateBuilders|Whether to generate builders for models| |false| |generateClientAsBean|For resttemplate, configure whether to create `ApiClient.java` and Apis clients as bean (with `@Component` annotation).| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |gradleProperties|Append additional Gradle properties to the gradle.properties file| |null| diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md index f62da7ca428d..f990de40ddb6 100644 --- a/docs/generators/jaxrs-cxf-cdi.md +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -41,7 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| -|generateBuilders|Whether to generate builders for models.| |false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generatePom|Whether to generate pom.xml if the file does not already exist.| |true| |groupId|groupId in generated pom.xml| |org.openapitools| diff --git a/docs/generators/jaxrs-cxf-client.md b/docs/generators/jaxrs-cxf-client.md index e71f240e8766..68d153daf209 100644 --- a/docs/generators/jaxrs-cxf-client.md +++ b/docs/generators/jaxrs-cxf-client.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/jaxrs-cxf-extended.md b/docs/generators/jaxrs-cxf-extended.md index 401db4e918ea..f72c477c3b73 100644 --- a/docs/generators/jaxrs-cxf-extended.md +++ b/docs/generators/jaxrs-cxf-extended.md @@ -42,6 +42,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generateJbossDeploymentDescriptor|Generate Jboss Deployment Descriptor| |false| |generateNonSpringApplication|Generate non-Spring application| |false| diff --git a/docs/generators/jaxrs-cxf.md b/docs/generators/jaxrs-cxf.md index d0a73f242178..89caf27c7ad3 100644 --- a/docs/generators/jaxrs-cxf.md +++ b/docs/generators/jaxrs-cxf.md @@ -42,6 +42,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generateJbossDeploymentDescriptor|Generate Jboss Deployment Descriptor| |false| |generateNonSpringApplication|Generate non-Spring application| |false| diff --git a/docs/generators/jaxrs-jersey.md b/docs/generators/jaxrs-jersey.md index 81af0a811e18..d3b30f001e46 100644 --- a/docs/generators/jaxrs-jersey.md +++ b/docs/generators/jaxrs-jersey.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |groupId|groupId in generated pom.xml| |org.openapitools| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| diff --git a/docs/generators/jaxrs-resteasy-eap.md b/docs/generators/jaxrs-resteasy-eap.md index 50bd75bc9297..8645361f8435 100644 --- a/docs/generators/jaxrs-resteasy-eap.md +++ b/docs/generators/jaxrs-resteasy-eap.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generateJbossDeploymentDescriptor|Generate Jboss Deployment Descriptor| |true| |groupId|groupId in generated pom.xml| |org.openapitools| diff --git a/docs/generators/jaxrs-resteasy.md b/docs/generators/jaxrs-resteasy.md index 7204ab79be76..af6e8c0aa2dd 100644 --- a/docs/generators/jaxrs-resteasy.md +++ b/docs/generators/jaxrs-resteasy.md @@ -41,6 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generateJbossDeploymentDescriptor|Generate Jboss Deployment Descriptor| |false| |groupId|groupId in generated pom.xml| |org.openapitools| diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md index 1d45f8a1a192..f1ff6d31bb66 100644 --- a/docs/generators/jaxrs-spec.md +++ b/docs/generators/jaxrs-spec.md @@ -41,7 +41,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| -|generateBuilders|Whether to generate builders for models.| |false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generatePom|Whether to generate pom.xml if the file does not already exist.| |true| |groupId|groupId in generated pom.xml| |org.openapitools| diff --git a/docs/generators/spring.md b/docs/generators/spring.md index 9bf9b50cfda0..6ae3b647ac67 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -48,6 +48,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |documentationProvider|Select the OpenAPI documentation provider.|
**none**
Do not publish an OpenAPI specification.
**source**
Publish the original input OpenAPI specification.
**springfox**
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.
**springdoc**
Generate an OpenAPI 3 specification using SpringDoc.
|springdoc| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |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.|
**false**
No changes to the enum's are made, this is the default option.
**true**
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.
|false| +|generateBuilders|Whether to generate builders for models| |false| |generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false| |generatedConstructorWithRequiredArgs|Whether to generate constructors with required args for models| |true| |groupId|groupId in generated pom.xml| |org.openapitools| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index 78167d36d9d8..0ca8bcc2b360 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -95,7 +95,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code public static final String LOMBOK = "lombok"; public static final String DEFAULT_TEST_FOLDER = "${project.build.directory}/generated-test-sources/openapi"; public static final String GENERATE_CONSTRUCTOR_WITH_ALL_ARGS = "generateConstructorWithAllArgs"; - + public static final String GENERATE_BUILDERS = "generateBuilders"; protected String dateLibrary = "java8"; protected boolean supportAsync = false; protected boolean withXml = false; @@ -145,6 +145,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code protected boolean useJakartaEe = false; protected boolean containerDefaultToNull = false; protected boolean generateConstructorWithAllArgs = false; + protected boolean generateBuilder = false; private Map schemaKeyToModelNameCache = new HashMap<>(); public AbstractJavaCodegen() { @@ -285,6 +286,7 @@ public AbstractJavaCodegen() { cliOptions.add(CliOption.newBoolean(USE_JAKARTA_EE, "whether to use Jakarta EE namespace instead of javax")); cliOptions.add(CliOption.newBoolean(CONTAINER_DEFAULT_TO_NULL, "Set containers (array, set, map) default to null")); cliOptions.add(CliOption.newBoolean(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, "whether to generate a constructor for all arguments").defaultValue(Boolean.FALSE.toString())); + cliOptions.add(CliOption.newBoolean(GENERATE_BUILDERS, "Whether to generate builders for models").defaultValue(Boolean.FALSE.toString())); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC)); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC)); @@ -359,10 +361,14 @@ public void processOpts() { } if (additionalProperties.containsKey(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS)) { - this.setgenerateConstructorWithAllArgs(convertPropertyToBoolean(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS)); + this.setGenerateConstructorWithAllArgs(convertPropertyToBoolean(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS)); } writePropertyBack(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, generateConstructorWithAllArgs); + if (additionalProperties.containsKey(GENERATE_BUILDERS)) { + this.setGenerateBuilder(convertPropertyToBoolean(GENERATE_BUILDERS)); + } + writePropertyBack(GENERATE_BUILDERS, generateBuilder); if (StringUtils.isEmpty(System.getenv("JAVA_POST_PROCESS_FILE"))) { LOGGER.info("Environment variable JAVA_POST_PROCESS_FILE not defined so the Java code may not be properly formatted. To define it, try 'export JAVA_POST_PROCESS_FILE=\"/usr/local/bin/clang-format -i\"' (Linux/Mac)"); LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); @@ -686,14 +692,22 @@ public void processOpts() { }); } - public void setgenerateConstructorWithAllArgs(boolean aValue) { + public void setGenerateConstructorWithAllArgs(boolean aValue) { this.generateConstructorWithAllArgs = aValue; } - public boolean isgenerateConstructorWithAllArgs() { + public boolean isGenerateConstructorWithAllArgs() { return generateConstructorWithAllArgs; } + public void setGenerateBuilder(boolean aValue) { + this.generateBuilder = aValue; + } + + public boolean isGenerateBuilder() { + return generateBuilder; + } + /** * Analyse and post process all Models. * @param objs the models map. @@ -779,7 +793,7 @@ public Map postProcessAllModels(Map objs) } } - if (isgenerateConstructorWithAllArgs()) { + if (isGenerateConstructorWithAllArgs()) { // conditionally force the generation of all args constructor. for (CodegenModel cm : allModels.values()) { if (isConstructorWithAllArgsAllowed(cm)) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java index 373ac795d862..ef2c3097a9fe 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java @@ -40,7 +40,6 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { public static final String USE_MICROPROFILE_OPENAPI_ANNOTATIONS = "useMicroProfileOpenAPIAnnotations"; public static final String USE_MUTINY = "useMutiny"; public static final String OPEN_API_SPEC_FILE_LOCATION = "openApiSpecFileLocation"; - public static final String GENERATE_BUILDERS = "generateBuilders"; public static final String QUARKUS_LIBRARY = "quarkus"; public static final String THORNTAIL_LIBRARY = "thorntail"; @@ -51,7 +50,6 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { private boolean interfaceOnly = false; private boolean returnResponse = false; private boolean generatePom = true; - private boolean generateBuilders = false; private boolean useSwaggerAnnotations = true; private boolean useMicroProfileOpenAPIAnnotations = false; private boolean useMutiny = false; @@ -115,7 +113,6 @@ public JavaJAXRSSpecServerCodegen() { cliOptions.add(library); cliOptions.add(CliOption.newBoolean(GENERATE_POM, "Whether to generate pom.xml if the file does not already exist.").defaultValue(String.valueOf(generatePom))); - cliOptions.add(CliOption.newBoolean(GENERATE_BUILDERS, "Whether to generate builders for models.").defaultValue(String.valueOf(generateBuilders))); cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files.").defaultValue(String.valueOf(interfaceOnly))); cliOptions.add(CliOption.newBoolean(RETURN_RESPONSE, "Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true.").defaultValue(String.valueOf(returnResponse))); cliOptions.add(CliOption.newBoolean(USE_SWAGGER_ANNOTATIONS, "Whether to generate Swagger annotations.", useSwaggerAnnotations)); @@ -177,11 +174,6 @@ public void processOpts() { writePropertyBack(USE_MUTINY, useMutiny); } - if (additionalProperties.containsKey(GENERATE_BUILDERS)) { - generateBuilders = Boolean.parseBoolean(additionalProperties.get(GENERATE_BUILDERS).toString()); - } - additionalProperties.put(GENERATE_BUILDERS, generateBuilders); - if (additionalProperties.containsKey(OPEN_API_SPEC_FILE_LOCATION)) { openApiSpecFileLocation = additionalProperties.get(OPEN_API_SPEC_FILE_LOCATION).toString(); } else if(QUARKUS_LIBRARY.equals(library) || THORNTAIL_LIBRARY.equals(library) || HELIDON_LIBRARY.equals(library) || KUMULUZEE_LIBRARY.equals(library)) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index fb225cf6e58e..bb241bf05014 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -1170,7 +1170,7 @@ public CodegenModel fromModel(String name, Schema model) { @Override protected boolean isConstructorWithAllArgsAllowed(CodegenModel codegenModel) { - if (lombokAnnotations != null && lombokAnnotations.containsKey("allArgsConstructor")) { + if (lombokAnnotations != null && lombokAnnotations.containsKey("AllArgsConstructor")) { // constructor generated by lombok return false; } @@ -1306,6 +1306,21 @@ private Set reformatProvideArgsParams(Operation operation) { return provideArgsClassSet; } + @Override + public Map postProcessAllModels(Map objs) { + objs = super.postProcessAllModels(objs); + + Map allModels = getAllModels(objs); + // conditionally force the generation of no args constructor + for (CodegenModel cm : allModels.values()) { + boolean hasLombokNoArgsConstructor = lombokAnnotations != null && lombokAnnotations.containsKey("NoArgsConstructor"); + if (!hasLombokNoArgsConstructor + && (cm.hasRequired || cm.vendorExtensions.containsKey("x-java-all-args-constructor"))) { + cm.vendorExtensions.put("x-java-no-args-constructor", true); + } + } + return objs; + } @Override public ModelsMap postProcessModelsEnum(ModelsMap objs) { diff --git a/modules/openapi-generator/src/main/resources/Java/javaBuilder.mustache b/modules/openapi-generator/src/main/resources/Java/javaBuilder.mustache new file mode 100644 index 000000000000..c02730081ca9 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/javaBuilder.mustache @@ -0,0 +1,82 @@ +public static class Builder {{#parentModel}}extends {{classname}}.Builder {{/parentModel}}{ + + private {{classname}} instance; + + public Builder() { + this(new {{classname}}()); + } + + protected Builder({{classname}} instance) { + {{#parentModel}} + super(instance); + {{/parentModel}} + this.instance = instance; + } + + {{#vars}} + public {{classname}}.Builder {{name}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.instance.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.instance.{{name}} = {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + return this; + } + {{#vendorExtensions.x-is-jackson-optional-nullable}} + public {{classname}}.Builder {{name}}(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + this.instance.{{name}} = {{name}}; + return this; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{/vars}} + +{{#parentVars}} + public {{classname}}.Builder {{name}}({{{datatypeWithEnum}}} {{name}}) { // inherited: {{isInherited}} + super.{{name}}({{name}}); + return this; + } + {{#vendorExtensions.x-is-jackson-optional-nullable}} + public {{classname}}.Builder {{name}}(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + this.instance.{{name}} = {{name}}; + return this; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}} + + {{/parentVars}} + + /** + * returns a built {{classname}} instance. + * + * The builder is not reusable. + */ + public {{classname}} build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused{{#parentModel}} + super.build();{{/parentModel}} + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static {{classname}}.Builder builder() { + return new {{classname}}.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public {{classname}}.Builder toBuilder() { + return new {{classname}}.Builder(){{#allVars}} + .{{name}}({{getter}}()){{/allVars}}; + } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache index c440057eb76e..15bd2f96d244 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache @@ -593,4 +593,8 @@ static { JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings); } {{/discriminator}} +{{#generateBuilders}} + + {{>javaBuilder}} +{{/generateBuilders}} } diff --git a/modules/openapi-generator/src/main/resources/Java/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/pojo.mustache index 8cee0ac5a565..d4c6ec8d1540 100644 --- a/modules/openapi-generator/src/main/resources/Java/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/pojo.mustache @@ -629,5 +629,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens } }; {{/parcelableModel}} +{{#generateBuilders}} + + {{>javaBuilder}} +{{/generateBuilders}} } diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/javaBuilder.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/javaBuilder.mustache new file mode 100644 index 000000000000..9f369e65cfca --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaSpring/javaBuilder.mustache @@ -0,0 +1,96 @@ + + public static class Builder {{#parentModel}}extends {{classname}}.Builder {{/parentModel}}{ + + private {{classname}} instance; + + public Builder() { + this(new {{classname}}()); + } + + protected Builder({{classname}} instance) { + {{#parentModel}} + super(instance); // the parent builder shares the same instance + {{/parentModel}} + this.instance = instance; + } + + protected Builder copyOf({{classname}} value) { {{#parentModel}} + super.copyOf(instance);{{/parentModel}}{{#vars}} + this.instance.{{setter}}(value.{{name}});{{/vars}} + return this; + } + +{{#vars}} + {{#deprecated}} + @Deprecated + {{/deprecated}} + public {{classname}}.Builder {{name}}({{{datatypeWithEnum}}} {{name}}) { + this.instance.{{name}}({{name}}); + return this; + } + {{#deprecated}} + @Deprecated + {{/deprecated}} + {{#openApiNullable}}{{#isNullable}} + public {{classname}}.Builder {{name}}(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + this.instance.{{name}} = {{name}}; + return this; + } + {{/isNullable}}{{/openApiNullable}} +{{/vars}} +{{#parentVars}} + @Override + public {{classname}}.Builder {{name}}({{{datatypeWithEnum}}} {{name}}) { + this.instance.{{name}}({{name}}); + return this; + } + {{#openApiNullable}}{{#isNullable}} + public {{classname}}.Builder {{name}}(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + this.instance.{{setter}}({{name}}); + return this; + } + {{/isNullable}}{{/openApiNullable}} +{{/parentVars}} +{{#additionalPropertiesType}} + public {{classname}}.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + +{{/additionalPropertiesType}} + /** + * returns a built {{classname}} instance. + * + * The builder is not reusable (NullPointerException) + */ + public {{classname}} build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused{{#parentModel}} + super.build();{{/parentModel}} + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static {{classname}}.Builder builder() { + return new {{classname}}.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public {{classname}}.Builder toBuilder() { + {{! using the instance setter ensure compatibility with Optional and JsonNullable}} + {{classname}}.Builder builder = new {{classname}}.Builder(); + return builder.copyOf(this); + } diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache index db03e875533a..44be9a408981 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache @@ -93,17 +93,17 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}} {{/openApiNullable}} {{/isContainer}} {{/vars}} - {{^lombok.Data}} - {{^lombok.RequiredArgsConstructor}} - {{#generatedConstructorWithRequiredArgs}} - {{#hasRequired}} + {{#vendorExtensions.x-java-no-args-constructor}} - {{^lombok.NoArgsConstructor}} public {{classname}}() { super(); } + {{/vendorExtensions.x-java-no-args-constructor}} + {{^lombok.Data}} + {{^lombok.RequiredArgsConstructor}} + {{#generatedConstructorWithRequiredArgs}} + {{#hasRequired}} - {{/lombok.NoArgsConstructor}} /** * Constructor with only required parameters{{#generateConstructorWithAllArgs}}{{^vendorExtensions.x-java-all-args-constructor}} and all parameters{{/vendorExtensions.x-java-all-args-constructor}}{{/generateConstructorWithAllArgs}} */ @@ -351,5 +351,8 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}} return o.toString().replace("\n", "\n "); } {{/lombok.ToString}} + {{#generateBuilders}} + {{>javaBuilder}} + {{/generateBuilders}} {{/lombok.Data}} } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index 7266d71341cc..daaea9a26376 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -4918,32 +4918,21 @@ public void testWebhooks() throws IOException { @Test public void testAllVars_issue_18340() { final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/spring/issue_18340.yaml"); - new OpenAPINormalizer(openAPI, Map.of("REFACTOR_ALLOF_WITH_PROPERTIES_ONLY", " true")) + new OpenAPINormalizer(openAPI, Map.of("REFACTOR_ALLOF_WITH_PROPERTIES_ONLY", "true")) .normalize(); Schema catModel = ModelUtils.getSchema(openAPI, "Cat"); Schema cat2Model = ModelUtils.getSchema(openAPI, "Cat2"); DefaultCodegen defaultCodegen = new DefaultCodegen(); defaultCodegen.setOpenAPI(openAPI); CodegenModel defaultCat = defaultCodegen.fromModel("Cat", catModel); - assertThat(getNames(defaultCat.allVars)).isEqualTo(List.of("name", "petType")); + assertThat(getNames(defaultCat.allVars)).isEqualTo(List.of("petType", "name")); - // same model gives an invalid var when using SpringCodegen. name is missing + // the normalizer makes it work even for generators supporting inheritance SpringCodegen springCodegen = new SpringCodegen(); springCodegen.setOpenAPI(openAPI); CodegenModel springCat = springCodegen.fromModel("Cat", catModel); - assertThat(getNames(springCat.allVars)).isEqualTo(List.of("petType")); // should be name,petType + assertThat(getNames(springCat.allVars)).isEqualTo(List.of("petType", "name")); CodegenModel springCat2 = springCodegen.fromModel("Cat2", cat2Model); assertThat(getNames(springCat2.allVars)).isEqualTo(List.of("petType", "name")); - - // Prove that supportsInheritance is the culprit - SpringCodegen springCodegenNoSupportInheritance = new SpringCodegen() { - { - this.supportsInheritance = false; - } - }; - springCodegenNoSupportInheritance.setOpenAPI(openAPI); - CodegenModel springCatNoSupportInheritance = springCodegenNoSupportInheritance.fromModel("Cat", catModel); - assertThat(getNames(springCatNoSupportInheritance.allVars)).isEqualTo(List.of("name", "petType")); } - } 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 a4b1a0d0b78e..dcb6aa56ea18 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 @@ -3456,4 +3456,22 @@ public void testRestClientResponseTypeWithUseAbstractionForFiles_issue16589() th ); } + @Test + void testBuilderJavaClient() throws IOException { + Map files = generateFromContract("src/test/resources/3_0/java/builder.yaml", JavaClientCodegen.RESTTEMPLATE, + Map.of(AbstractJavaCodegen.GENERATE_BUILDERS, Boolean.TRUE)); + JavaFileAssert.assertThat(files.get("Pet.java")) + .fileContains("protected String petReadonlyProperty", + "toBuilder()", + "builder()", + "public static class Builder {"); + JavaFileAssert.assertThat(files.get("Snake.java")) + .fileContains("toBuilder()", + "builder()", + "public static class Builder extends Reptile.Builder {", + ".petType(getPetType())", + ".name(getName())", + "hasLegs(getHasLegs())"); + } + } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index 29ac5199d74d..4d5d68090cb3 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -21,6 +21,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.openapitools.codegen.TestUtils.assertFileContains; import static org.openapitools.codegen.TestUtils.assertFileNotContains; +import static org.openapitools.codegen.languages.AbstractJavaCodegen.GENERATE_BUILDERS; import static org.openapitools.codegen.languages.AbstractJavaCodegen.GENERATE_CONSTRUCTOR_WITH_ALL_ARGS; import static org.openapitools.codegen.languages.SpringCodegen.ASYNC; import static org.openapitools.codegen.languages.SpringCodegen.DELEGATE_PATTERN; @@ -4702,6 +4703,52 @@ public void testLombokAnnotations() throws IOException { ; } + @Test + void testBuilderJavaSpring_noOptional() throws IOException { + Map files = generateFromContract("src/test/resources/3_0/java/builder.yaml", SPRING_BOOT, + Map.of(GENERATE_BUILDERS, true, + SpringCodegen.OPENAPI_NULLABLE, false, + SpringCodegen.USE_OPTIONAL, false)); + + JavaFileAssert.assertThat(files.get("Pet.java")) + .fileContains("toBuilder()", + "builder()", + "public static class Builder {"); + JavaFileAssert.assertThat(files.get("Snake.java")) + .fileContains("toBuilder()", + "builder()", + "public static class Builder extends Reptile.Builder {", + "return builder.copyOf(this);"); + JavaFileAssert.assertThat(files.get("SimpleObject.java")) + .fileContains("public SimpleObject.Builder additionalProperties(Map additionalProperties) {", + "SimpleObject.Builder nullableObject(String nullableObject) {", + "SimpleObject.Builder nb(BigDecimal nb) {") + .fileDoesNotContains("SimpleObject.Builder nullableObject(JsonNullable nullableObject) {"); + } + + @Test + void testBuilderJavaSpring_useOptional() throws IOException { + Map files = generateFromContract("src/test/resources/3_0/java/builder.yaml", SPRING_BOOT, + Map.of(GENERATE_BUILDERS, true, + SpringCodegen.OPENAPI_NULLABLE, true, + SpringCodegen.USE_OPTIONAL, true)); + + JavaFileAssert.assertThat(files.get("Pet.java")) + .fileContains("toBuilder()", + "builder()", + "public static class Builder {"); + JavaFileAssert.assertThat(files.get("Snake.java")) + .fileContains("toBuilder()", + "builder()", + "public static class Builder extends Reptile.Builder {", + "return builder.copyOf(this);"); + JavaFileAssert.assertThat(files.get("SimpleObject.java")) + .fileContains("public SimpleObject.Builder additionalProperties(Map additionalProperties) {", + "SimpleObject.Builder nullableObject(String nullableObject) {", + "SimpleObject.Builder nullableObject(JsonNullable nullableObject) {", + "SimpleObject.Builder nb(BigDecimal nb) {"); + } + @Test public void optionalListShouldBeEmpty() throws IOException { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); diff --git a/modules/openapi-generator/src/test/resources/3_0/java/builder.yaml b/modules/openapi-generator/src/test/resources/3_0/java/builder.yaml new file mode 100644 index 000000000000..bf77f24a4001 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/java/builder.yaml @@ -0,0 +1,140 @@ +openapi: 3.0.2 +info: + title: OAI Specification example for Polymorphism + version: 1.0.0 +paths: + /pet: + get: + responses: + '200': + description: desc + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + /reptile: + get: + responses: + '200': + description: desc + content: + application/json: + schema: + $ref: '#/components/schemas/Reptile' + /mypets: + get: + responses: + '200': + description: desc + content: + application/json: + schema: + $ref: '#/components/schemas/MyPets' +components: + schemas: + SimpleObject: + type: object + properties: + nb: + type: number + minimum: 1 + simple: + type: string + list: + type: array + items: + minLength: 1 + type: string + nullableObject: + type: string + nullable: true + nullableList: + type: array + nullable: true + items: + maxLength: 100 + type: string + additionalProperties: + type: integer + Pet: + type: object + required: + - petType + properties: + petType: + type: string + name: + type: string + petReadonlyProperty: + type: string + readOnly: true + petNullableProperty: + type: string + nullable: true + discriminator: + propertyName: petType + additionalProperties: + type: number + Cat: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + name: + type: string + Reptile: + allOf: + - $ref: '#/components/schemas/Pet' + Dog: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + bark: + type: string + simple: + $ref: '#/components/schemas/SimpleObject' + Lizard: + allOf: + - $ref: '#/components/schemas/Reptile' + - type: object + properties: + lovesRocks: + type: boolean + readOnly: true + Snake: + allOf: + - $ref: '#/components/schemas/Reptile' + - type: object + properties: + hasLegs: + type: boolean + MyPets: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Lizard' + discriminator: + propertyName: petType + # per https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#discriminatorObject + # this discriminator must be included to use it as a hint to pick a schema + MyPetsNoDisc: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Lizard' + A: + type: object + required: + - petType + properties: + petType: + type: string + discriminator: + propertyName: petType + mapping: + b: '#/components/schemas/B' + B: + allOf: + - $ref: '#/components/schemas/A' + C: + allOf: + - $ref: '#/components/schemas/B' diff --git a/pom.xml b/pom.xml index f20f903e8745..ac40cf6de02d 100644 --- a/pom.xml +++ b/pom.xml @@ -1263,4 +1263,4 @@ 1.12 1.0-beta-2 - \ No newline at end of file + diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 9d68404cdc48..391d5fb581f4 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -471,5 +471,98 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private AdditionalPropertiesClass instance; + + public Builder() { + this(new AdditionalPropertiesClass()); + } + + protected Builder(AdditionalPropertiesClass instance) { + this.instance = instance; + } + + public AdditionalPropertiesClass.Builder mapProperty(Map mapProperty) { + this.instance.mapProperty = mapProperty; + return this; + } + public AdditionalPropertiesClass.Builder mapOfMapProperty(Map> mapOfMapProperty) { + this.instance.mapOfMapProperty = mapOfMapProperty; + return this; + } + public AdditionalPropertiesClass.Builder anytype1(Object anytype1) { + this.instance.anytype1 = JsonNullable.of(anytype1); + return this; + } + public AdditionalPropertiesClass.Builder anytype1(JsonNullable anytype1) { + this.instance.anytype1 = anytype1; + return this; + } + public AdditionalPropertiesClass.Builder mapWithUndeclaredPropertiesAnytype1(Object mapWithUndeclaredPropertiesAnytype1) { + this.instance.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; + return this; + } + public AdditionalPropertiesClass.Builder mapWithUndeclaredPropertiesAnytype2(Object mapWithUndeclaredPropertiesAnytype2) { + this.instance.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; + return this; + } + public AdditionalPropertiesClass.Builder mapWithUndeclaredPropertiesAnytype3(Map mapWithUndeclaredPropertiesAnytype3) { + this.instance.mapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3; + return this; + } + public AdditionalPropertiesClass.Builder emptyMap(Object emptyMap) { + this.instance.emptyMap = emptyMap; + return this; + } + public AdditionalPropertiesClass.Builder mapWithUndeclaredPropertiesString(Map mapWithUndeclaredPropertiesString) { + this.instance.mapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; + return this; + } + + + /** + * returns a built AdditionalPropertiesClass instance. + * + * The builder is not reusable. + */ + public AdditionalPropertiesClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static AdditionalPropertiesClass.Builder builder() { + return new AdditionalPropertiesClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesClass.Builder toBuilder() { + return new AdditionalPropertiesClass.Builder() + .mapProperty(getMapProperty()) + .mapOfMapProperty(getMapOfMapProperty()) + .anytype1(getAnytype1()) + .mapWithUndeclaredPropertiesAnytype1(getMapWithUndeclaredPropertiesAnytype1()) + .mapWithUndeclaredPropertiesAnytype2(getMapWithUndeclaredPropertiesAnytype2()) + .mapWithUndeclaredPropertiesAnytype3(getMapWithUndeclaredPropertiesAnytype3()) + .emptyMap(getEmptyMap()) + .mapWithUndeclaredPropertiesString(getMapWithUndeclaredPropertiesString()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Animal.java index 80e9b5ac6957..247d9913725b 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Animal.java @@ -204,5 +204,64 @@ public String toUrlQueryString(String prefix) { mappings.put("Animal", Animal.class); JSON.registerDiscriminator(Animal.class, "className", mappings); } + + public static class Builder { + + private Animal instance; + + public Builder() { + this(new Animal()); + } + + protected Builder(Animal instance) { + this.instance = instance; + } + + public Animal.Builder className(String className) { + this.instance.className = className; + return this; + } + public Animal.Builder color(String color) { + this.instance.color = color; + return this; + } + + + /** + * returns a built Animal instance. + * + * The builder is not reusable. + */ + public Animal build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Animal.Builder builder() { + return new Animal.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Animal.Builder toBuilder() { + return new Animal.Builder() + .className(getClassName()) + .color(getColor()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Apple.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Apple.java index 112040a6b781..bd1819184f6e 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Apple.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Apple.java @@ -182,5 +182,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private Apple instance; + + public Builder() { + this(new Apple()); + } + + protected Builder(Apple instance) { + this.instance = instance; + } + + public Apple.Builder cultivar(String cultivar) { + this.instance.cultivar = cultivar; + return this; + } + public Apple.Builder origin(String origin) { + this.instance.origin = origin; + return this; + } + + + /** + * returns a built Apple instance. + * + * The builder is not reusable. + */ + public Apple build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Apple.Builder builder() { + return new Apple.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Apple.Builder toBuilder() { + return new Apple.Builder() + .cultivar(getCultivar()) + .origin(getOrigin()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AppleReq.java index 490cae0f6084..a014241fd20c 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AppleReq.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AppleReq.java @@ -182,5 +182,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private AppleReq instance; + + public Builder() { + this(new AppleReq()); + } + + protected Builder(AppleReq instance) { + this.instance = instance; + } + + public AppleReq.Builder cultivar(String cultivar) { + this.instance.cultivar = cultivar; + return this; + } + public AppleReq.Builder mealy(Boolean mealy) { + this.instance.mealy = mealy; + return this; + } + + + /** + * returns a built AppleReq instance. + * + * The builder is not reusable. + */ + public AppleReq build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static AppleReq.Builder builder() { + return new AppleReq.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AppleReq.Builder toBuilder() { + return new AppleReq.Builder() + .cultivar(getCultivar()) + .mealy(getMealy()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 36d6717577df..a39ddd0305c1 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -163,5 +163,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private ArrayOfArrayOfNumberOnly instance; + + public Builder() { + this(new ArrayOfArrayOfNumberOnly()); + } + + protected Builder(ArrayOfArrayOfNumberOnly instance) { + this.instance = instance; + } + + public ArrayOfArrayOfNumberOnly.Builder arrayArrayNumber(List> arrayArrayNumber) { + this.instance.arrayArrayNumber = arrayArrayNumber; + return this; + } + + + /** + * returns a built ArrayOfArrayOfNumberOnly instance. + * + * The builder is not reusable. + */ + public ArrayOfArrayOfNumberOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ArrayOfArrayOfNumberOnly.Builder builder() { + return new ArrayOfArrayOfNumberOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ArrayOfArrayOfNumberOnly.Builder toBuilder() { + return new ArrayOfArrayOfNumberOnly.Builder() + .arrayArrayNumber(getArrayArrayNumber()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index ad577abfc98a..49a76a2f6671 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -163,5 +163,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private ArrayOfNumberOnly instance; + + public Builder() { + this(new ArrayOfNumberOnly()); + } + + protected Builder(ArrayOfNumberOnly instance) { + this.instance = instance; + } + + public ArrayOfNumberOnly.Builder arrayNumber(List arrayNumber) { + this.instance.arrayNumber = arrayNumber; + return this; + } + + + /** + * returns a built ArrayOfNumberOnly instance. + * + * The builder is not reusable. + */ + public ArrayOfNumberOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ArrayOfNumberOnly.Builder builder() { + return new ArrayOfNumberOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ArrayOfNumberOnly.Builder toBuilder() { + return new ArrayOfNumberOnly.Builder() + .arrayNumber(getArrayNumber()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ArrayTest.java index 5c51748d98c7..db037a5fbe5b 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -259,5 +259,69 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private ArrayTest instance; + + public Builder() { + this(new ArrayTest()); + } + + protected Builder(ArrayTest instance) { + this.instance = instance; + } + + public ArrayTest.Builder arrayOfString(List arrayOfString) { + this.instance.arrayOfString = arrayOfString; + return this; + } + public ArrayTest.Builder arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.instance.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + public ArrayTest.Builder arrayArrayOfModel(List> arrayArrayOfModel) { + this.instance.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + + /** + * returns a built ArrayTest instance. + * + * The builder is not reusable. + */ + public ArrayTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ArrayTest.Builder builder() { + return new ArrayTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ArrayTest.Builder toBuilder() { + return new ArrayTest.Builder() + .arrayOfString(getArrayOfString()) + .arrayArrayOfInteger(getArrayArrayOfInteger()) + .arrayArrayOfModel(getArrayArrayOfModel()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Banana.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Banana.java index 7494955a349e..5b51ab86ad6c 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Banana.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Banana.java @@ -147,5 +147,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private Banana instance; + + public Builder() { + this(new Banana()); + } + + protected Builder(Banana instance) { + this.instance = instance; + } + + public Banana.Builder lengthCm(BigDecimal lengthCm) { + this.instance.lengthCm = lengthCm; + return this; + } + + + /** + * returns a built Banana instance. + * + * The builder is not reusable. + */ + public Banana build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Banana.Builder builder() { + return new Banana.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Banana.Builder toBuilder() { + return new Banana.Builder() + .lengthCm(getLengthCm()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/BananaReq.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/BananaReq.java index a9ef9909cad3..969909bb57b4 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/BananaReq.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/BananaReq.java @@ -183,5 +183,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private BananaReq instance; + + public Builder() { + this(new BananaReq()); + } + + protected Builder(BananaReq instance) { + this.instance = instance; + } + + public BananaReq.Builder lengthCm(BigDecimal lengthCm) { + this.instance.lengthCm = lengthCm; + return this; + } + public BananaReq.Builder sweet(Boolean sweet) { + this.instance.sweet = sweet; + return this; + } + + + /** + * returns a built BananaReq instance. + * + * The builder is not reusable. + */ + public BananaReq build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static BananaReq.Builder builder() { + return new BananaReq.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public BananaReq.Builder toBuilder() { + return new BananaReq.Builder() + .lengthCm(getLengthCm()) + .sweet(getSweet()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/BasquePig.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/BasquePig.java index ea2c7ba5fad0..ca19c9225d14 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/BasquePig.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/BasquePig.java @@ -146,5 +146,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private BasquePig instance; + + public Builder() { + this(new BasquePig()); + } + + protected Builder(BasquePig instance) { + this.instance = instance; + } + + public BasquePig.Builder className(String className) { + this.instance.className = className; + return this; + } + + + /** + * returns a built BasquePig instance. + * + * The builder is not reusable. + */ + public BasquePig build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static BasquePig.Builder builder() { + return new BasquePig.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public BasquePig.Builder toBuilder() { + return new BasquePig.Builder() + .className(getClassName()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Capitalization.java index bebb9787a2bb..edbe3cf8dcd7 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Capitalization.java @@ -326,5 +326,84 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private Capitalization instance; + + public Builder() { + this(new Capitalization()); + } + + protected Builder(Capitalization instance) { + this.instance = instance; + } + + public Capitalization.Builder smallCamel(String smallCamel) { + this.instance.smallCamel = smallCamel; + return this; + } + public Capitalization.Builder capitalCamel(String capitalCamel) { + this.instance.capitalCamel = capitalCamel; + return this; + } + public Capitalization.Builder smallSnake(String smallSnake) { + this.instance.smallSnake = smallSnake; + return this; + } + public Capitalization.Builder capitalSnake(String capitalSnake) { + this.instance.capitalSnake = capitalSnake; + return this; + } + public Capitalization.Builder scAETHFlowPoints(String scAETHFlowPoints) { + this.instance.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + public Capitalization.Builder ATT_NAME(String ATT_NAME) { + this.instance.ATT_NAME = ATT_NAME; + return this; + } + + + /** + * returns a built Capitalization instance. + * + * The builder is not reusable. + */ + public Capitalization build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Capitalization.Builder builder() { + return new Capitalization.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Capitalization.Builder toBuilder() { + return new Capitalization.Builder() + .smallCamel(getSmallCamel()) + .capitalCamel(getCapitalCamel()) + .smallSnake(getSmallSnake()) + .capitalSnake(getCapitalSnake()) + .scAETHFlowPoints(getScAETHFlowPoints()) + .ATT_NAME(getATTNAME()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Cat.java index c6d360b2dd83..e54b41ecd2a4 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Cat.java @@ -188,5 +188,73 @@ public String toUrlQueryString(String prefix) { mappings.put("Cat", Cat.class); JSON.registerDiscriminator(Cat.class, "className", mappings); } + + public static class Builder extends Animal.Builder { + + private Cat instance; + + public Builder() { + this(new Cat()); + } + + protected Builder(Cat instance) { + super(instance); + this.instance = instance; + } + + public Cat.Builder declawed(Boolean declawed) { + this.instance.declawed = declawed; + return this; + } + + public Cat.Builder className(String className) { // inherited: true + super.className(className); + return this; + } + + public Cat.Builder color(String color) { // inherited: true + super.color(color); + return this; + } + + + /** + * returns a built Cat instance. + * + * The builder is not reusable. + */ + public Cat build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Cat.Builder builder() { + return new Cat.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Cat.Builder toBuilder() { + return new Cat.Builder() + .className(getClassName()) + .color(getColor()) + .declawed(getDeclawed()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Category.java index 0f1ddd05c050..7ea4d607ef51 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Category.java @@ -182,5 +182,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private Category instance; + + public Builder() { + this(new Category()); + } + + protected Builder(Category instance) { + this.instance = instance; + } + + public Category.Builder id(Long id) { + this.instance.id = id; + return this; + } + public Category.Builder name(String name) { + this.instance.name = name; + return this; + } + + + /** + * returns a built Category instance. + * + * The builder is not reusable. + */ + public Category build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Category.Builder builder() { + return new Category.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Category.Builder toBuilder() { + return new Category.Builder() + .id(getId()) + .name(getName()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ChildCat.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ChildCat.java index 2ff8e58cd3e4..c661e05c4dc7 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ChildCat.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ChildCat.java @@ -215,5 +215,66 @@ public String toUrlQueryString(String prefix) { mappings.put("ChildCat", ChildCat.class); JSON.registerDiscriminator(ChildCat.class, "pet_type", mappings); } + + public static class Builder extends ParentPet.Builder { + + private ChildCat instance; + + public Builder() { + this(new ChildCat()); + } + + protected Builder(ChildCat instance) { + super(instance); + this.instance = instance; + } + + public ChildCat.Builder name(String name) { + this.instance.name = name; + return this; + } + public ChildCat.Builder petType(String petType) { + this.instance.petType = petType; + return this; + } + + + /** + * returns a built ChildCat instance. + * + * The builder is not reusable. + */ + public ChildCat build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ChildCat.Builder builder() { + return new ChildCat.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ChildCat.Builder toBuilder() { + return new ChildCat.Builder() + .petType(getPetType()) + .name(getName()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ClassModel.java index 4d4a1be3c35f..9ac1403cf0ea 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ClassModel.java @@ -146,5 +146,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private ClassModel instance; + + public Builder() { + this(new ClassModel()); + } + + protected Builder(ClassModel instance) { + this.instance = instance; + } + + public ClassModel.Builder propertyClass(String propertyClass) { + this.instance.propertyClass = propertyClass; + return this; + } + + + /** + * returns a built ClassModel instance. + * + * The builder is not reusable. + */ + public ClassModel build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ClassModel.Builder builder() { + return new ClassModel.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ClassModel.Builder toBuilder() { + return new ClassModel.Builder() + .propertyClass(getPropertyClass()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Client.java index bbb8bf6c0672..1fb96d8cdc28 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Client.java @@ -146,5 +146,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private Client instance; + + public Builder() { + this(new Client()); + } + + protected Builder(Client instance) { + this.instance = instance; + } + + public Client.Builder client(String client) { + this.instance.client = client; + return this; + } + + + /** + * returns a built Client instance. + * + * The builder is not reusable. + */ + public Client build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Client.Builder builder() { + return new Client.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Client.Builder toBuilder() { + return new Client.Builder() + .client(getClient()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java index 6eca37898d5d..345b324963ca 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java @@ -182,5 +182,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private ComplexQuadrilateral instance; + + public Builder() { + this(new ComplexQuadrilateral()); + } + + protected Builder(ComplexQuadrilateral instance) { + this.instance = instance; + } + + public ComplexQuadrilateral.Builder shapeType(String shapeType) { + this.instance.shapeType = shapeType; + return this; + } + public ComplexQuadrilateral.Builder quadrilateralType(String quadrilateralType) { + this.instance.quadrilateralType = quadrilateralType; + return this; + } + + + /** + * returns a built ComplexQuadrilateral instance. + * + * The builder is not reusable. + */ + public ComplexQuadrilateral build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ComplexQuadrilateral.Builder builder() { + return new ComplexQuadrilateral.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ComplexQuadrilateral.Builder toBuilder() { + return new ComplexQuadrilateral.Builder() + .shapeType(getShapeType()) + .quadrilateralType(getQuadrilateralType()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/DanishPig.java index 04c1f03c018d..49ae57b8d6a6 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/DanishPig.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/DanishPig.java @@ -146,5 +146,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private DanishPig instance; + + public Builder() { + this(new DanishPig()); + } + + protected Builder(DanishPig instance) { + this.instance = instance; + } + + public DanishPig.Builder className(String className) { + this.instance.className = className; + return this; + } + + + /** + * returns a built DanishPig instance. + * + * The builder is not reusable. + */ + public DanishPig build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static DanishPig.Builder builder() { + return new DanishPig.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public DanishPig.Builder toBuilder() { + return new DanishPig.Builder() + .className(getClassName()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/DeprecatedObject.java index c738a92c3ceb..7190a79911f3 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/DeprecatedObject.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -148,5 +148,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private DeprecatedObject instance; + + public Builder() { + this(new DeprecatedObject()); + } + + protected Builder(DeprecatedObject instance) { + this.instance = instance; + } + + public DeprecatedObject.Builder name(String name) { + this.instance.name = name; + return this; + } + + + /** + * returns a built DeprecatedObject instance. + * + * The builder is not reusable. + */ + public DeprecatedObject build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static DeprecatedObject.Builder builder() { + return new DeprecatedObject.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public DeprecatedObject.Builder toBuilder() { + return new DeprecatedObject.Builder() + .name(getName()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Dog.java index 9c4a2ec84ff4..5c2d4ebf796e 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Dog.java @@ -187,5 +187,73 @@ public String toUrlQueryString(String prefix) { mappings.put("Dog", Dog.class); JSON.registerDiscriminator(Dog.class, "className", mappings); } + + public static class Builder extends Animal.Builder { + + private Dog instance; + + public Builder() { + this(new Dog()); + } + + protected Builder(Dog instance) { + super(instance); + this.instance = instance; + } + + public Dog.Builder breed(String breed) { + this.instance.breed = breed; + return this; + } + + public Dog.Builder className(String className) { // inherited: true + super.className(className); + return this; + } + + public Dog.Builder color(String color) { // inherited: true + super.color(color); + return this; + } + + + /** + * returns a built Dog instance. + * + * The builder is not reusable. + */ + public Dog build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Dog.Builder builder() { + return new Dog.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Dog.Builder toBuilder() { + return new Dog.Builder() + .className(getClassName()) + .color(getColor()) + .breed(getBreed()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Drawing.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Drawing.java index e9d2beb1456e..6e56f7bb4c09 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Drawing.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Drawing.java @@ -349,5 +349,78 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private Drawing instance; + + public Builder() { + this(new Drawing()); + } + + protected Builder(Drawing instance) { + this.instance = instance; + } + + public Drawing.Builder mainShape(Shape mainShape) { + this.instance.mainShape = mainShape; + return this; + } + public Drawing.Builder shapeOrNull(ShapeOrNull shapeOrNull) { + this.instance.shapeOrNull = shapeOrNull; + return this; + } + public Drawing.Builder nullableShape(NullableShape nullableShape) { + this.instance.nullableShape = JsonNullable.of(nullableShape); + return this; + } + public Drawing.Builder nullableShape(JsonNullable nullableShape) { + this.instance.nullableShape = nullableShape; + return this; + } + public Drawing.Builder shapes(List shapes) { + this.instance.shapes = shapes; + return this; + } + + + /** + * returns a built Drawing instance. + * + * The builder is not reusable. + */ + public Drawing build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Drawing.Builder builder() { + return new Drawing.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Drawing.Builder toBuilder() { + return new Drawing.Builder() + .mainShape(getMainShape()) + .shapeOrNull(getShapeOrNull()) + .nullableShape(getNullableShape()) + .shapes(getShapes()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/EnumArrays.java index 84dd4ab29c03..f22832556ecc 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -266,5 +266,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private EnumArrays instance; + + public Builder() { + this(new EnumArrays()); + } + + protected Builder(EnumArrays instance) { + this.instance = instance; + } + + public EnumArrays.Builder justSymbol(JustSymbolEnum justSymbol) { + this.instance.justSymbol = justSymbol; + return this; + } + public EnumArrays.Builder arrayEnum(List arrayEnum) { + this.instance.arrayEnum = arrayEnum; + return this; + } + + + /** + * returns a built EnumArrays instance. + * + * The builder is not reusable. + */ + public EnumArrays build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static EnumArrays.Builder builder() { + return new EnumArrays.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public EnumArrays.Builder toBuilder() { + return new EnumArrays.Builder() + .justSymbol(getJustSymbol()) + .arrayEnum(getArrayEnum()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/EnumTest.java index 27b3afeb4a12..1e8bcd3b95f7 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/EnumTest.java @@ -640,5 +640,103 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private EnumTest instance; + + public Builder() { + this(new EnumTest()); + } + + protected Builder(EnumTest instance) { + this.instance = instance; + } + + public EnumTest.Builder enumString(EnumStringEnum enumString) { + this.instance.enumString = enumString; + return this; + } + public EnumTest.Builder enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.instance.enumStringRequired = enumStringRequired; + return this; + } + public EnumTest.Builder enumInteger(EnumIntegerEnum enumInteger) { + this.instance.enumInteger = enumInteger; + return this; + } + public EnumTest.Builder enumIntegerOnly(EnumIntegerOnlyEnum enumIntegerOnly) { + this.instance.enumIntegerOnly = enumIntegerOnly; + return this; + } + public EnumTest.Builder enumNumber(EnumNumberEnum enumNumber) { + this.instance.enumNumber = enumNumber; + return this; + } + public EnumTest.Builder outerEnum(OuterEnum outerEnum) { + this.instance.outerEnum = JsonNullable.of(outerEnum); + return this; + } + public EnumTest.Builder outerEnum(JsonNullable outerEnum) { + this.instance.outerEnum = outerEnum; + return this; + } + public EnumTest.Builder outerEnumInteger(OuterEnumInteger outerEnumInteger) { + this.instance.outerEnumInteger = outerEnumInteger; + return this; + } + public EnumTest.Builder outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.instance.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + public EnumTest.Builder outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.instance.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + + /** + * returns a built EnumTest instance. + * + * The builder is not reusable. + */ + public EnumTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static EnumTest.Builder builder() { + return new EnumTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public EnumTest.Builder toBuilder() { + return new EnumTest.Builder() + .enumString(getEnumString()) + .enumStringRequired(getEnumStringRequired()) + .enumInteger(getEnumInteger()) + .enumIntegerOnly(getEnumIntegerOnly()) + .enumNumber(getEnumNumber()) + .outerEnum(getOuterEnum()) + .outerEnumInteger(getOuterEnumInteger()) + .outerEnumDefaultValue(getOuterEnumDefaultValue()) + .outerEnumIntegerDefaultValue(getOuterEnumIntegerDefaultValue()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/EquilateralTriangle.java index 24a4a3a76454..6cdc1e6b5116 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/EquilateralTriangle.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/EquilateralTriangle.java @@ -182,5 +182,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private EquilateralTriangle instance; + + public Builder() { + this(new EquilateralTriangle()); + } + + protected Builder(EquilateralTriangle instance) { + this.instance = instance; + } + + public EquilateralTriangle.Builder shapeType(String shapeType) { + this.instance.shapeType = shapeType; + return this; + } + public EquilateralTriangle.Builder triangleType(String triangleType) { + this.instance.triangleType = triangleType; + return this; + } + + + /** + * returns a built EquilateralTriangle instance. + * + * The builder is not reusable. + */ + public EquilateralTriangle build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static EquilateralTriangle.Builder builder() { + return new EquilateralTriangle.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public EquilateralTriangle.Builder toBuilder() { + return new EquilateralTriangle.Builder() + .shapeType(getShapeType()) + .triangleType(getTriangleType()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java index da04aa2b30da..8c9346096632 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java @@ -197,5 +197,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private FakeBigDecimalMap200Response instance; + + public Builder() { + this(new FakeBigDecimalMap200Response()); + } + + protected Builder(FakeBigDecimalMap200Response instance) { + this.instance = instance; + } + + public FakeBigDecimalMap200Response.Builder someId(BigDecimal someId) { + this.instance.someId = someId; + return this; + } + public FakeBigDecimalMap200Response.Builder someMap(Map someMap) { + this.instance.someMap = someMap; + return this; + } + + + /** + * returns a built FakeBigDecimalMap200Response instance. + * + * The builder is not reusable. + */ + public FakeBigDecimalMap200Response build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FakeBigDecimalMap200Response.Builder builder() { + return new FakeBigDecimalMap200Response.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FakeBigDecimalMap200Response.Builder toBuilder() { + return new FakeBigDecimalMap200Response.Builder() + .someId(getSomeId()) + .someMap(getSomeMap()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 2d1475095632..530e3dd27b07 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -198,5 +198,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private FileSchemaTestClass instance; + + public Builder() { + this(new FileSchemaTestClass()); + } + + protected Builder(FileSchemaTestClass instance) { + this.instance = instance; + } + + public FileSchemaTestClass.Builder _file(ModelFile _file) { + this.instance._file = _file; + return this; + } + public FileSchemaTestClass.Builder files(List files) { + this.instance.files = files; + return this; + } + + + /** + * returns a built FileSchemaTestClass instance. + * + * The builder is not reusable. + */ + public FileSchemaTestClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FileSchemaTestClass.Builder builder() { + return new FileSchemaTestClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FileSchemaTestClass.Builder toBuilder() { + return new FileSchemaTestClass.Builder() + ._file(getFile()) + .files(getFiles()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Foo.java index de7c6d78f944..db3312b55e50 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Foo.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Foo.java @@ -146,5 +146,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private Foo instance; + + public Builder() { + this(new Foo()); + } + + protected Builder(Foo instance) { + this.instance = instance; + } + + public Foo.Builder bar(String bar) { + this.instance.bar = bar; + return this; + } + + + /** + * returns a built Foo instance. + * + * The builder is not reusable. + */ + public Foo build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Foo.Builder builder() { + return new Foo.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Foo.Builder toBuilder() { + return new Foo.Builder() + .bar(getBar()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java index 19f871f4a660..f3524b642b31 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -147,5 +147,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private FooGetDefaultResponse instance; + + public Builder() { + this(new FooGetDefaultResponse()); + } + + protected Builder(FooGetDefaultResponse instance) { + this.instance = instance; + } + + public FooGetDefaultResponse.Builder string(Foo string) { + this.instance.string = string; + return this; + } + + + /** + * returns a built FooGetDefaultResponse instance. + * + * The builder is not reusable. + */ + public FooGetDefaultResponse build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FooGetDefaultResponse.Builder builder() { + return new FooGetDefaultResponse.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FooGetDefaultResponse.Builder toBuilder() { + return new FooGetDefaultResponse.Builder() + .string(getString()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FormatTest.java index 39bd1171556f..5b9ec0d0689c 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FormatTest.java @@ -701,5 +701,134 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private FormatTest instance; + + public Builder() { + this(new FormatTest()); + } + + protected Builder(FormatTest instance) { + this.instance = instance; + } + + public FormatTest.Builder integer(Integer integer) { + this.instance.integer = integer; + return this; + } + public FormatTest.Builder int32(Integer int32) { + this.instance.int32 = int32; + return this; + } + public FormatTest.Builder int64(Long int64) { + this.instance.int64 = int64; + return this; + } + public FormatTest.Builder number(BigDecimal number) { + this.instance.number = number; + return this; + } + public FormatTest.Builder _float(Float _float) { + this.instance._float = _float; + return this; + } + public FormatTest.Builder _double(Double _double) { + this.instance._double = _double; + return this; + } + public FormatTest.Builder decimal(BigDecimal decimal) { + this.instance.decimal = decimal; + return this; + } + public FormatTest.Builder string(String string) { + this.instance.string = string; + return this; + } + public FormatTest.Builder _byte(byte[] _byte) { + this.instance._byte = _byte; + return this; + } + public FormatTest.Builder binary(File binary) { + this.instance.binary = binary; + return this; + } + public FormatTest.Builder date(LocalDate date) { + this.instance.date = date; + return this; + } + public FormatTest.Builder dateTime(OffsetDateTime dateTime) { + this.instance.dateTime = dateTime; + return this; + } + public FormatTest.Builder uuid(UUID uuid) { + this.instance.uuid = uuid; + return this; + } + public FormatTest.Builder password(String password) { + this.instance.password = password; + return this; + } + public FormatTest.Builder patternWithDigits(String patternWithDigits) { + this.instance.patternWithDigits = patternWithDigits; + return this; + } + public FormatTest.Builder patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.instance.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return this; + } + + + /** + * returns a built FormatTest instance. + * + * The builder is not reusable. + */ + public FormatTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FormatTest.Builder builder() { + return new FormatTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FormatTest.Builder toBuilder() { + return new FormatTest.Builder() + .integer(getInteger()) + .int32(getInt32()) + .int64(getInt64()) + .number(getNumber()) + ._float(getFloat()) + ._double(getDouble()) + .decimal(getDecimal()) + .string(getString()) + ._byte(getByte()) + .binary(getBinary()) + .date(getDate()) + .dateTime(getDateTime()) + .uuid(getUuid()) + .password(getPassword()) + .patternWithDigits(getPatternWithDigits()) + .patternWithDigitsAndDelimiter(getPatternWithDigitsAndDelimiter()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/GrandparentAnimal.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/GrandparentAnimal.java index 7abf493f1abf..93ac2e763942 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/GrandparentAnimal.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/GrandparentAnimal.java @@ -168,5 +168,59 @@ public String toUrlQueryString(String prefix) { mappings.put("GrandparentAnimal", GrandparentAnimal.class); JSON.registerDiscriminator(GrandparentAnimal.class, "pet_type", mappings); } + + public static class Builder { + + private GrandparentAnimal instance; + + public Builder() { + this(new GrandparentAnimal()); + } + + protected Builder(GrandparentAnimal instance) { + this.instance = instance; + } + + public GrandparentAnimal.Builder petType(String petType) { + this.instance.petType = petType; + return this; + } + + + /** + * returns a built GrandparentAnimal instance. + * + * The builder is not reusable. + */ + public GrandparentAnimal build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static GrandparentAnimal.Builder builder() { + return new GrandparentAnimal.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public GrandparentAnimal.Builder toBuilder() { + return new GrandparentAnimal.Builder() + .petType(getPetType()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 92a86f6189e3..d1eaa12325c0 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -172,5 +172,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private HasOnlyReadOnly instance; + + public Builder() { + this(new HasOnlyReadOnly()); + } + + protected Builder(HasOnlyReadOnly instance) { + this.instance = instance; + } + + public HasOnlyReadOnly.Builder bar(String bar) { + this.instance.bar = bar; + return this; + } + public HasOnlyReadOnly.Builder foo(String foo) { + this.instance.foo = foo; + return this; + } + + + /** + * returns a built HasOnlyReadOnly instance. + * + * The builder is not reusable. + */ + public HasOnlyReadOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static HasOnlyReadOnly.Builder builder() { + return new HasOnlyReadOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public HasOnlyReadOnly.Builder toBuilder() { + return new HasOnlyReadOnly.Builder() + .bar(getBar()) + .foo(getFoo()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/HealthCheckResult.java index a064f9619c41..ce1ab0df10ef 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/HealthCheckResult.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -169,5 +169,63 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private HealthCheckResult instance; + + public Builder() { + this(new HealthCheckResult()); + } + + protected Builder(HealthCheckResult instance) { + this.instance = instance; + } + + public HealthCheckResult.Builder nullableMessage(String nullableMessage) { + this.instance.nullableMessage = JsonNullable.of(nullableMessage); + return this; + } + public HealthCheckResult.Builder nullableMessage(JsonNullable nullableMessage) { + this.instance.nullableMessage = nullableMessage; + return this; + } + + + /** + * returns a built HealthCheckResult instance. + * + * The builder is not reusable. + */ + public HealthCheckResult build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static HealthCheckResult.Builder builder() { + return new HealthCheckResult.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public HealthCheckResult.Builder toBuilder() { + return new HealthCheckResult.Builder() + .nullableMessage(getNullableMessage()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java index 9f82687b3974..cd1f22472406 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java @@ -182,5 +182,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private IsoscelesTriangle instance; + + public Builder() { + this(new IsoscelesTriangle()); + } + + protected Builder(IsoscelesTriangle instance) { + this.instance = instance; + } + + public IsoscelesTriangle.Builder shapeType(String shapeType) { + this.instance.shapeType = shapeType; + return this; + } + public IsoscelesTriangle.Builder triangleType(String triangleType) { + this.instance.triangleType = triangleType; + return this; + } + + + /** + * returns a built IsoscelesTriangle instance. + * + * The builder is not reusable. + */ + public IsoscelesTriangle build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static IsoscelesTriangle.Builder builder() { + return new IsoscelesTriangle.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public IsoscelesTriangle.Builder toBuilder() { + return new IsoscelesTriangle.Builder() + .shapeType(getShapeType()) + .triangleType(getTriangleType()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/MapTest.java index 0800e433594f..cdb5f84bf79f 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/MapTest.java @@ -339,5 +339,74 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private MapTest instance; + + public Builder() { + this(new MapTest()); + } + + protected Builder(MapTest instance) { + this.instance = instance; + } + + public MapTest.Builder mapMapOfString(Map> mapMapOfString) { + this.instance.mapMapOfString = mapMapOfString; + return this; + } + public MapTest.Builder mapOfEnumString(Map mapOfEnumString) { + this.instance.mapOfEnumString = mapOfEnumString; + return this; + } + public MapTest.Builder directMap(Map directMap) { + this.instance.directMap = directMap; + return this; + } + public MapTest.Builder indirectMap(Map indirectMap) { + this.instance.indirectMap = indirectMap; + return this; + } + + + /** + * returns a built MapTest instance. + * + * The builder is not reusable. + */ + public MapTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static MapTest.Builder builder() { + return new MapTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public MapTest.Builder toBuilder() { + return new MapTest.Builder() + .mapMapOfString(getMapMapOfString()) + .mapOfEnumString(getMapOfEnumString()) + .directMap(getDirectMap()) + .indirectMap(getIndirectMap()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index a27b1a6a124b..9985f74172f2 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -236,5 +236,69 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private MixedPropertiesAndAdditionalPropertiesClass instance; + + public Builder() { + this(new MixedPropertiesAndAdditionalPropertiesClass()); + } + + protected Builder(MixedPropertiesAndAdditionalPropertiesClass instance) { + this.instance = instance; + } + + public MixedPropertiesAndAdditionalPropertiesClass.Builder uuid(UUID uuid) { + this.instance.uuid = uuid; + return this; + } + public MixedPropertiesAndAdditionalPropertiesClass.Builder dateTime(OffsetDateTime dateTime) { + this.instance.dateTime = dateTime; + return this; + } + public MixedPropertiesAndAdditionalPropertiesClass.Builder map(Map map) { + this.instance.map = map; + return this; + } + + + /** + * returns a built MixedPropertiesAndAdditionalPropertiesClass instance. + * + * The builder is not reusable. + */ + public MixedPropertiesAndAdditionalPropertiesClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static MixedPropertiesAndAdditionalPropertiesClass.Builder builder() { + return new MixedPropertiesAndAdditionalPropertiesClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public MixedPropertiesAndAdditionalPropertiesClass.Builder toBuilder() { + return new MixedPropertiesAndAdditionalPropertiesClass.Builder() + .uuid(getUuid()) + .dateTime(getDateTime()) + .map(getMap()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Model200Response.java index ed0607aff277..ad32c4aba0fa 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Model200Response.java @@ -182,5 +182,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private Model200Response instance; + + public Builder() { + this(new Model200Response()); + } + + protected Builder(Model200Response instance) { + this.instance = instance; + } + + public Model200Response.Builder name(Integer name) { + this.instance.name = name; + return this; + } + public Model200Response.Builder propertyClass(String propertyClass) { + this.instance.propertyClass = propertyClass; + return this; + } + + + /** + * returns a built Model200Response instance. + * + * The builder is not reusable. + */ + public Model200Response build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Model200Response.Builder builder() { + return new Model200Response.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Model200Response.Builder toBuilder() { + return new Model200Response.Builder() + .name(getName()) + .propertyClass(getPropertyClass()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 33bd2afe5c30..8b0bebfedee3 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -218,5 +218,69 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private ModelApiResponse instance; + + public Builder() { + this(new ModelApiResponse()); + } + + protected Builder(ModelApiResponse instance) { + this.instance = instance; + } + + public ModelApiResponse.Builder code(Integer code) { + this.instance.code = code; + return this; + } + public ModelApiResponse.Builder type(String type) { + this.instance.type = type; + return this; + } + public ModelApiResponse.Builder message(String message) { + this.instance.message = message; + return this; + } + + + /** + * returns a built ModelApiResponse instance. + * + * The builder is not reusable. + */ + public ModelApiResponse build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ModelApiResponse.Builder builder() { + return new ModelApiResponse.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelApiResponse.Builder toBuilder() { + return new ModelApiResponse.Builder() + .code(getCode()) + .type(getType()) + .message(getMessage()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelFile.java index de7a131ca9c9..af900f9924ea 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelFile.java @@ -146,5 +146,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private ModelFile instance; + + public Builder() { + this(new ModelFile()); + } + + protected Builder(ModelFile instance) { + this.instance = instance; + } + + public ModelFile.Builder sourceURI(String sourceURI) { + this.instance.sourceURI = sourceURI; + return this; + } + + + /** + * returns a built ModelFile instance. + * + * The builder is not reusable. + */ + public ModelFile build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ModelFile.Builder builder() { + return new ModelFile.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelFile.Builder toBuilder() { + return new ModelFile.Builder() + .sourceURI(getSourceURI()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelList.java index 7f76a7e9c43f..73cd57459b81 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelList.java @@ -146,5 +146,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private ModelList instance; + + public Builder() { + this(new ModelList()); + } + + protected Builder(ModelList instance) { + this.instance = instance; + } + + public ModelList.Builder _123list(String _123list) { + this.instance._123list = _123list; + return this; + } + + + /** + * returns a built ModelList instance. + * + * The builder is not reusable. + */ + public ModelList build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ModelList.Builder builder() { + return new ModelList.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelList.Builder toBuilder() { + return new ModelList.Builder() + ._123list(get123list()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelReturn.java index 1b6a64318c19..3a0f71e77e6a 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -146,5 +146,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private ModelReturn instance; + + public Builder() { + this(new ModelReturn()); + } + + protected Builder(ModelReturn instance) { + this.instance = instance; + } + + public ModelReturn.Builder _return(Integer _return) { + this.instance._return = _return; + return this; + } + + + /** + * returns a built ModelReturn instance. + * + * The builder is not reusable. + */ + public ModelReturn build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ModelReturn.Builder builder() { + return new ModelReturn.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelReturn.Builder toBuilder() { + return new ModelReturn.Builder() + ._return(getReturn()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Name.java index a4a5f038a242..7e76714db869 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Name.java @@ -244,5 +244,74 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private Name instance; + + public Builder() { + this(new Name()); + } + + protected Builder(Name instance) { + this.instance = instance; + } + + public Name.Builder name(Integer name) { + this.instance.name = name; + return this; + } + public Name.Builder snakeCase(Integer snakeCase) { + this.instance.snakeCase = snakeCase; + return this; + } + public Name.Builder property(String property) { + this.instance.property = property; + return this; + } + public Name.Builder _123number(Integer _123number) { + this.instance._123number = _123number; + return this; + } + + + /** + * returns a built Name instance. + * + * The builder is not reusable. + */ + public Name build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Name.Builder builder() { + return new Name.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Name.Builder toBuilder() { + return new Name.Builder() + .name(getName()) + .snakeCase(getSnakeCase()) + .property(getProperty()) + ._123number(get123number()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/NullableClass.java index 3b6121b6bd8c..07ca8e7e7bbb 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/NullableClass.java @@ -783,5 +783,154 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private NullableClass instance; + + public Builder() { + this(new NullableClass()); + } + + protected Builder(NullableClass instance) { + this.instance = instance; + } + + public NullableClass.Builder integerProp(Integer integerProp) { + this.instance.integerProp = JsonNullable.of(integerProp); + return this; + } + public NullableClass.Builder integerProp(JsonNullable integerProp) { + this.instance.integerProp = integerProp; + return this; + } + public NullableClass.Builder numberProp(BigDecimal numberProp) { + this.instance.numberProp = JsonNullable.of(numberProp); + return this; + } + public NullableClass.Builder numberProp(JsonNullable numberProp) { + this.instance.numberProp = numberProp; + return this; + } + public NullableClass.Builder booleanProp(Boolean booleanProp) { + this.instance.booleanProp = JsonNullable.of(booleanProp); + return this; + } + public NullableClass.Builder booleanProp(JsonNullable booleanProp) { + this.instance.booleanProp = booleanProp; + return this; + } + public NullableClass.Builder stringProp(String stringProp) { + this.instance.stringProp = JsonNullable.of(stringProp); + return this; + } + public NullableClass.Builder stringProp(JsonNullable stringProp) { + this.instance.stringProp = stringProp; + return this; + } + public NullableClass.Builder dateProp(LocalDate dateProp) { + this.instance.dateProp = JsonNullable.of(dateProp); + return this; + } + public NullableClass.Builder dateProp(JsonNullable dateProp) { + this.instance.dateProp = dateProp; + return this; + } + public NullableClass.Builder datetimeProp(OffsetDateTime datetimeProp) { + this.instance.datetimeProp = JsonNullable.of(datetimeProp); + return this; + } + public NullableClass.Builder datetimeProp(JsonNullable datetimeProp) { + this.instance.datetimeProp = datetimeProp; + return this; + } + public NullableClass.Builder arrayNullableProp(List arrayNullableProp) { + this.instance.arrayNullableProp = JsonNullable.>of(arrayNullableProp); + return this; + } + public NullableClass.Builder arrayNullableProp(JsonNullable> arrayNullableProp) { + this.instance.arrayNullableProp = arrayNullableProp; + return this; + } + public NullableClass.Builder arrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.instance.arrayAndItemsNullableProp = JsonNullable.>of(arrayAndItemsNullableProp); + return this; + } + public NullableClass.Builder arrayAndItemsNullableProp(JsonNullable> arrayAndItemsNullableProp) { + this.instance.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + public NullableClass.Builder arrayItemsNullable(List arrayItemsNullable) { + this.instance.arrayItemsNullable = arrayItemsNullable; + return this; + } + public NullableClass.Builder objectNullableProp(Map objectNullableProp) { + this.instance.objectNullableProp = JsonNullable.>of(objectNullableProp); + return this; + } + public NullableClass.Builder objectNullableProp(JsonNullable> objectNullableProp) { + this.instance.objectNullableProp = objectNullableProp; + return this; + } + public NullableClass.Builder objectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.instance.objectAndItemsNullableProp = JsonNullable.>of(objectAndItemsNullableProp); + return this; + } + public NullableClass.Builder objectAndItemsNullableProp(JsonNullable> objectAndItemsNullableProp) { + this.instance.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + public NullableClass.Builder objectItemsNullable(Map objectItemsNullable) { + this.instance.objectItemsNullable = objectItemsNullable; + return this; + } + + + /** + * returns a built NullableClass instance. + * + * The builder is not reusable. + */ + public NullableClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static NullableClass.Builder builder() { + return new NullableClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public NullableClass.Builder toBuilder() { + return new NullableClass.Builder() + .integerProp(getIntegerProp()) + .numberProp(getNumberProp()) + .booleanProp(getBooleanProp()) + .stringProp(getStringProp()) + .dateProp(getDateProp()) + .datetimeProp(getDatetimeProp()) + .arrayNullableProp(getArrayNullableProp()) + .arrayAndItemsNullableProp(getArrayAndItemsNullableProp()) + .arrayItemsNullable(getArrayItemsNullable()) + .objectNullableProp(getObjectNullableProp()) + .objectAndItemsNullableProp(getObjectAndItemsNullableProp()) + .objectItemsNullable(getObjectItemsNullable()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/NumberOnly.java index dae1f554024f..7845866a4f7c 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -147,5 +147,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private NumberOnly instance; + + public Builder() { + this(new NumberOnly()); + } + + protected Builder(NumberOnly instance) { + this.instance = instance; + } + + public NumberOnly.Builder justNumber(BigDecimal justNumber) { + this.instance.justNumber = justNumber; + return this; + } + + + /** + * returns a built NumberOnly instance. + * + * The builder is not reusable. + */ + public NumberOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static NumberOnly.Builder builder() { + return new NumberOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public NumberOnly.Builder toBuilder() { + return new NumberOnly.Builder() + .justNumber(getJustNumber()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java index 0b1ce875a715..0e3c6b8729cb 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -276,5 +276,74 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private ObjectWithDeprecatedFields instance; + + public Builder() { + this(new ObjectWithDeprecatedFields()); + } + + protected Builder(ObjectWithDeprecatedFields instance) { + this.instance = instance; + } + + public ObjectWithDeprecatedFields.Builder uuid(String uuid) { + this.instance.uuid = uuid; + return this; + } + public ObjectWithDeprecatedFields.Builder id(BigDecimal id) { + this.instance.id = id; + return this; + } + public ObjectWithDeprecatedFields.Builder deprecatedRef(DeprecatedObject deprecatedRef) { + this.instance.deprecatedRef = deprecatedRef; + return this; + } + public ObjectWithDeprecatedFields.Builder bars(List bars) { + this.instance.bars = bars; + return this; + } + + + /** + * returns a built ObjectWithDeprecatedFields instance. + * + * The builder is not reusable. + */ + public ObjectWithDeprecatedFields build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ObjectWithDeprecatedFields.Builder builder() { + return new ObjectWithDeprecatedFields.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ObjectWithDeprecatedFields.Builder toBuilder() { + return new ObjectWithDeprecatedFields.Builder() + .uuid(getUuid()) + .id(getId()) + .deprecatedRef(getDeprecatedRef()) + .bars(getBars()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Order.java index 0b4ace24f55f..481ba02ea467 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Order.java @@ -364,5 +364,84 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private Order instance; + + public Builder() { + this(new Order()); + } + + protected Builder(Order instance) { + this.instance = instance; + } + + public Order.Builder id(Long id) { + this.instance.id = id; + return this; + } + public Order.Builder petId(Long petId) { + this.instance.petId = petId; + return this; + } + public Order.Builder quantity(Integer quantity) { + this.instance.quantity = quantity; + return this; + } + public Order.Builder shipDate(OffsetDateTime shipDate) { + this.instance.shipDate = shipDate; + return this; + } + public Order.Builder status(StatusEnum status) { + this.instance.status = status; + return this; + } + public Order.Builder complete(Boolean complete) { + this.instance.complete = complete; + return this; + } + + + /** + * returns a built Order instance. + * + * The builder is not reusable. + */ + public Order build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Order.Builder builder() { + return new Order.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Order.Builder toBuilder() { + return new Order.Builder() + .id(getId()) + .petId(getPetId()) + .quantity(getQuantity()) + .shipDate(getShipDate()) + .status(getStatus()) + .complete(getComplete()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/OuterComposite.java index 4fb578c51133..53e4a3bc18fa 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -219,5 +219,69 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private OuterComposite instance; + + public Builder() { + this(new OuterComposite()); + } + + protected Builder(OuterComposite instance) { + this.instance = instance; + } + + public OuterComposite.Builder myNumber(BigDecimal myNumber) { + this.instance.myNumber = myNumber; + return this; + } + public OuterComposite.Builder myString(String myString) { + this.instance.myString = myString; + return this; + } + public OuterComposite.Builder myBoolean(Boolean myBoolean) { + this.instance.myBoolean = myBoolean; + return this; + } + + + /** + * returns a built OuterComposite instance. + * + * The builder is not reusable. + */ + public OuterComposite build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static OuterComposite.Builder builder() { + return new OuterComposite.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public OuterComposite.Builder toBuilder() { + return new OuterComposite.Builder() + .myNumber(getMyNumber()) + .myString(getMyString()) + .myBoolean(getMyBoolean()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ParentPet.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ParentPet.java index 5763379cc932..f096793c28ff 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ParentPet.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ParentPet.java @@ -143,5 +143,62 @@ public String toUrlQueryString(String prefix) { mappings.put("ParentPet", ParentPet.class); JSON.registerDiscriminator(ParentPet.class, "pet_type", mappings); } + + public static class Builder extends GrandparentAnimal.Builder { + + private ParentPet instance; + + public Builder() { + this(new ParentPet()); + } + + protected Builder(ParentPet instance) { + super(instance); + this.instance = instance; + } + + + public ParentPet.Builder petType(String petType) { // inherited: true + super.petType(petType); + return this; + } + + + /** + * returns a built ParentPet instance. + * + * The builder is not reusable. + */ + public ParentPet build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ParentPet.Builder builder() { + return new ParentPet.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ParentPet.Builder toBuilder() { + return new ParentPet.Builder() + .petType(getPetType()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Pet.java index e56e10448395..60af4469f14b 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Pet.java @@ -392,5 +392,84 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private Pet instance; + + public Builder() { + this(new Pet()); + } + + protected Builder(Pet instance) { + this.instance = instance; + } + + public Pet.Builder id(Long id) { + this.instance.id = id; + return this; + } + public Pet.Builder category(Category category) { + this.instance.category = category; + return this; + } + public Pet.Builder name(String name) { + this.instance.name = name; + return this; + } + public Pet.Builder photoUrls(List photoUrls) { + this.instance.photoUrls = photoUrls; + return this; + } + public Pet.Builder tags(List tags) { + this.instance.tags = tags; + return this; + } + public Pet.Builder status(StatusEnum status) { + this.instance.status = status; + return this; + } + + + /** + * returns a built Pet instance. + * + * The builder is not reusable. + */ + public Pet build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Pet.Builder builder() { + return new Pet.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Pet.Builder toBuilder() { + return new Pet.Builder() + .id(getId()) + .category(getCategory()) + .name(getName()) + .photoUrls(getPhotoUrls()) + .tags(getTags()) + .status(getStatus()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java index c7b896ab77f6..5a6da2a4797b 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -146,5 +146,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private QuadrilateralInterface instance; + + public Builder() { + this(new QuadrilateralInterface()); + } + + protected Builder(QuadrilateralInterface instance) { + this.instance = instance; + } + + public QuadrilateralInterface.Builder quadrilateralType(String quadrilateralType) { + this.instance.quadrilateralType = quadrilateralType; + return this; + } + + + /** + * returns a built QuadrilateralInterface instance. + * + * The builder is not reusable. + */ + public QuadrilateralInterface build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static QuadrilateralInterface.Builder builder() { + return new QuadrilateralInterface.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public QuadrilateralInterface.Builder toBuilder() { + return new QuadrilateralInterface.Builder() + .quadrilateralType(getQuadrilateralType()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index df727d0fe293..67d7bd8aeb47 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -180,5 +180,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private ReadOnlyFirst instance; + + public Builder() { + this(new ReadOnlyFirst()); + } + + protected Builder(ReadOnlyFirst instance) { + this.instance = instance; + } + + public ReadOnlyFirst.Builder bar(String bar) { + this.instance.bar = bar; + return this; + } + public ReadOnlyFirst.Builder baz(String baz) { + this.instance.baz = baz; + return this; + } + + + /** + * returns a built ReadOnlyFirst instance. + * + * The builder is not reusable. + */ + public ReadOnlyFirst build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ReadOnlyFirst.Builder builder() { + return new ReadOnlyFirst.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ReadOnlyFirst.Builder toBuilder() { + return new ReadOnlyFirst.Builder() + .bar(getBar()) + .baz(getBaz()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ScaleneTriangle.java index 0ce2388da20b..00c4b8c665ab 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ScaleneTriangle.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ScaleneTriangle.java @@ -182,5 +182,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private ScaleneTriangle instance; + + public Builder() { + this(new ScaleneTriangle()); + } + + protected Builder(ScaleneTriangle instance) { + this.instance = instance; + } + + public ScaleneTriangle.Builder shapeType(String shapeType) { + this.instance.shapeType = shapeType; + return this; + } + public ScaleneTriangle.Builder triangleType(String triangleType) { + this.instance.triangleType = triangleType; + return this; + } + + + /** + * returns a built ScaleneTriangle instance. + * + * The builder is not reusable. + */ + public ScaleneTriangle build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ScaleneTriangle.Builder builder() { + return new ScaleneTriangle.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ScaleneTriangle.Builder toBuilder() { + return new ScaleneTriangle.Builder() + .shapeType(getShapeType()) + .triangleType(getTriangleType()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ShapeInterface.java index 3c14999397b2..6107f3b38317 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ShapeInterface.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -146,5 +146,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private ShapeInterface instance; + + public Builder() { + this(new ShapeInterface()); + } + + protected Builder(ShapeInterface instance) { + this.instance = instance; + } + + public ShapeInterface.Builder shapeType(String shapeType) { + this.instance.shapeType = shapeType; + return this; + } + + + /** + * returns a built ShapeInterface instance. + * + * The builder is not reusable. + */ + public ShapeInterface build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ShapeInterface.Builder builder() { + return new ShapeInterface.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ShapeInterface.Builder toBuilder() { + return new ShapeInterface.Builder() + .shapeType(getShapeType()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java index 2aa9603f9f3f..3bb456e24b42 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java @@ -182,5 +182,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private SimpleQuadrilateral instance; + + public Builder() { + this(new SimpleQuadrilateral()); + } + + protected Builder(SimpleQuadrilateral instance) { + this.instance = instance; + } + + public SimpleQuadrilateral.Builder shapeType(String shapeType) { + this.instance.shapeType = shapeType; + return this; + } + public SimpleQuadrilateral.Builder quadrilateralType(String quadrilateralType) { + this.instance.quadrilateralType = quadrilateralType; + return this; + } + + + /** + * returns a built SimpleQuadrilateral instance. + * + * The builder is not reusable. + */ + public SimpleQuadrilateral build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static SimpleQuadrilateral.Builder builder() { + return new SimpleQuadrilateral.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public SimpleQuadrilateral.Builder toBuilder() { + return new SimpleQuadrilateral.Builder() + .shapeType(getShapeType()) + .quadrilateralType(getQuadrilateralType()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/SpecialModelName.java index d249b8ebb2a9..2dd27290bfb1 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -182,5 +182,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private SpecialModelName instance; + + public Builder() { + this(new SpecialModelName()); + } + + protected Builder(SpecialModelName instance) { + this.instance = instance; + } + + public SpecialModelName.Builder $specialPropertyName(Long $specialPropertyName) { + this.instance.$specialPropertyName = $specialPropertyName; + return this; + } + public SpecialModelName.Builder specialModelName(String specialModelName) { + this.instance.specialModelName = specialModelName; + return this; + } + + + /** + * returns a built SpecialModelName instance. + * + * The builder is not reusable. + */ + public SpecialModelName build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static SpecialModelName.Builder builder() { + return new SpecialModelName.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public SpecialModelName.Builder toBuilder() { + return new SpecialModelName.Builder() + .$specialPropertyName(get$SpecialPropertyName()) + .specialModelName(getSpecialModelName()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Tag.java index 69c8b48e751a..29b61a1c9a73 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Tag.java @@ -182,5 +182,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private Tag instance; + + public Builder() { + this(new Tag()); + } + + protected Builder(Tag instance) { + this.instance = instance; + } + + public Tag.Builder id(Long id) { + this.instance.id = id; + return this; + } + public Tag.Builder name(String name) { + this.instance.name = name; + return this; + } + + + /** + * returns a built Tag instance. + * + * The builder is not reusable. + */ + public Tag build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Tag.Builder builder() { + return new Tag.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Tag.Builder toBuilder() { + return new Tag.Builder() + .id(getId()) + .name(getName()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java index befdf7ccf870..237e99b970df 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -199,5 +199,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private TestInlineFreeformAdditionalPropertiesRequest instance; + + public Builder() { + this(new TestInlineFreeformAdditionalPropertiesRequest()); + } + + protected Builder(TestInlineFreeformAdditionalPropertiesRequest instance) { + this.instance = instance; + } + + public TestInlineFreeformAdditionalPropertiesRequest.Builder someProperty(String someProperty) { + this.instance.someProperty = someProperty; + return this; + } + + + /** + * returns a built TestInlineFreeformAdditionalPropertiesRequest instance. + * + * The builder is not reusable. + */ + public TestInlineFreeformAdditionalPropertiesRequest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static TestInlineFreeformAdditionalPropertiesRequest.Builder builder() { + return new TestInlineFreeformAdditionalPropertiesRequest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public TestInlineFreeformAdditionalPropertiesRequest.Builder toBuilder() { + return new TestInlineFreeformAdditionalPropertiesRequest.Builder() + .someProperty(getSomeProperty()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/TriangleInterface.java index 0f7c34293585..da17d7700e07 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/TriangleInterface.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -146,5 +146,59 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private TriangleInterface instance; + + public Builder() { + this(new TriangleInterface()); + } + + protected Builder(TriangleInterface instance) { + this.instance = instance; + } + + public TriangleInterface.Builder triangleType(String triangleType) { + this.instance.triangleType = triangleType; + return this; + } + + + /** + * returns a built TriangleInterface instance. + * + * The builder is not reusable. + */ + public TriangleInterface build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static TriangleInterface.Builder builder() { + return new TriangleInterface.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public TriangleInterface.Builder toBuilder() { + return new TriangleInterface.Builder() + .triangleType(getTriangleType()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/User.java index d8d3c677a2a9..9d47216c4f90 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/User.java @@ -581,5 +581,126 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private User instance; + + public Builder() { + this(new User()); + } + + protected Builder(User instance) { + this.instance = instance; + } + + public User.Builder id(Long id) { + this.instance.id = id; + return this; + } + public User.Builder username(String username) { + this.instance.username = username; + return this; + } + public User.Builder firstName(String firstName) { + this.instance.firstName = firstName; + return this; + } + public User.Builder lastName(String lastName) { + this.instance.lastName = lastName; + return this; + } + public User.Builder email(String email) { + this.instance.email = email; + return this; + } + public User.Builder password(String password) { + this.instance.password = password; + return this; + } + public User.Builder phone(String phone) { + this.instance.phone = phone; + return this; + } + public User.Builder userStatus(Integer userStatus) { + this.instance.userStatus = userStatus; + return this; + } + public User.Builder objectWithNoDeclaredProps(Object objectWithNoDeclaredProps) { + this.instance.objectWithNoDeclaredProps = objectWithNoDeclaredProps; + return this; + } + public User.Builder objectWithNoDeclaredPropsNullable(Object objectWithNoDeclaredPropsNullable) { + this.instance.objectWithNoDeclaredPropsNullable = JsonNullable.of(objectWithNoDeclaredPropsNullable); + return this; + } + public User.Builder objectWithNoDeclaredPropsNullable(JsonNullable objectWithNoDeclaredPropsNullable) { + this.instance.objectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable; + return this; + } + public User.Builder anyTypeProp(Object anyTypeProp) { + this.instance.anyTypeProp = JsonNullable.of(anyTypeProp); + return this; + } + public User.Builder anyTypeProp(JsonNullable anyTypeProp) { + this.instance.anyTypeProp = anyTypeProp; + return this; + } + public User.Builder anyTypePropNullable(Object anyTypePropNullable) { + this.instance.anyTypePropNullable = JsonNullable.of(anyTypePropNullable); + return this; + } + public User.Builder anyTypePropNullable(JsonNullable anyTypePropNullable) { + this.instance.anyTypePropNullable = anyTypePropNullable; + return this; + } + + + /** + * returns a built User instance. + * + * The builder is not reusable. + */ + public User build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static User.Builder builder() { + return new User.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public User.Builder toBuilder() { + return new User.Builder() + .id(getId()) + .username(getUsername()) + .firstName(getFirstName()) + .lastName(getLastName()) + .email(getEmail()) + .password(getPassword()) + .phone(getPhone()) + .userStatus(getUserStatus()) + .objectWithNoDeclaredProps(getObjectWithNoDeclaredProps()) + .objectWithNoDeclaredPropsNullable(getObjectWithNoDeclaredPropsNullable()) + .anyTypeProp(getAnyTypeProp()) + .anyTypePropNullable(getAnyTypePropNullable()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Whale.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Whale.java index 8e4c411a1619..399cf4520b34 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Whale.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Whale.java @@ -218,5 +218,69 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private Whale instance; + + public Builder() { + this(new Whale()); + } + + protected Builder(Whale instance) { + this.instance = instance; + } + + public Whale.Builder hasBaleen(Boolean hasBaleen) { + this.instance.hasBaleen = hasBaleen; + return this; + } + public Whale.Builder hasTeeth(Boolean hasTeeth) { + this.instance.hasTeeth = hasTeeth; + return this; + } + public Whale.Builder className(String className) { + this.instance.className = className; + return this; + } + + + /** + * returns a built Whale instance. + * + * The builder is not reusable. + */ + public Whale build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Whale.Builder builder() { + return new Whale.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Whale.Builder toBuilder() { + return new Whale.Builder() + .hasBaleen(getHasBaleen()) + .hasTeeth(getHasTeeth()) + .className(getClassName()); + } + } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Zebra.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Zebra.java index ead7009c8587..5b1b559f28fe 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Zebra.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Zebra.java @@ -272,5 +272,64 @@ public String toUrlQueryString(String prefix) { return joiner.toString(); } + + public static class Builder { + + private Zebra instance; + + public Builder() { + this(new Zebra()); + } + + protected Builder(Zebra instance) { + this.instance = instance; + } + + public Zebra.Builder type(TypeEnum type) { + this.instance.type = type; + return this; + } + public Zebra.Builder className(String className) { + this.instance.className = className; + return this; + } + + + /** + * returns a built Zebra instance. + * + * The builder is not reusable. + */ + public Zebra build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Zebra.Builder builder() { + return new Zebra.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Zebra.Builder toBuilder() { + return new Zebra.Builder() + .type(getType()) + .className(getClassName()); + } + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 3d717080f4e3..c369a0f2e0ab 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -156,5 +156,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private AdditionalPropertiesClass instance; + + public Builder() { + this(new AdditionalPropertiesClass()); + } + + protected Builder(AdditionalPropertiesClass instance) { + this.instance = instance; + } + + public AdditionalPropertiesClass.Builder mapProperty(Map mapProperty) { + this.instance.mapProperty = mapProperty; + return this; + } + public AdditionalPropertiesClass.Builder mapOfMapProperty(Map> mapOfMapProperty) { + this.instance.mapOfMapProperty = mapOfMapProperty; + return this; + } + + + /** + * returns a built AdditionalPropertiesClass instance. + * + * The builder is not reusable. + */ + public AdditionalPropertiesClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static AdditionalPropertiesClass.Builder builder() { + return new AdditionalPropertiesClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesClass.Builder toBuilder() { + return new AdditionalPropertiesClass.Builder() + .mapProperty(getMapProperty()) + .mapOfMapProperty(getMapOfMapProperty()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AllOfWithSingleRef.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AllOfWithSingleRef.java index 5a77bf23384e..35c2e78eeb72 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AllOfWithSingleRef.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/AllOfWithSingleRef.java @@ -139,5 +139,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private AllOfWithSingleRef instance; + + public Builder() { + this(new AllOfWithSingleRef()); + } + + protected Builder(AllOfWithSingleRef instance) { + this.instance = instance; + } + + public AllOfWithSingleRef.Builder username(String username) { + this.instance.username = username; + return this; + } + public AllOfWithSingleRef.Builder singleRefType(SingleRefType singleRefType) { + this.instance.singleRefType = singleRefType; + return this; + } + + + /** + * returns a built AllOfWithSingleRef instance. + * + * The builder is not reusable. + */ + public AllOfWithSingleRef build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static AllOfWithSingleRef.Builder builder() { + return new AllOfWithSingleRef.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AllOfWithSingleRef.Builder toBuilder() { + return new AllOfWithSingleRef.Builder() + .username(getUsername()) + .singleRefType(getSingleRefType()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java index 6693afeb06f3..c444d76130e4 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java @@ -151,5 +151,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Animal instance; + + public Builder() { + this(new Animal()); + } + + protected Builder(Animal instance) { + this.instance = instance; + } + + public Animal.Builder className(String className) { + this.instance.className = className; + return this; + } + public Animal.Builder color(String color) { + this.instance.color = color; + return this; + } + + + /** + * returns a built Animal instance. + * + * The builder is not reusable. + */ + public Animal build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Animal.Builder builder() { + return new Animal.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Animal.Builder toBuilder() { + return new Animal.Builder() + .className(getClassName()) + .color(getColor()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index b08931a78174..45abfb5c76c5 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -118,5 +118,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ArrayOfArrayOfNumberOnly instance; + + public Builder() { + this(new ArrayOfArrayOfNumberOnly()); + } + + protected Builder(ArrayOfArrayOfNumberOnly instance) { + this.instance = instance; + } + + public ArrayOfArrayOfNumberOnly.Builder arrayArrayNumber(List> arrayArrayNumber) { + this.instance.arrayArrayNumber = arrayArrayNumber; + return this; + } + + + /** + * returns a built ArrayOfArrayOfNumberOnly instance. + * + * The builder is not reusable. + */ + public ArrayOfArrayOfNumberOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ArrayOfArrayOfNumberOnly.Builder builder() { + return new ArrayOfArrayOfNumberOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ArrayOfArrayOfNumberOnly.Builder toBuilder() { + return new ArrayOfArrayOfNumberOnly.Builder() + .arrayArrayNumber(getArrayArrayNumber()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index e3c28990a871..fff46bca0b73 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -118,5 +118,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ArrayOfNumberOnly instance; + + public Builder() { + this(new ArrayOfNumberOnly()); + } + + protected Builder(ArrayOfNumberOnly instance) { + this.instance = instance; + } + + public ArrayOfNumberOnly.Builder arrayNumber(List arrayNumber) { + this.instance.arrayNumber = arrayNumber; + return this; + } + + + /** + * returns a built ArrayOfNumberOnly instance. + * + * The builder is not reusable. + */ + public ArrayOfNumberOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ArrayOfNumberOnly.Builder builder() { + return new ArrayOfNumberOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ArrayOfNumberOnly.Builder toBuilder() { + return new ArrayOfNumberOnly.Builder() + .arrayNumber(getArrayNumber()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java index 94c3e22c304b..9cdf71c6e69c 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -198,5 +198,69 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ArrayTest instance; + + public Builder() { + this(new ArrayTest()); + } + + protected Builder(ArrayTest instance) { + this.instance = instance; + } + + public ArrayTest.Builder arrayOfString(List arrayOfString) { + this.instance.arrayOfString = arrayOfString; + return this; + } + public ArrayTest.Builder arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.instance.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + public ArrayTest.Builder arrayArrayOfModel(List> arrayArrayOfModel) { + this.instance.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + + /** + * returns a built ArrayTest instance. + * + * The builder is not reusable. + */ + public ArrayTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ArrayTest.Builder builder() { + return new ArrayTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ArrayTest.Builder toBuilder() { + return new ArrayTest.Builder() + .arrayOfString(getArrayOfString()) + .arrayArrayOfInteger(getArrayArrayOfInteger()) + .arrayArrayOfModel(getArrayArrayOfModel()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java index 2153176018bb..2ba31cef7d30 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java @@ -266,5 +266,84 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Capitalization instance; + + public Builder() { + this(new Capitalization()); + } + + protected Builder(Capitalization instance) { + this.instance = instance; + } + + public Capitalization.Builder smallCamel(String smallCamel) { + this.instance.smallCamel = smallCamel; + return this; + } + public Capitalization.Builder capitalCamel(String capitalCamel) { + this.instance.capitalCamel = capitalCamel; + return this; + } + public Capitalization.Builder smallSnake(String smallSnake) { + this.instance.smallSnake = smallSnake; + return this; + } + public Capitalization.Builder capitalSnake(String capitalSnake) { + this.instance.capitalSnake = capitalSnake; + return this; + } + public Capitalization.Builder scAETHFlowPoints(String scAETHFlowPoints) { + this.instance.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + public Capitalization.Builder ATT_NAME(String ATT_NAME) { + this.instance.ATT_NAME = ATT_NAME; + return this; + } + + + /** + * returns a built Capitalization instance. + * + * The builder is not reusable. + */ + public Capitalization build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Capitalization.Builder builder() { + return new Capitalization.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Capitalization.Builder toBuilder() { + return new Capitalization.Builder() + .smallCamel(getSmallCamel()) + .capitalCamel(getCapitalCamel()) + .smallSnake(getSmallSnake()) + .capitalSnake(getCapitalSnake()) + .scAETHFlowPoints(getScAETHFlowPoints()) + .ATT_NAME(getATTNAME()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java index 2332f820a37e..977a2f47eb4c 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java @@ -132,5 +132,73 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder extends Animal.Builder { + + private Cat instance; + + public Builder() { + this(new Cat()); + } + + protected Builder(Cat instance) { + super(instance); + this.instance = instance; + } + + public Cat.Builder declawed(Boolean declawed) { + this.instance.declawed = declawed; + return this; + } + + public Cat.Builder className(String className) { // inherited: true + super.className(className); + return this; + } + + public Cat.Builder color(String color) { // inherited: true + super.color(color); + return this; + } + + + /** + * returns a built Cat instance. + * + * The builder is not reusable. + */ + public Cat build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Cat.Builder builder() { + return new Cat.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Cat.Builder toBuilder() { + return new Cat.Builder() + .className(getClassName()) + .color(getColor()) + .declawed(getDeclawed()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java index db90b22d2cc0..ca18702c2cf2 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java @@ -138,5 +138,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Category instance; + + public Builder() { + this(new Category()); + } + + protected Builder(Category instance) { + this.instance = instance; + } + + public Category.Builder id(Long id) { + this.instance.id = id; + return this; + } + public Category.Builder name(String name) { + this.instance.name = name; + return this; + } + + + /** + * returns a built Category instance. + * + * The builder is not reusable. + */ + public Category build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Category.Builder builder() { + return new Category.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Category.Builder toBuilder() { + return new Category.Builder() + .id(getId()) + .name(getName()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ChildWithNullable.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ChildWithNullable.java index 0fcfd2e82bf4..70ea145ffcb8 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ChildWithNullable.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ChildWithNullable.java @@ -144,5 +144,77 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder extends ParentWithNullable.Builder { + + private ChildWithNullable instance; + + public Builder() { + this(new ChildWithNullable()); + } + + protected Builder(ChildWithNullable instance) { + super(instance); + this.instance = instance; + } + + public ChildWithNullable.Builder otherProperty(String otherProperty) { + this.instance.otherProperty = otherProperty; + return this; + } + + public ChildWithNullable.Builder type(TypeEnum type) { // inherited: true + super.type(type); + return this; + } + + public ChildWithNullable.Builder nullableProperty(String nullableProperty) { // inherited: true + super.nullableProperty(nullableProperty); + return this; + } + public ChildWithNullable.Builder nullableProperty(JsonNullable nullableProperty) { + this.instance.nullableProperty = nullableProperty; + return this; + } + + + /** + * returns a built ChildWithNullable instance. + * + * The builder is not reusable. + */ + public ChildWithNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ChildWithNullable.Builder builder() { + return new ChildWithNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ChildWithNullable.Builder toBuilder() { + return new ChildWithNullable.Builder() + .type(getType()) + .nullableProperty(getNullableProperty()) + .otherProperty(getOtherProperty()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java index 6bb5958e9b47..450a4b006b59 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java @@ -106,5 +106,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ClassModel instance; + + public Builder() { + this(new ClassModel()); + } + + protected Builder(ClassModel instance) { + this.instance = instance; + } + + public ClassModel.Builder propertyClass(String propertyClass) { + this.instance.propertyClass = propertyClass; + return this; + } + + + /** + * returns a built ClassModel instance. + * + * The builder is not reusable. + */ + public ClassModel build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ClassModel.Builder builder() { + return new ClassModel.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ClassModel.Builder toBuilder() { + return new ClassModel.Builder() + .propertyClass(getPropertyClass()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java index 7c6b6d4c7992..4a576df513d4 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java @@ -106,5 +106,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Client instance; + + public Builder() { + this(new Client()); + } + + protected Builder(Client instance) { + this.instance = instance; + } + + public Client.Builder client(String client) { + this.instance.client = client; + return this; + } + + + /** + * returns a built Client instance. + * + * The builder is not reusable. + */ + public Client build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Client.Builder builder() { + return new Client.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Client.Builder toBuilder() { + return new Client.Builder() + .client(getClient()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/DeprecatedObject.java index 196f0c5340cd..1e3733259f9f 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/DeprecatedObject.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -108,5 +108,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private DeprecatedObject instance; + + public Builder() { + this(new DeprecatedObject()); + } + + protected Builder(DeprecatedObject instance) { + this.instance = instance; + } + + public DeprecatedObject.Builder name(String name) { + this.instance.name = name; + return this; + } + + + /** + * returns a built DeprecatedObject instance. + * + * The builder is not reusable. + */ + public DeprecatedObject build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static DeprecatedObject.Builder builder() { + return new DeprecatedObject.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public DeprecatedObject.Builder toBuilder() { + return new DeprecatedObject.Builder() + .name(getName()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java index e3f7dd0a02c8..6e19d24e25e9 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java @@ -132,5 +132,73 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder extends Animal.Builder { + + private Dog instance; + + public Builder() { + this(new Dog()); + } + + protected Builder(Dog instance) { + super(instance); + this.instance = instance; + } + + public Dog.Builder breed(String breed) { + this.instance.breed = breed; + return this; + } + + public Dog.Builder className(String className) { // inherited: true + super.className(className); + return this; + } + + public Dog.Builder color(String color) { // inherited: true + super.color(color); + return this; + } + + + /** + * returns a built Dog instance. + * + * The builder is not reusable. + */ + public Dog build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Dog.Builder builder() { + return new Dog.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Dog.Builder toBuilder() { + return new Dog.Builder() + .className(getClassName()) + .color(getColor()) + .breed(getBreed()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java index 8c0470467c6e..2d4c6b8a979a 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -219,5 +219,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private EnumArrays instance; + + public Builder() { + this(new EnumArrays()); + } + + protected Builder(EnumArrays instance) { + this.instance = instance; + } + + public EnumArrays.Builder justSymbol(JustSymbolEnum justSymbol) { + this.instance.justSymbol = justSymbol; + return this; + } + public EnumArrays.Builder arrayEnum(List arrayEnum) { + this.instance.arrayEnum = arrayEnum; + return this; + } + + + /** + * returns a built EnumArrays instance. + * + * The builder is not reusable. + */ + public EnumArrays build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static EnumArrays.Builder builder() { + return new EnumArrays.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public EnumArrays.Builder toBuilder() { + return new EnumArrays.Builder() + .justSymbol(getJustSymbol()) + .arrayEnum(getArrayEnum()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java index fda5fa5b6b62..add6575e0a98 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java @@ -502,5 +502,98 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private EnumTest instance; + + public Builder() { + this(new EnumTest()); + } + + protected Builder(EnumTest instance) { + this.instance = instance; + } + + public EnumTest.Builder enumString(EnumStringEnum enumString) { + this.instance.enumString = enumString; + return this; + } + public EnumTest.Builder enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.instance.enumStringRequired = enumStringRequired; + return this; + } + public EnumTest.Builder enumInteger(EnumIntegerEnum enumInteger) { + this.instance.enumInteger = enumInteger; + return this; + } + public EnumTest.Builder enumNumber(EnumNumberEnum enumNumber) { + this.instance.enumNumber = enumNumber; + return this; + } + public EnumTest.Builder outerEnum(OuterEnum outerEnum) { + this.instance.outerEnum = JsonNullable.of(outerEnum); + return this; + } + public EnumTest.Builder outerEnum(JsonNullable outerEnum) { + this.instance.outerEnum = outerEnum; + return this; + } + public EnumTest.Builder outerEnumInteger(OuterEnumInteger outerEnumInteger) { + this.instance.outerEnumInteger = outerEnumInteger; + return this; + } + public EnumTest.Builder outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.instance.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + public EnumTest.Builder outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.instance.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + + /** + * returns a built EnumTest instance. + * + * The builder is not reusable. + */ + public EnumTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static EnumTest.Builder builder() { + return new EnumTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public EnumTest.Builder toBuilder() { + return new EnumTest.Builder() + .enumString(getEnumString()) + .enumStringRequired(getEnumStringRequired()) + .enumInteger(getEnumInteger()) + .enumNumber(getEnumNumber()) + .outerEnum(getOuterEnum()) + .outerEnumInteger(getOuterEnumInteger()) + .outerEnumDefaultValue(getOuterEnumDefaultValue()) + .outerEnumIntegerDefaultValue(getOuterEnumIntegerDefaultValue()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java index 45ff11851c97..4af66beca82e 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java @@ -150,5 +150,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private FakeBigDecimalMap200Response instance; + + public Builder() { + this(new FakeBigDecimalMap200Response()); + } + + protected Builder(FakeBigDecimalMap200Response instance) { + this.instance = instance; + } + + public FakeBigDecimalMap200Response.Builder someId(BigDecimal someId) { + this.instance.someId = someId; + return this; + } + public FakeBigDecimalMap200Response.Builder someMap(Map someMap) { + this.instance.someMap = someMap; + return this; + } + + + /** + * returns a built FakeBigDecimalMap200Response instance. + * + * The builder is not reusable. + */ + public FakeBigDecimalMap200Response build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FakeBigDecimalMap200Response.Builder builder() { + return new FakeBigDecimalMap200Response.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FakeBigDecimalMap200Response.Builder toBuilder() { + return new FakeBigDecimalMap200Response.Builder() + .someId(getSomeId()) + .someMap(getSomeMap()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index aa09b8c4383d..544a958564b0 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -150,5 +150,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private FileSchemaTestClass instance; + + public Builder() { + this(new FileSchemaTestClass()); + } + + protected Builder(FileSchemaTestClass instance) { + this.instance = instance; + } + + public FileSchemaTestClass.Builder _file(ModelFile _file) { + this.instance._file = _file; + return this; + } + public FileSchemaTestClass.Builder files(List files) { + this.instance.files = files; + return this; + } + + + /** + * returns a built FileSchemaTestClass instance. + * + * The builder is not reusable. + */ + public FileSchemaTestClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FileSchemaTestClass.Builder builder() { + return new FileSchemaTestClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FileSchemaTestClass.Builder toBuilder() { + return new FileSchemaTestClass.Builder() + ._file(getFile()) + .files(getFiles()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Foo.java index 52baa4bbfd9e..fe2af3988ee6 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Foo.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Foo.java @@ -106,5 +106,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Foo instance; + + public Builder() { + this(new Foo()); + } + + protected Builder(Foo instance) { + this.instance = instance; + } + + public Foo.Builder bar(String bar) { + this.instance.bar = bar; + return this; + } + + + /** + * returns a built Foo instance. + * + * The builder is not reusable. + */ + public Foo build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Foo.Builder builder() { + return new Foo.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Foo.Builder toBuilder() { + return new Foo.Builder() + .bar(getBar()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java index 2b266cae697b..70a12d6c7e09 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -108,5 +108,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private FooGetDefaultResponse instance; + + public Builder() { + this(new FooGetDefaultResponse()); + } + + protected Builder(FooGetDefaultResponse instance) { + this.instance = instance; + } + + public FooGetDefaultResponse.Builder string(Foo string) { + this.instance.string = string; + return this; + } + + + /** + * returns a built FooGetDefaultResponse instance. + * + * The builder is not reusable. + */ + public FooGetDefaultResponse build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FooGetDefaultResponse.Builder builder() { + return new FooGetDefaultResponse.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FooGetDefaultResponse.Builder toBuilder() { + return new FooGetDefaultResponse.Builder() + .string(getString()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java index b1a8b4f26282..5ff76a8a9cc6 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java @@ -602,5 +602,134 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private FormatTest instance; + + public Builder() { + this(new FormatTest()); + } + + protected Builder(FormatTest instance) { + this.instance = instance; + } + + public FormatTest.Builder integer(Integer integer) { + this.instance.integer = integer; + return this; + } + public FormatTest.Builder int32(Integer int32) { + this.instance.int32 = int32; + return this; + } + public FormatTest.Builder int64(Long int64) { + this.instance.int64 = int64; + return this; + } + public FormatTest.Builder number(BigDecimal number) { + this.instance.number = number; + return this; + } + public FormatTest.Builder _float(Float _float) { + this.instance._float = _float; + return this; + } + public FormatTest.Builder _double(Double _double) { + this.instance._double = _double; + return this; + } + public FormatTest.Builder decimal(BigDecimal decimal) { + this.instance.decimal = decimal; + return this; + } + public FormatTest.Builder string(String string) { + this.instance.string = string; + return this; + } + public FormatTest.Builder _byte(byte[] _byte) { + this.instance._byte = _byte; + return this; + } + public FormatTest.Builder binary(File binary) { + this.instance.binary = binary; + return this; + } + public FormatTest.Builder date(LocalDate date) { + this.instance.date = date; + return this; + } + public FormatTest.Builder dateTime(OffsetDateTime dateTime) { + this.instance.dateTime = dateTime; + return this; + } + public FormatTest.Builder uuid(UUID uuid) { + this.instance.uuid = uuid; + return this; + } + public FormatTest.Builder password(String password) { + this.instance.password = password; + return this; + } + public FormatTest.Builder patternWithDigits(String patternWithDigits) { + this.instance.patternWithDigits = patternWithDigits; + return this; + } + public FormatTest.Builder patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.instance.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return this; + } + + + /** + * returns a built FormatTest instance. + * + * The builder is not reusable. + */ + public FormatTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FormatTest.Builder builder() { + return new FormatTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FormatTest.Builder toBuilder() { + return new FormatTest.Builder() + .integer(getInteger()) + .int32(getInt32()) + .int64(getInt64()) + .number(getNumber()) + ._float(getFloat()) + ._double(getDouble()) + .decimal(getDecimal()) + .string(getString()) + ._byte(getByte()) + .binary(getBinary()) + .date(getDate()) + .dateTime(getDateTime()) + .uuid(getUuid()) + .password(getPassword()) + .patternWithDigits(getPatternWithDigits()) + .patternWithDigitsAndDelimiter(getPatternWithDigitsAndDelimiter()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 382c30d1bb73..2814acc80620 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -121,5 +121,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private HasOnlyReadOnly instance; + + public Builder() { + this(new HasOnlyReadOnly()); + } + + protected Builder(HasOnlyReadOnly instance) { + this.instance = instance; + } + + public HasOnlyReadOnly.Builder bar(String bar) { + this.instance.bar = bar; + return this; + } + public HasOnlyReadOnly.Builder foo(String foo) { + this.instance.foo = foo; + return this; + } + + + /** + * returns a built HasOnlyReadOnly instance. + * + * The builder is not reusable. + */ + public HasOnlyReadOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static HasOnlyReadOnly.Builder builder() { + return new HasOnlyReadOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public HasOnlyReadOnly.Builder toBuilder() { + return new HasOnlyReadOnly.Builder() + .bar(getBar()) + .foo(getFoo()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HealthCheckResult.java index 9047d758d174..719dcb90370b 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HealthCheckResult.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -129,5 +129,63 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private HealthCheckResult instance; + + public Builder() { + this(new HealthCheckResult()); + } + + protected Builder(HealthCheckResult instance) { + this.instance = instance; + } + + public HealthCheckResult.Builder nullableMessage(String nullableMessage) { + this.instance.nullableMessage = JsonNullable.of(nullableMessage); + return this; + } + public HealthCheckResult.Builder nullableMessage(JsonNullable nullableMessage) { + this.instance.nullableMessage = nullableMessage; + return this; + } + + + /** + * returns a built HealthCheckResult instance. + * + * The builder is not reusable. + */ + public HealthCheckResult build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static HealthCheckResult.Builder builder() { + return new HealthCheckResult.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public HealthCheckResult.Builder toBuilder() { + return new HealthCheckResult.Builder() + .nullableMessage(getNullableMessage()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java index 1520c3cb11f6..32c537537138 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java @@ -271,5 +271,74 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private MapTest instance; + + public Builder() { + this(new MapTest()); + } + + protected Builder(MapTest instance) { + this.instance = instance; + } + + public MapTest.Builder mapMapOfString(Map> mapMapOfString) { + this.instance.mapMapOfString = mapMapOfString; + return this; + } + public MapTest.Builder mapOfEnumString(Map mapOfEnumString) { + this.instance.mapOfEnumString = mapOfEnumString; + return this; + } + public MapTest.Builder directMap(Map directMap) { + this.instance.directMap = directMap; + return this; + } + public MapTest.Builder indirectMap(Map indirectMap) { + this.instance.indirectMap = indirectMap; + return this; + } + + + /** + * returns a built MapTest instance. + * + * The builder is not reusable. + */ + public MapTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static MapTest.Builder builder() { + return new MapTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public MapTest.Builder toBuilder() { + return new MapTest.Builder() + .mapMapOfString(getMapMapOfString()) + .mapOfEnumString(getMapOfEnumString()) + .directMap(getDirectMap()) + .indirectMap(getIndirectMap()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 2b0ba18327b1..effd02165bdf 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -183,5 +183,69 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private MixedPropertiesAndAdditionalPropertiesClass instance; + + public Builder() { + this(new MixedPropertiesAndAdditionalPropertiesClass()); + } + + protected Builder(MixedPropertiesAndAdditionalPropertiesClass instance) { + this.instance = instance; + } + + public MixedPropertiesAndAdditionalPropertiesClass.Builder uuid(UUID uuid) { + this.instance.uuid = uuid; + return this; + } + public MixedPropertiesAndAdditionalPropertiesClass.Builder dateTime(OffsetDateTime dateTime) { + this.instance.dateTime = dateTime; + return this; + } + public MixedPropertiesAndAdditionalPropertiesClass.Builder map(Map map) { + this.instance.map = map; + return this; + } + + + /** + * returns a built MixedPropertiesAndAdditionalPropertiesClass instance. + * + * The builder is not reusable. + */ + public MixedPropertiesAndAdditionalPropertiesClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static MixedPropertiesAndAdditionalPropertiesClass.Builder builder() { + return new MixedPropertiesAndAdditionalPropertiesClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public MixedPropertiesAndAdditionalPropertiesClass.Builder toBuilder() { + return new MixedPropertiesAndAdditionalPropertiesClass.Builder() + .uuid(getUuid()) + .dateTime(getDateTime()) + .map(getMap()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java index a514d303f208..d2b87a8bd041 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java @@ -139,5 +139,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Model200Response instance; + + public Builder() { + this(new Model200Response()); + } + + protected Builder(Model200Response instance) { + this.instance = instance; + } + + public Model200Response.Builder name(Integer name) { + this.instance.name = name; + return this; + } + public Model200Response.Builder propertyClass(String propertyClass) { + this.instance.propertyClass = propertyClass; + return this; + } + + + /** + * returns a built Model200Response instance. + * + * The builder is not reusable. + */ + public Model200Response build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Model200Response.Builder builder() { + return new Model200Response.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Model200Response.Builder toBuilder() { + return new Model200Response.Builder() + .name(getName()) + .propertyClass(getPropertyClass()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 94bb9257d593..1c4a06aac6e3 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -171,5 +171,69 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ModelApiResponse instance; + + public Builder() { + this(new ModelApiResponse()); + } + + protected Builder(ModelApiResponse instance) { + this.instance = instance; + } + + public ModelApiResponse.Builder code(Integer code) { + this.instance.code = code; + return this; + } + public ModelApiResponse.Builder type(String type) { + this.instance.type = type; + return this; + } + public ModelApiResponse.Builder message(String message) { + this.instance.message = message; + return this; + } + + + /** + * returns a built ModelApiResponse instance. + * + * The builder is not reusable. + */ + public ModelApiResponse build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ModelApiResponse.Builder builder() { + return new ModelApiResponse.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelApiResponse.Builder toBuilder() { + return new ModelApiResponse.Builder() + .code(getCode()) + .type(getType()) + .message(getMessage()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelFile.java index 8bb3ebde92f6..5a883db176f1 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelFile.java @@ -107,5 +107,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ModelFile instance; + + public Builder() { + this(new ModelFile()); + } + + protected Builder(ModelFile instance) { + this.instance = instance; + } + + public ModelFile.Builder sourceURI(String sourceURI) { + this.instance.sourceURI = sourceURI; + return this; + } + + + /** + * returns a built ModelFile instance. + * + * The builder is not reusable. + */ + public ModelFile build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ModelFile.Builder builder() { + return new ModelFile.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelFile.Builder toBuilder() { + return new ModelFile.Builder() + .sourceURI(getSourceURI()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelList.java index 1793d6b4eb34..18cb020faf5b 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelList.java @@ -107,5 +107,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ModelList instance; + + public Builder() { + this(new ModelList()); + } + + protected Builder(ModelList instance) { + this.instance = instance; + } + + public ModelList.Builder _123list(String _123list) { + this.instance._123list = _123list; + return this; + } + + + /** + * returns a built ModelList instance. + * + * The builder is not reusable. + */ + public ModelList build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ModelList.Builder builder() { + return new ModelList.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelList.Builder toBuilder() { + return new ModelList.Builder() + ._123list(get123list()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java index 4d9c567ff4ff..94b36fa79f6b 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -107,5 +107,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ModelReturn instance; + + public Builder() { + this(new ModelReturn()); + } + + protected Builder(ModelReturn instance) { + this.instance = instance; + } + + public ModelReturn.Builder _return(Integer _return) { + this.instance._return = _return; + return this; + } + + + /** + * returns a built ModelReturn instance. + * + * The builder is not reusable. + */ + public ModelReturn build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ModelReturn.Builder builder() { + return new ModelReturn.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelReturn.Builder toBuilder() { + return new ModelReturn.Builder() + ._return(getReturn()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java index db440c74d54f..eb859086d4b9 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java @@ -192,5 +192,74 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Name instance; + + public Builder() { + this(new Name()); + } + + protected Builder(Name instance) { + this.instance = instance; + } + + public Name.Builder name(Integer name) { + this.instance.name = name; + return this; + } + public Name.Builder snakeCase(Integer snakeCase) { + this.instance.snakeCase = snakeCase; + return this; + } + public Name.Builder property(String property) { + this.instance.property = property; + return this; + } + public Name.Builder _123number(Integer _123number) { + this.instance._123number = _123number; + return this; + } + + + /** + * returns a built Name instance. + * + * The builder is not reusable. + */ + public Name build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Name.Builder builder() { + return new Name.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Name.Builder toBuilder() { + return new Name.Builder() + .name(getName()) + .snakeCase(getSnakeCase()) + .property(getProperty()) + ._123number(get123number()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NullableClass.java index 6078cbcdff51..b76b998b4dd7 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NullableClass.java @@ -629,5 +629,154 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private NullableClass instance; + + public Builder() { + this(new NullableClass()); + } + + protected Builder(NullableClass instance) { + this.instance = instance; + } + + public NullableClass.Builder integerProp(Integer integerProp) { + this.instance.integerProp = JsonNullable.of(integerProp); + return this; + } + public NullableClass.Builder integerProp(JsonNullable integerProp) { + this.instance.integerProp = integerProp; + return this; + } + public NullableClass.Builder numberProp(BigDecimal numberProp) { + this.instance.numberProp = JsonNullable.of(numberProp); + return this; + } + public NullableClass.Builder numberProp(JsonNullable numberProp) { + this.instance.numberProp = numberProp; + return this; + } + public NullableClass.Builder booleanProp(Boolean booleanProp) { + this.instance.booleanProp = JsonNullable.of(booleanProp); + return this; + } + public NullableClass.Builder booleanProp(JsonNullable booleanProp) { + this.instance.booleanProp = booleanProp; + return this; + } + public NullableClass.Builder stringProp(String stringProp) { + this.instance.stringProp = JsonNullable.of(stringProp); + return this; + } + public NullableClass.Builder stringProp(JsonNullable stringProp) { + this.instance.stringProp = stringProp; + return this; + } + public NullableClass.Builder dateProp(LocalDate dateProp) { + this.instance.dateProp = JsonNullable.of(dateProp); + return this; + } + public NullableClass.Builder dateProp(JsonNullable dateProp) { + this.instance.dateProp = dateProp; + return this; + } + public NullableClass.Builder datetimeProp(OffsetDateTime datetimeProp) { + this.instance.datetimeProp = JsonNullable.of(datetimeProp); + return this; + } + public NullableClass.Builder datetimeProp(JsonNullable datetimeProp) { + this.instance.datetimeProp = datetimeProp; + return this; + } + public NullableClass.Builder arrayNullableProp(List arrayNullableProp) { + this.instance.arrayNullableProp = JsonNullable.>of(arrayNullableProp); + return this; + } + public NullableClass.Builder arrayNullableProp(JsonNullable> arrayNullableProp) { + this.instance.arrayNullableProp = arrayNullableProp; + return this; + } + public NullableClass.Builder arrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.instance.arrayAndItemsNullableProp = JsonNullable.>of(arrayAndItemsNullableProp); + return this; + } + public NullableClass.Builder arrayAndItemsNullableProp(JsonNullable> arrayAndItemsNullableProp) { + this.instance.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + public NullableClass.Builder arrayItemsNullable(List arrayItemsNullable) { + this.instance.arrayItemsNullable = arrayItemsNullable; + return this; + } + public NullableClass.Builder objectNullableProp(Map objectNullableProp) { + this.instance.objectNullableProp = JsonNullable.>of(objectNullableProp); + return this; + } + public NullableClass.Builder objectNullableProp(JsonNullable> objectNullableProp) { + this.instance.objectNullableProp = objectNullableProp; + return this; + } + public NullableClass.Builder objectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.instance.objectAndItemsNullableProp = JsonNullable.>of(objectAndItemsNullableProp); + return this; + } + public NullableClass.Builder objectAndItemsNullableProp(JsonNullable> objectAndItemsNullableProp) { + this.instance.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + public NullableClass.Builder objectItemsNullable(Map objectItemsNullable) { + this.instance.objectItemsNullable = objectItemsNullable; + return this; + } + + + /** + * returns a built NullableClass instance. + * + * The builder is not reusable. + */ + public NullableClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static NullableClass.Builder builder() { + return new NullableClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public NullableClass.Builder toBuilder() { + return new NullableClass.Builder() + .integerProp(getIntegerProp()) + .numberProp(getNumberProp()) + .booleanProp(getBooleanProp()) + .stringProp(getStringProp()) + .dateProp(getDateProp()) + .datetimeProp(getDatetimeProp()) + .arrayNullableProp(getArrayNullableProp()) + .arrayAndItemsNullableProp(getArrayAndItemsNullableProp()) + .arrayItemsNullable(getArrayItemsNullable()) + .objectNullableProp(getObjectNullableProp()) + .objectAndItemsNullableProp(getObjectAndItemsNullableProp()) + .objectItemsNullable(getObjectItemsNullable()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java index 61f902621259..2e3e959e3fb2 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -107,5 +107,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private NumberOnly instance; + + public Builder() { + this(new NumberOnly()); + } + + protected Builder(NumberOnly instance) { + this.instance = instance; + } + + public NumberOnly.Builder justNumber(BigDecimal justNumber) { + this.instance.justNumber = justNumber; + return this; + } + + + /** + * returns a built NumberOnly instance. + * + * The builder is not reusable. + */ + public NumberOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static NumberOnly.Builder builder() { + return new NumberOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public NumberOnly.Builder toBuilder() { + return new NumberOnly.Builder() + .justNumber(getJustNumber()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java index 1d59c1e8691a..d54efdc635b9 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -221,5 +221,74 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ObjectWithDeprecatedFields instance; + + public Builder() { + this(new ObjectWithDeprecatedFields()); + } + + protected Builder(ObjectWithDeprecatedFields instance) { + this.instance = instance; + } + + public ObjectWithDeprecatedFields.Builder uuid(String uuid) { + this.instance.uuid = uuid; + return this; + } + public ObjectWithDeprecatedFields.Builder id(BigDecimal id) { + this.instance.id = id; + return this; + } + public ObjectWithDeprecatedFields.Builder deprecatedRef(DeprecatedObject deprecatedRef) { + this.instance.deprecatedRef = deprecatedRef; + return this; + } + public ObjectWithDeprecatedFields.Builder bars(List bars) { + this.instance.bars = bars; + return this; + } + + + /** + * returns a built ObjectWithDeprecatedFields instance. + * + * The builder is not reusable. + */ + public ObjectWithDeprecatedFields build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ObjectWithDeprecatedFields.Builder builder() { + return new ObjectWithDeprecatedFields.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ObjectWithDeprecatedFields.Builder toBuilder() { + return new ObjectWithDeprecatedFields.Builder() + .uuid(getUuid()) + .id(getId()) + .deprecatedRef(getDeprecatedRef()) + .bars(getBars()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java index f09c51a69205..f2b329fb7f6e 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java @@ -304,5 +304,84 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Order instance; + + public Builder() { + this(new Order()); + } + + protected Builder(Order instance) { + this.instance = instance; + } + + public Order.Builder id(Long id) { + this.instance.id = id; + return this; + } + public Order.Builder petId(Long petId) { + this.instance.petId = petId; + return this; + } + public Order.Builder quantity(Integer quantity) { + this.instance.quantity = quantity; + return this; + } + public Order.Builder shipDate(OffsetDateTime shipDate) { + this.instance.shipDate = shipDate; + return this; + } + public Order.Builder status(StatusEnum status) { + this.instance.status = status; + return this; + } + public Order.Builder complete(Boolean complete) { + this.instance.complete = complete; + return this; + } + + + /** + * returns a built Order instance. + * + * The builder is not reusable. + */ + public Order build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Order.Builder builder() { + return new Order.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Order.Builder toBuilder() { + return new Order.Builder() + .id(getId()) + .petId(getPetId()) + .quantity(getQuantity()) + .shipDate(getShipDate()) + .status(getStatus()) + .complete(getComplete()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java index 200d1214cd18..1ec45f738551 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -171,5 +171,69 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private OuterComposite instance; + + public Builder() { + this(new OuterComposite()); + } + + protected Builder(OuterComposite instance) { + this.instance = instance; + } + + public OuterComposite.Builder myNumber(BigDecimal myNumber) { + this.instance.myNumber = myNumber; + return this; + } + public OuterComposite.Builder myString(String myString) { + this.instance.myString = myString; + return this; + } + public OuterComposite.Builder myBoolean(Boolean myBoolean) { + this.instance.myBoolean = myBoolean; + return this; + } + + + /** + * returns a built OuterComposite instance. + * + * The builder is not reusable. + */ + public OuterComposite build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static OuterComposite.Builder builder() { + return new OuterComposite.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public OuterComposite.Builder toBuilder() { + return new OuterComposite.Builder() + .myNumber(getMyNumber()) + .myString(getMyString()) + .myBoolean(getMyBoolean()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java index 1e2b30c0fddb..215c7847f05e 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java @@ -107,5 +107,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private OuterObjectWithEnumProperty instance; + + public Builder() { + this(new OuterObjectWithEnumProperty()); + } + + protected Builder(OuterObjectWithEnumProperty instance) { + this.instance = instance; + } + + public OuterObjectWithEnumProperty.Builder value(OuterEnumInteger value) { + this.instance.value = value; + return this; + } + + + /** + * returns a built OuterObjectWithEnumProperty instance. + * + * The builder is not reusable. + */ + public OuterObjectWithEnumProperty build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static OuterObjectWithEnumProperty.Builder builder() { + return new OuterObjectWithEnumProperty.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public OuterObjectWithEnumProperty.Builder toBuilder() { + return new OuterObjectWithEnumProperty.Builder() + .value(getValue()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ParentWithNullable.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ParentWithNullable.java index a16519b20237..4e174fd76803 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ParentWithNullable.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ParentWithNullable.java @@ -206,5 +206,68 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ParentWithNullable instance; + + public Builder() { + this(new ParentWithNullable()); + } + + protected Builder(ParentWithNullable instance) { + this.instance = instance; + } + + public ParentWithNullable.Builder type(TypeEnum type) { + this.instance.type = type; + return this; + } + public ParentWithNullable.Builder nullableProperty(String nullableProperty) { + this.instance.nullableProperty = JsonNullable.of(nullableProperty); + return this; + } + public ParentWithNullable.Builder nullableProperty(JsonNullable nullableProperty) { + this.instance.nullableProperty = nullableProperty; + return this; + } + + + /** + * returns a built ParentWithNullable instance. + * + * The builder is not reusable. + */ + public ParentWithNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ParentWithNullable.Builder builder() { + return new ParentWithNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ParentWithNullable.Builder toBuilder() { + return new ParentWithNullable.Builder() + .type(getType()) + .nullableProperty(getNullableProperty()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java index fbf2acd86286..45cae8bbb708 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java @@ -328,5 +328,84 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Pet instance; + + public Builder() { + this(new Pet()); + } + + protected Builder(Pet instance) { + this.instance = instance; + } + + public Pet.Builder id(Long id) { + this.instance.id = id; + return this; + } + public Pet.Builder category(Category category) { + this.instance.category = category; + return this; + } + public Pet.Builder name(String name) { + this.instance.name = name; + return this; + } + public Pet.Builder photoUrls(Set photoUrls) { + this.instance.photoUrls = photoUrls; + return this; + } + public Pet.Builder tags(List tags) { + this.instance.tags = tags; + return this; + } + public Pet.Builder status(StatusEnum status) { + this.instance.status = status; + return this; + } + + + /** + * returns a built Pet instance. + * + * The builder is not reusable. + */ + public Pet build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Pet.Builder builder() { + return new Pet.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Pet.Builder toBuilder() { + return new Pet.Builder() + .id(getId()) + .category(getCategory()) + .name(getName()) + .photoUrls(getPhotoUrls()) + .tags(getTags()) + .status(getStatus()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 1de9a07e2d71..82fb4f08242e 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -137,5 +137,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private ReadOnlyFirst instance; + + public Builder() { + this(new ReadOnlyFirst()); + } + + protected Builder(ReadOnlyFirst instance) { + this.instance = instance; + } + + public ReadOnlyFirst.Builder bar(String bar) { + this.instance.bar = bar; + return this; + } + public ReadOnlyFirst.Builder baz(String baz) { + this.instance.baz = baz; + return this; + } + + + /** + * returns a built ReadOnlyFirst instance. + * + * The builder is not reusable. + */ + public ReadOnlyFirst build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ReadOnlyFirst.Builder builder() { + return new ReadOnlyFirst.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ReadOnlyFirst.Builder toBuilder() { + return new ReadOnlyFirst.Builder() + .bar(getBar()) + .baz(getBaz()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java index 7de114855b65..2336813d7b36 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -107,5 +107,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private SpecialModelName instance; + + public Builder() { + this(new SpecialModelName()); + } + + protected Builder(SpecialModelName instance) { + this.instance = instance; + } + + public SpecialModelName.Builder $specialPropertyName(Long $specialPropertyName) { + this.instance.$specialPropertyName = $specialPropertyName; + return this; + } + + + /** + * returns a built SpecialModelName instance. + * + * The builder is not reusable. + */ + public SpecialModelName build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static SpecialModelName.Builder builder() { + return new SpecialModelName.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public SpecialModelName.Builder toBuilder() { + return new SpecialModelName.Builder() + .$specialPropertyName(get$SpecialPropertyName()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java index 42a0ef4b78ad..e67b34efd42d 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java @@ -138,5 +138,64 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private Tag instance; + + public Builder() { + this(new Tag()); + } + + protected Builder(Tag instance) { + this.instance = instance; + } + + public Tag.Builder id(Long id) { + this.instance.id = id; + return this; + } + public Tag.Builder name(String name) { + this.instance.name = name; + return this; + } + + + /** + * returns a built Tag instance. + * + * The builder is not reusable. + */ + public Tag build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static Tag.Builder builder() { + return new Tag.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Tag.Builder toBuilder() { + return new Tag.Builder() + .id(getId()) + .name(getName()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java index a7e74f88302a..4fb7a166add7 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -113,5 +113,59 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private TestInlineFreeformAdditionalPropertiesRequest instance; + + public Builder() { + this(new TestInlineFreeformAdditionalPropertiesRequest()); + } + + protected Builder(TestInlineFreeformAdditionalPropertiesRequest instance) { + this.instance = instance; + } + + public TestInlineFreeformAdditionalPropertiesRequest.Builder someProperty(String someProperty) { + this.instance.someProperty = someProperty; + return this; + } + + + /** + * returns a built TestInlineFreeformAdditionalPropertiesRequest instance. + * + * The builder is not reusable. + */ + public TestInlineFreeformAdditionalPropertiesRequest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static TestInlineFreeformAdditionalPropertiesRequest.Builder builder() { + return new TestInlineFreeformAdditionalPropertiesRequest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public TestInlineFreeformAdditionalPropertiesRequest.Builder toBuilder() { + return new TestInlineFreeformAdditionalPropertiesRequest.Builder() + .someProperty(getSomeProperty()); + } + + } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java index fa0855b56ee0..bccb32b21329 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java @@ -330,5 +330,94 @@ private String toIndentedString(Object o) { return o.toString().replace("\n", "\n "); } + public static class Builder { + + private User instance; + + public Builder() { + this(new User()); + } + + protected Builder(User instance) { + this.instance = instance; + } + + public User.Builder id(Long id) { + this.instance.id = id; + return this; + } + public User.Builder username(String username) { + this.instance.username = username; + return this; + } + public User.Builder firstName(String firstName) { + this.instance.firstName = firstName; + return this; + } + public User.Builder lastName(String lastName) { + this.instance.lastName = lastName; + return this; + } + public User.Builder email(String email) { + this.instance.email = email; + return this; + } + public User.Builder password(String password) { + this.instance.password = password; + return this; + } + public User.Builder phone(String phone) { + this.instance.phone = phone; + return this; + } + public User.Builder userStatus(Integer userStatus) { + this.instance.userStatus = userStatus; + return this; + } + + + /** + * returns a built User instance. + * + * The builder is not reusable. + */ + public User build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static User.Builder builder() { + return new User.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public User.Builder toBuilder() { + return new User.Builder() + .id(getId()) + .username(getUsername()) + .firstName(getFirstName()) + .lastName(getLastName()) + .email(getEmail()) + .password(getPassword()) + .phone(getPhone()) + .userStatus(getUserStatus()); + } + + } diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/AnimalDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/AnimalDto.java index 44e5b8fa3028..d36702d7ff79 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/AnimalDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/AnimalDto.java @@ -38,6 +38,10 @@ public class AnimalDto { private String color = "red"; + public AnimalDto() { + super(); + } + public AnimalDto className(String className) { this.className = className; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/BigCatDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/BigCatDto.java index f553a91984ab..d6135166c01b 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/BigCatDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/BigCatDto.java @@ -68,6 +68,10 @@ public static KindEnum fromValue(String value) { private KindEnum kind; + public BigCatDto() { + super(); + } + public BigCatDto kind(KindEnum kind) { this.kind = kind; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CatDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CatDto.java index 0e30926c5888..3995db6ffc3c 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CatDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CatDto.java @@ -35,6 +35,10 @@ public class CatDto extends AnimalDto { private Boolean declawed; + public CatDto() { + super(); + } + public CatDto declawed(Boolean declawed) { this.declawed = declawed; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CategoryDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CategoryDto.java index 02ce02a379f3..89ff9fa19fb2 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CategoryDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CategoryDto.java @@ -25,6 +25,10 @@ public class CategoryDto { private String name = "default-name"; + public CategoryDto() { + super(); + } + public CategoryDto id(Long id) { this.id = id; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 70196eb63781..ef3f88318504 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -38,6 +38,10 @@ public class ContainerDefaultValueDto { private JsonNullable> nullableArrayWithDefault = JsonNullable.>undefined(); + public ContainerDefaultValueDto() { + super(); + } + public ContainerDefaultValueDto nullableArray(List nullableArray) { this.nullableArray = JsonNullable.of(nullableArray); return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/DogDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/DogDto.java index 748d5c85e1e4..2908d6ab58b5 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/DogDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/DogDto.java @@ -28,6 +28,10 @@ public class DogDto extends AnimalDto { private String breed; + public DogDto() { + super(); + } + public DogDto breed(String breed) { this.breed = breed; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/EnumTestDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/EnumTestDto.java index 8e73ea12f51c..886cf55a8d57 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/EnumTestDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/EnumTestDto.java @@ -177,6 +177,10 @@ public static EnumNumberEnum fromValue(Double value) { private OuterEnumDto outerEnum; + public EnumTestDto() { + super(); + } + public EnumTestDto enumString(EnumStringEnum enumString) { this.enumString = enumString; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/FormatTestDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/FormatTestDto.java index 2692c75642cb..4b98f966436a 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/FormatTestDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/FormatTestDto.java @@ -57,6 +57,10 @@ public class FormatTestDto { private BigDecimal bigDecimal; + public FormatTestDto() { + super(); + } + public FormatTestDto integer(Integer integer) { this.integer = integer; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/NameDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/NameDto.java index 8a6c2223d55c..d29684ae3761 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/NameDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/NameDto.java @@ -29,6 +29,10 @@ public class NameDto { private Integer _123number; + public NameDto() { + super(); + } + public NameDto name(Integer name) { this.name = name; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/PetDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/PetDto.java index 4726e9d2c1b4..214d5c957972 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/PetDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/PetDto.java @@ -82,6 +82,10 @@ public static StatusEnum fromValue(String value) { @Deprecated private StatusEnum status; + public PetDto() { + super(); + } + public PetDto id(Long id) { this.id = id; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderDefaultDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderDefaultDto.java index bd2d7912f73c..34e89c82c024 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderDefaultDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderDefaultDto.java @@ -36,6 +36,10 @@ public class TypeHolderDefaultDto { private List arrayItem = new ArrayList<>(Arrays.asList(0, 1, 2, 3)); + public TypeHolderDefaultDto() { + super(); + } + public TypeHolderDefaultDto stringItem(String stringItem) { this.stringItem = stringItem; return this; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderExampleDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderExampleDto.java index 8d13be7fb34b..5157899f0a70 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderExampleDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/TypeHolderExampleDto.java @@ -38,6 +38,10 @@ public class TypeHolderExampleDto { private List arrayItem = new ArrayList<>(); + public TypeHolderExampleDto() { + super(); + } + public TypeHolderExampleDto stringItem(String stringItem) { this.stringItem = stringItem; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Animal.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Animal.java index 068799959339..b3e28e4f5fe9 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Animal.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Animal.java @@ -39,6 +39,10 @@ public class Animal { private String color = "red"; + public Animal() { + super(); + } + public Animal className(String className) { this.className = className; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/BigCat.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/BigCat.java index c54b405645a8..726eaf23ad98 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/BigCat.java @@ -68,6 +68,10 @@ public static KindEnum fromValue(String value) { private KindEnum kind; + public BigCat() { + super(); + } + public BigCat kind(KindEnum kind) { this.kind = kind; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Cat.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Cat.java index 8366e7149256..55794fb00397 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Cat.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Cat.java @@ -36,6 +36,10 @@ public class Cat extends Animal { private Boolean declawed; + public Cat() { + super(); + } + public Cat declawed(Boolean declawed) { this.declawed = declawed; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Category.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Category.java index 3fa679c6bbc7..2b9f60ef4823 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Category.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Category.java @@ -25,6 +25,10 @@ public class Category { private String name = "default-name"; + public Category() { + super(); + } + public Category id(Long id) { this.id = id; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java index bb314c27287e..e013f78828ed 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -38,6 +38,10 @@ public class ContainerDefaultValue { @Valid private JsonNullable> nullableArrayWithDefault = JsonNullable.>undefined(); + public ContainerDefaultValue() { + super(); + } + public ContainerDefaultValue nullableArray(List nullableArray) { this.nullableArray = JsonNullable.of(nullableArray); return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Dog.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Dog.java index e7777688a7c4..d005b69e4fa8 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Dog.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Dog.java @@ -28,6 +28,10 @@ public class Dog extends Animal { private String breed; + public Dog() { + super(); + } + public Dog breed(String breed) { this.breed = breed; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/EnumTest.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/EnumTest.java index 1841d6bb31d8..1c16a0555aee 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/EnumTest.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/EnumTest.java @@ -179,6 +179,10 @@ public static EnumNumberEnum fromValue(Double value) { private OuterEnum outerEnum; + public EnumTest() { + super(); + } + public EnumTest enumString(EnumStringEnum enumString) { this.enumString = enumString; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/FormatTest.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/FormatTest.java index 9b8b3be2de49..50746ecdd616 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/FormatTest.java @@ -59,6 +59,10 @@ public class FormatTest { private BigDecimal bigDecimal; + public FormatTest() { + super(); + } + public FormatTest integer(Integer integer) { this.integer = integer; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Name.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Name.java index 946fb99c46b0..a21811357d10 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Name.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Name.java @@ -30,6 +30,10 @@ public class Name { private Integer _123number; + public Name() { + super(); + } + public Name name(Integer name) { this.name = name; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Pet.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Pet.java index 373403327baa..d76bebcb59ba 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Pet.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Pet.java @@ -82,6 +82,10 @@ public static StatusEnum fromValue(String value) { @Deprecated private StatusEnum status; + public Pet() { + super(); + } + public Pet id(Long id) { this.id = id; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderDefault.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderDefault.java index aa81da79d442..28e9d3857b1e 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderDefault.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderDefault.java @@ -36,6 +36,10 @@ public class TypeHolderDefault { @Valid private List arrayItem = new ArrayList<>(Arrays.asList(0, 1, 2, 3)); + public TypeHolderDefault() { + super(); + } + public TypeHolderDefault stringItem(String stringItem) { this.stringItem = stringItem; return this; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderExample.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderExample.java index 56a2b8a20dd5..1902ac76685a 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderExample.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/TypeHolderExample.java @@ -38,6 +38,10 @@ public class TypeHolderExample { @Valid private List arrayItem = new ArrayList<>(); + public TypeHolderExample() { + super(); + } + public TypeHolderExample stringItem(String stringItem) { this.stringItem = stringItem; return this; diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Addressable.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Addressable.java index 6721f36254d0..3fc30878a260 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Addressable.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Addressable.java @@ -104,5 +104,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Addressable instance; + + public Builder() { + this(new Addressable()); + } + + protected Builder(Addressable instance) { + this.instance = instance; + } + + protected Builder copyOf(Addressable value) { + this.instance.setHref(value.href); + this.instance.setId(value.id); + return this; + } + + public Addressable.Builder href(String href) { + this.instance.href(href); + return this; + } + + public Addressable.Builder id(String id) { + this.instance.id(id); + return this; + } + + /** + * returns a built Addressable instance. + * + * The builder is not reusable (NullPointerException) + */ + public Addressable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Addressable.Builder builder() { + return new Addressable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Addressable.Builder toBuilder() { + Addressable.Builder builder = new Addressable.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Apple.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Apple.java index 1fc5fa7895a6..00f1544d2601 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Apple.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Apple.java @@ -119,5 +119,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Apple instance; + + public Builder() { + this(new Apple()); + } + + protected Builder(Apple instance) { + this.instance = instance; + } + + protected Builder copyOf(Apple value) { + this.instance.setSeeds(value.seeds); + this.instance.setFruitType(value.fruitType); + return this; + } + + public Apple.Builder seeds(Integer seeds) { + this.instance.seeds(seeds); + return this; + } + + public Apple.Builder fruitType(FruitType fruitType) { + this.instance.fruitType(fruitType); + return this; + } + + /** + * returns a built Apple instance. + * + * The builder is not reusable (NullPointerException) + */ + public Apple build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Apple.Builder builder() { + return new Apple.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Apple.Builder toBuilder() { + Apple.Builder builder = new Apple.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Banana.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Banana.java index f6c34e740259..2887c8a47257 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Banana.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Banana.java @@ -119,5 +119,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Banana instance; + + public Builder() { + this(new Banana()); + } + + protected Builder(Banana instance) { + this.instance = instance; + } + + protected Builder copyOf(Banana value) { + this.instance.setLength(value.length); + this.instance.setFruitType(value.fruitType); + return this; + } + + public Banana.Builder length(Integer length) { + this.instance.length(length); + return this; + } + + public Banana.Builder fruitType(FruitType fruitType) { + this.instance.fruitType(fruitType); + return this; + } + + /** + * returns a built Banana instance. + * + * The builder is not reusable (NullPointerException) + */ + public Banana build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Banana.Builder builder() { + return new Banana.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Banana.Builder toBuilder() { + Banana.Builder builder = new Banana.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Bar.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Bar.java index c9306e8f7f09..519aa0635d16 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Bar.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Bar.java @@ -191,5 +191,108 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Entity.Builder { + + private Bar instance; + + public Builder() { + this(new Bar()); + } + + protected Builder(Bar instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(Bar value) { + super.copyOf(instance); + this.instance.setId(value.id); + this.instance.setBarPropA(value.barPropA); + this.instance.setFooPropB(value.fooPropB); + this.instance.setFoo(value.foo); + return this; + } + + public Bar.Builder id(String id) { + this.instance.id(id); + return this; + } + + public Bar.Builder barPropA(String barPropA) { + this.instance.barPropA(barPropA); + return this; + } + + public Bar.Builder fooPropB(String fooPropB) { + this.instance.fooPropB(fooPropB); + return this; + } + + public Bar.Builder foo(FooRefOrValue foo) { + this.instance.foo(foo); + return this; + } + + @Override + public Bar.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public Bar.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public Bar.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public Bar.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built Bar instance. + * + * The builder is not reusable (NullPointerException) + */ + public Bar build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Bar.Builder builder() { + return new Bar.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Bar.Builder toBuilder() { + Bar.Builder builder = new Bar.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarCreate.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarCreate.java index 3ed13e8d924d..5b4b4fcebcd4 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarCreate.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarCreate.java @@ -173,5 +173,108 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Entity.Builder { + + private BarCreate instance; + + public Builder() { + this(new BarCreate()); + } + + protected Builder(BarCreate instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(BarCreate value) { + super.copyOf(instance); + this.instance.setBarPropA(value.barPropA); + this.instance.setFooPropB(value.fooPropB); + this.instance.setFoo(value.foo); + return this; + } + + public BarCreate.Builder barPropA(String barPropA) { + this.instance.barPropA(barPropA); + return this; + } + + public BarCreate.Builder fooPropB(String fooPropB) { + this.instance.fooPropB(fooPropB); + return this; + } + + public BarCreate.Builder foo(FooRefOrValue foo) { + this.instance.foo(foo); + return this; + } + + @Override + public BarCreate.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public BarCreate.Builder id(String id) { + this.instance.id(id); + return this; + } + + @Override + public BarCreate.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public BarCreate.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public BarCreate.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built BarCreate instance. + * + * The builder is not reusable (NullPointerException) + */ + public BarCreate build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static BarCreate.Builder builder() { + return new BarCreate.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public BarCreate.Builder toBuilder() { + BarCreate.Builder builder = new BarCreate.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.java index 20b4ce977104..86f8668df689 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.java @@ -107,5 +107,102 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends EntityRef.Builder { + + private BarRef instance; + + public Builder() { + this(new BarRef()); + } + + protected Builder(BarRef instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(BarRef value) { + super.copyOf(instance); + return this; + } + + @Override + public BarRef.Builder name(String name) { + this.instance.name(name); + return this; + } + + @Override + public BarRef.Builder atReferredType(String atReferredType) { + this.instance.atReferredType(atReferredType); + return this; + } + + @Override + public BarRef.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public BarRef.Builder id(String id) { + this.instance.id(id); + return this; + } + + @Override + public BarRef.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public BarRef.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public BarRef.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built BarRef instance. + * + * The builder is not reusable (NullPointerException) + */ + public BarRef build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static BarRef.Builder builder() { + return new BarRef.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public BarRef.Builder toBuilder() { + BarRef.Builder builder = new BarRef.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Entity.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Entity.java index c83c77d7642c..a407147435a7 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Entity.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Entity.java @@ -203,5 +203,87 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Entity instance; + + public Builder() { + this(new Entity()); + } + + protected Builder(Entity instance) { + this.instance = instance; + } + + protected Builder copyOf(Entity value) { + this.instance.setHref(value.href); + this.instance.setId(value.id); + this.instance.setAtSchemaLocation(value.atSchemaLocation); + this.instance.setAtBaseType(value.atBaseType); + this.instance.setAtType(value.atType); + return this; + } + + public Entity.Builder href(String href) { + this.instance.href(href); + return this; + } + + public Entity.Builder id(String id) { + this.instance.id(id); + return this; + } + + public Entity.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + public Entity.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + public Entity.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built Entity instance. + * + * The builder is not reusable (NullPointerException) + */ + public Entity build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Entity.Builder builder() { + return new Entity.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Entity.Builder toBuilder() { + Entity.Builder builder = new Entity.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/EntityRef.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/EntityRef.java index 64656344178a..a9a846bf8848 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/EntityRef.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/EntityRef.java @@ -248,5 +248,99 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private EntityRef instance; + + public Builder() { + this(new EntityRef()); + } + + protected Builder(EntityRef instance) { + this.instance = instance; + } + + protected Builder copyOf(EntityRef value) { + this.instance.setName(value.name); + this.instance.setAtReferredType(value.atReferredType); + this.instance.setHref(value.href); + this.instance.setId(value.id); + this.instance.setAtSchemaLocation(value.atSchemaLocation); + this.instance.setAtBaseType(value.atBaseType); + this.instance.setAtType(value.atType); + return this; + } + + public EntityRef.Builder name(String name) { + this.instance.name(name); + return this; + } + + public EntityRef.Builder atReferredType(String atReferredType) { + this.instance.atReferredType(atReferredType); + return this; + } + + public EntityRef.Builder href(String href) { + this.instance.href(href); + return this; + } + + public EntityRef.Builder id(String id) { + this.instance.id(id); + return this; + } + + public EntityRef.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + public EntityRef.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + public EntityRef.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built EntityRef instance. + * + * The builder is not reusable (NullPointerException) + */ + public EntityRef build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static EntityRef.Builder builder() { + return new EntityRef.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public EntityRef.Builder toBuilder() { + EntityRef.Builder builder = new EntityRef.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Extensible.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Extensible.java index e0ba3831c40c..15e64edf1295 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Extensible.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Extensible.java @@ -138,5 +138,75 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Extensible instance; + + public Builder() { + this(new Extensible()); + } + + protected Builder(Extensible instance) { + this.instance = instance; + } + + protected Builder copyOf(Extensible value) { + this.instance.setAtSchemaLocation(value.atSchemaLocation); + this.instance.setAtBaseType(value.atBaseType); + this.instance.setAtType(value.atType); + return this; + } + + public Extensible.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + public Extensible.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + public Extensible.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built Extensible instance. + * + * The builder is not reusable (NullPointerException) + */ + public Extensible build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Extensible.Builder builder() { + return new Extensible.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Extensible.Builder toBuilder() { + Extensible.Builder builder = new Extensible.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Foo.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Foo.java index ab68270f0579..ec7bc261702d 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Foo.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Foo.java @@ -146,5 +146,102 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Entity.Builder { + + private Foo instance; + + public Builder() { + this(new Foo()); + } + + protected Builder(Foo instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(Foo value) { + super.copyOf(instance); + this.instance.setFooPropA(value.fooPropA); + this.instance.setFooPropB(value.fooPropB); + return this; + } + + public Foo.Builder fooPropA(String fooPropA) { + this.instance.fooPropA(fooPropA); + return this; + } + + public Foo.Builder fooPropB(String fooPropB) { + this.instance.fooPropB(fooPropB); + return this; + } + + @Override + public Foo.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public Foo.Builder id(String id) { + this.instance.id(id); + return this; + } + + @Override + public Foo.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public Foo.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public Foo.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built Foo instance. + * + * The builder is not reusable (NullPointerException) + */ + public Foo build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Foo.Builder builder() { + return new Foo.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Foo.Builder toBuilder() { + Foo.Builder builder = new Foo.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/FooRef.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/FooRef.java index 2d4ba32fa7db..b87298b8a91b 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/FooRef.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/FooRef.java @@ -132,5 +132,108 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends EntityRef.Builder { + + private FooRef instance; + + public Builder() { + this(new FooRef()); + } + + protected Builder(FooRef instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(FooRef value) { + super.copyOf(instance); + this.instance.setFoorefPropA(value.foorefPropA); + return this; + } + + public FooRef.Builder foorefPropA(String foorefPropA) { + this.instance.foorefPropA(foorefPropA); + return this; + } + + @Override + public FooRef.Builder name(String name) { + this.instance.name(name); + return this; + } + + @Override + public FooRef.Builder atReferredType(String atReferredType) { + this.instance.atReferredType(atReferredType); + return this; + } + + @Override + public FooRef.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public FooRef.Builder id(String id) { + this.instance.id(id); + return this; + } + + @Override + public FooRef.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public FooRef.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public FooRef.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built FooRef instance. + * + * The builder is not reusable (NullPointerException) + */ + public FooRef build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static FooRef.Builder builder() { + return new FooRef.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FooRef.Builder toBuilder() { + FooRef.Builder builder = new FooRef.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pasta.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pasta.java index 7ae080eb44c7..e2b77398fabc 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pasta.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pasta.java @@ -122,5 +122,96 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Entity.Builder { + + private Pasta instance; + + public Builder() { + this(new Pasta()); + } + + protected Builder(Pasta instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(Pasta value) { + super.copyOf(instance); + this.instance.setVendor(value.vendor); + return this; + } + + public Pasta.Builder vendor(String vendor) { + this.instance.vendor(vendor); + return this; + } + + @Override + public Pasta.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public Pasta.Builder id(String id) { + this.instance.id(id); + return this; + } + + @Override + public Pasta.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public Pasta.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public Pasta.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built Pasta instance. + * + * The builder is not reusable (NullPointerException) + */ + public Pasta build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Pasta.Builder builder() { + return new Pasta.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Pasta.Builder toBuilder() { + Pasta.Builder builder = new Pasta.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pizza.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pizza.java index b179761095dc..eead5daa9efa 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pizza.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pizza.java @@ -131,5 +131,96 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Entity.Builder { + + private Pizza instance; + + public Builder() { + this(new Pizza()); + } + + protected Builder(Pizza instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(Pizza value) { + super.copyOf(instance); + this.instance.setPizzaSize(value.pizzaSize); + return this; + } + + public Pizza.Builder pizzaSize(BigDecimal pizzaSize) { + this.instance.pizzaSize(pizzaSize); + return this; + } + + @Override + public Pizza.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public Pizza.Builder id(String id) { + this.instance.id(id); + return this; + } + + @Override + public Pizza.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public Pizza.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public Pizza.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built Pizza instance. + * + * The builder is not reusable (NullPointerException) + */ + public Pizza build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Pizza.Builder builder() { + return new Pizza.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Pizza.Builder toBuilder() { + Pizza.Builder builder = new Pizza.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java index 18ced1b22e59..9225b04669e9 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java @@ -128,5 +128,102 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Pizza.Builder { + + private PizzaSpeziale instance; + + public Builder() { + this(new PizzaSpeziale()); + } + + protected Builder(PizzaSpeziale instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(PizzaSpeziale value) { + super.copyOf(instance); + this.instance.setToppings(value.toppings); + return this; + } + + public PizzaSpeziale.Builder toppings(String toppings) { + this.instance.toppings(toppings); + return this; + } + + @Override + public PizzaSpeziale.Builder pizzaSize(BigDecimal pizzaSize) { + this.instance.pizzaSize(pizzaSize); + return this; + } + + @Override + public PizzaSpeziale.Builder href(String href) { + this.instance.href(href); + return this; + } + + @Override + public PizzaSpeziale.Builder id(String id) { + this.instance.id(id); + return this; + } + + @Override + public PizzaSpeziale.Builder atSchemaLocation(String atSchemaLocation) { + this.instance.atSchemaLocation(atSchemaLocation); + return this; + } + + @Override + public PizzaSpeziale.Builder atBaseType(String atBaseType) { + this.instance.atBaseType(atBaseType); + return this; + } + + @Override + public PizzaSpeziale.Builder atType(String atType) { + this.instance.atType(atType); + return this; + } + + /** + * returns a built PizzaSpeziale instance. + * + * The builder is not reusable (NullPointerException) + */ + public PizzaSpeziale build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static PizzaSpeziale.Builder builder() { + return new PizzaSpeziale.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public PizzaSpeziale.Builder toBuilder() { + PizzaSpeziale.Builder builder = new PizzaSpeziale.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Category.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Category.java index 10be3581d48d..c75ecd5a1afc 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Category.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Category.java @@ -33,6 +33,10 @@ public class Category { private String name; + public Category() { + super(); + } + /** * Constructor with all args parameters */ @@ -121,5 +125,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Category instance; + + public Builder() { + this(new Category()); + } + + protected Builder(Category instance) { + this.instance = instance; + } + + protected Builder copyOf(Category value) { + this.instance.setId(value.id); + this.instance.setName(value.name); + return this; + } + + public Category.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Category.Builder name(String name) { + this.instance.name(name); + return this; + } + + /** + * returns a built Category instance. + * + * The builder is not reusable (NullPointerException) + */ + public Category build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Category.Builder builder() { + return new Category.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Category.Builder toBuilder() { + Category.Builder builder = new Category.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/ModelApiResponse.java index c791e9163df3..6d1560586aa3 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -37,6 +37,10 @@ public class ModelApiResponse { private String message; + public ModelApiResponse() { + super(); + } + /** * Constructor with all args parameters */ @@ -149,5 +153,75 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ModelApiResponse instance; + + public Builder() { + this(new ModelApiResponse()); + } + + protected Builder(ModelApiResponse instance) { + this.instance = instance; + } + + protected Builder copyOf(ModelApiResponse value) { + this.instance.setCode(value.code); + this.instance.setType(value.type); + this.instance.setMessage(value.message); + return this; + } + + public ModelApiResponse.Builder code(Integer code) { + this.instance.code(code); + return this; + } + + public ModelApiResponse.Builder type(String type) { + this.instance.type(type); + return this; + } + + public ModelApiResponse.Builder message(String message) { + this.instance.message(message); + return this; + } + + /** + * returns a built ModelApiResponse instance. + * + * The builder is not reusable (NullPointerException) + */ + public ModelApiResponse build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ModelApiResponse.Builder builder() { + return new ModelApiResponse.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelApiResponse.Builder toBuilder() { + ModelApiResponse.Builder builder = new ModelApiResponse.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Order.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Order.java index 2a4bd20e5b20..799499324756 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Order.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Order.java @@ -82,6 +82,10 @@ public static StatusEnum fromValue(String value) { private Boolean complete = false; + public Order() { + super(); + } + /** * Constructor with all args parameters */ @@ -266,5 +270,93 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Order instance; + + public Builder() { + this(new Order()); + } + + protected Builder(Order instance) { + this.instance = instance; + } + + protected Builder copyOf(Order value) { + this.instance.setId(value.id); + this.instance.setPetId(value.petId); + this.instance.setQuantity(value.quantity); + this.instance.setShipDate(value.shipDate); + this.instance.setStatus(value.status); + this.instance.setComplete(value.complete); + return this; + } + + public Order.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Order.Builder petId(Long petId) { + this.instance.petId(petId); + return this; + } + + public Order.Builder quantity(Integer quantity) { + this.instance.quantity(quantity); + return this; + } + + public Order.Builder shipDate(OffsetDateTime shipDate) { + this.instance.shipDate(shipDate); + return this; + } + + public Order.Builder status(StatusEnum status) { + this.instance.status(status); + return this; + } + + public Order.Builder complete(Boolean complete) { + this.instance.complete(complete); + return this; + } + + /** + * returns a built Order instance. + * + * The builder is not reusable (NullPointerException) + */ + public Order build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Order.Builder builder() { + return new Order.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Order.Builder toBuilder() { + Order.Builder builder = new Order.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Pet.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Pet.java index 911de2422fbb..73e9bbec8c9e 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Pet.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Pet.java @@ -305,5 +305,95 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Pet instance; + + public Builder() { + this(new Pet()); + } + + protected Builder(Pet instance) { + this.instance = instance; + } + + protected Builder copyOf(Pet value) { + this.instance.setId(value.id); + this.instance.setCategory(value.category); + this.instance.setName(value.name); + this.instance.setPhotoUrls(value.photoUrls); + this.instance.setTags(value.tags); + this.instance.setStatus(value.status); + return this; + } + + public Pet.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Pet.Builder category(Category category) { + this.instance.category(category); + return this; + } + + public Pet.Builder name(String name) { + this.instance.name(name); + return this; + } + + public Pet.Builder photoUrls(List photoUrls) { + this.instance.photoUrls(photoUrls); + return this; + } + + public Pet.Builder tags(List<@Valid Tag> tags) { + this.instance.tags(tags); + return this; + } + + @Deprecated + public Pet.Builder status(StatusEnum status) { + this.instance.status(status); + return this; + } + @Deprecated + + /** + * returns a built Pet instance. + * + * The builder is not reusable (NullPointerException) + */ + public Pet build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Pet.Builder builder() { + return new Pet.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Pet.Builder toBuilder() { + Pet.Builder builder = new Pet.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Tag.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Tag.java index 2124198f203f..dbd8c2e97cad 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Tag.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/Tag.java @@ -33,6 +33,10 @@ public class Tag { private String name; + public Tag() { + super(); + } + /** * Constructor with all args parameters */ @@ -121,5 +125,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Tag instance; + + public Builder() { + this(new Tag()); + } + + protected Builder(Tag instance) { + this.instance = instance; + } + + protected Builder copyOf(Tag value) { + this.instance.setId(value.id); + this.instance.setName(value.name); + return this; + } + + public Tag.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Tag.Builder name(String name) { + this.instance.name(name); + return this; + } + + /** + * returns a built Tag instance. + * + * The builder is not reusable (NullPointerException) + */ + public Tag build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Tag.Builder builder() { + return new Tag.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Tag.Builder toBuilder() { + Tag.Builder builder = new Tag.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/User.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/User.java index bc06bb7f2a89..0d3453e42ab1 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/User.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/model/User.java @@ -45,6 +45,10 @@ public class User { private Integer userStatus; + public User() { + super(); + } + /** * Constructor with all args parameters */ @@ -277,5 +281,105 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private User instance; + + public Builder() { + this(new User()); + } + + protected Builder(User instance) { + this.instance = instance; + } + + protected Builder copyOf(User value) { + this.instance.setId(value.id); + this.instance.setUsername(value.username); + this.instance.setFirstName(value.firstName); + this.instance.setLastName(value.lastName); + this.instance.setEmail(value.email); + this.instance.setPassword(value.password); + this.instance.setPhone(value.phone); + this.instance.setUserStatus(value.userStatus); + return this; + } + + public User.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public User.Builder username(String username) { + this.instance.username(username); + return this; + } + + public User.Builder firstName(String firstName) { + this.instance.firstName(firstName); + return this; + } + + public User.Builder lastName(String lastName) { + this.instance.lastName(lastName); + return this; + } + + public User.Builder email(String email) { + this.instance.email(email); + return this; + } + + public User.Builder password(String password) { + this.instance.password(password); + return this; + } + + public User.Builder phone(String phone) { + this.instance.phone(phone); + return this; + } + + public User.Builder userStatus(Integer userStatus) { + this.instance.userStatus(userStatus); + return this; + } + + /** + * returns a built User instance. + * + * The builder is not reusable (NullPointerException) + */ + public User build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static User.Builder builder() { + return new User.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public User.Builder toBuilder() { + User.Builder builder = new User.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java index c23b129b45e2..f1ba94d0ff19 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java @@ -28,6 +28,10 @@ public class AdditionalPropertiesAnyType { private String name; + public AdditionalPropertiesAnyType() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java index fc51276e7fe1..7bcba25e7ea5 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java @@ -29,6 +29,10 @@ public class AdditionalPropertiesArray { private String name; + public AdditionalPropertiesArray() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java index a66236a71e52..492427d7098a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -28,6 +28,10 @@ public class AdditionalPropertiesBoolean { private String name; + public AdditionalPropertiesBoolean() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index 621c373ed5d4..18ce5603da38 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -59,6 +59,10 @@ public class AdditionalPropertiesClass { private Object anytype3; + public AdditionalPropertiesClass() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java index 8a0b80d732f9..501fa16aeb68 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java @@ -28,6 +28,10 @@ public class AdditionalPropertiesInteger { private String name; + public AdditionalPropertiesInteger() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java index ec1fc685cb58..9c9bdc0af3dd 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java @@ -29,6 +29,10 @@ public class AdditionalPropertiesNumber { private String name; + public AdditionalPropertiesNumber() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java index 7042e9c87604..5020e0c4a0fc 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java @@ -29,6 +29,10 @@ public class AdditionalPropertiesObject { private String name; + public AdditionalPropertiesObject() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesString.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesString.java index 0a00d336a0b5..3d61884ec64f 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesString.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesString.java @@ -28,6 +28,10 @@ public class AdditionalPropertiesString { private String name; + public AdditionalPropertiesString() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java index 29e702de9204..aa8ac0cb6864 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -29,6 +29,10 @@ public class ArrayOfArrayOfNumberOnly { @Valid private List> arrayArrayNumber = new ArrayList<>(); + public ArrayOfArrayOfNumberOnly() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java index cbe4c35c2ef7..1c8cc37f044a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -29,6 +29,10 @@ public class ArrayOfNumberOnly { @Valid private List arrayNumber = new ArrayList<>(); + public ArrayOfNumberOnly() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayTest.java index 4e6b1b5a6490..99139106d80a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ArrayTest.java @@ -35,6 +35,10 @@ public class ArrayTest { @Valid private List> arrayArrayOfModel = new ArrayList<>(); + public ArrayTest() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Capitalization.java index fd9d326a3fda..2783189e3ec9 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Capitalization.java @@ -34,6 +34,10 @@ public class Capitalization { private String ATT_NAME; + public Capitalization() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ChildWithNullable.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ChildWithNullable.java index b36fda25a2ed..92b5bcea5580 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ChildWithNullable.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ChildWithNullable.java @@ -32,6 +32,10 @@ public class ChildWithNullable extends ParentWithNullable { private String otherProperty; + public ChildWithNullable() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ClassModel.java index c8bb2dca34cd..77c8c64d966a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ClassModel.java @@ -25,6 +25,10 @@ public class ClassModel { private String propertyClass; + public ClassModel() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Client.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Client.java index 74819d7c311b..5290114a5bd1 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Client.java @@ -24,6 +24,10 @@ public class Client { private String client; + public Client() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumArrays.java index ab870b37276d..00dd39a8371c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumArrays.java @@ -101,6 +101,10 @@ public static ArrayEnumEnum fromValue(String value) { @Valid private List arrayEnum = new ArrayList<>(); + public EnumArrays() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/File.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/File.java index 6ef3c320227a..d655a98f4dc4 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/File.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/File.java @@ -25,6 +25,10 @@ public class File { private String sourceURI; + public File() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FileSchemaTestClass.java index f106dc68e9b3..d59eadd12e78 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FileSchemaTestClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FileSchemaTestClass.java @@ -31,6 +31,10 @@ public class FileSchemaTestClass { @Valid private List<@Valid File> files = new ArrayList<>(); + public FileSchemaTestClass() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/HasOnlyReadOnly.java index fc94f54a4697..12b1230ba0aa 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/HasOnlyReadOnly.java @@ -28,6 +28,10 @@ public class HasOnlyReadOnly { private String foo; + public HasOnlyReadOnly() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MapTest.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MapTest.java index 6f638c2b72e3..5998be729c2a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MapTest.java @@ -72,6 +72,10 @@ public static InnerEnum fromValue(String value) { @Valid private Map indirectMap = new HashMap<>(); + public MapTest() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index f7970038721c..1842333561b6 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -36,6 +36,10 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @Valid private Map map = new HashMap<>(); + public MixedPropertiesAndAdditionalPropertiesClass() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Model200Response.java index 3b8a6f1d382d..a04376d8a065 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Model200Response.java @@ -29,6 +29,10 @@ public class Model200Response { private String propertyClass; + public Model200Response() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelApiResponse.java index 28ae571cd55b..da593af8efa0 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -30,6 +30,10 @@ public class ModelApiResponse { private String message; + public ModelApiResponse() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelList.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelList.java index 5b9431563606..2c384f372e8d 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelList.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelList.java @@ -26,6 +26,10 @@ public class ModelList { private String _123list; + public ModelList() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelReturn.java index a71209706548..235a0e075b97 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelReturn.java @@ -27,6 +27,10 @@ public class ModelReturn { private Integer _return; + public ModelReturn() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java index 6bec6b28d5e9..52fe66679bee 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -30,6 +30,10 @@ public class NullableMapProperty { @Valid private JsonNullable> languageValues = JsonNullable.>undefined(); + public NullableMapProperty() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NumberOnly.java index 51ddc40e97e6..07495c0ca643 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NumberOnly.java @@ -25,6 +25,10 @@ public class NumberOnly { private BigDecimal justNumber; + public NumberOnly() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Order.java index c1145764a9e4..ea4ec9917686 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Order.java @@ -75,6 +75,10 @@ public static StatusEnum fromValue(String value) { private Boolean complete = false; + public Order() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OuterComposite.java index 541497ab0f62..3db47074fdf3 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OuterComposite.java @@ -29,6 +29,10 @@ public class OuterComposite { private Boolean myBoolean; + public OuterComposite() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java index e7827c061e0a..9d069f3daffb 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -75,6 +75,10 @@ public static TypeEnum fromValue(String value) { private JsonNullable nullableProperty = JsonNullable.undefined(); + public ParentWithNullable() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ReadOnlyFirst.java index 152af21dc2cc..3ac0d6465033 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ReadOnlyFirst.java @@ -26,6 +26,10 @@ public class ReadOnlyFirst { private String baz; + public ReadOnlyFirst() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java index 8687f7af05e0..31114324f117 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java @@ -30,6 +30,10 @@ public class ResponseObjectWithDifferentFieldNames { private String propertyNameWithSpaces; + public ResponseObjectWithDifferentFieldNames() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/SpecialModelName.java index 8476919848d8..f9e5a4809384 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/SpecialModelName.java @@ -26,6 +26,10 @@ public class SpecialModelName { private Long $specialPropertyName; + public SpecialModelName() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Tag.java index 69764cb722e3..75698837b571 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Tag.java @@ -26,6 +26,10 @@ public class Tag { private String name; + public Tag() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/User.java index 5aff42506b87..5ea2d489d982 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/User.java @@ -38,6 +38,10 @@ public class User { private Integer userStatus; + public User() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/XmlItem.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/XmlItem.java index be92432db0e0..851db8c707b3 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/XmlItem.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/XmlItem.java @@ -93,6 +93,10 @@ public class XmlItem { @Valid private List prefixNsWrappedArray = new ArrayList<>(); + public XmlItem() { + super(); + } + /** * Constructor with all args parameters */ diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java index 4ae2f2bdd964..f3eb99238909 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java @@ -124,5 +124,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesAnyType instance; + + public Builder() { + this(new AdditionalPropertiesAnyType()); + } + + protected Builder(AdditionalPropertiesAnyType instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesAnyType value) { + this.instance.setName(value.name); + return this; + } + + public AdditionalPropertiesAnyType.Builder name(String name) { + this.instance.name(name); + return this; + } + + public AdditionalPropertiesAnyType.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + + /** + * returns a built AdditionalPropertiesAnyType instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesAnyType build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesAnyType.Builder builder() { + return new AdditionalPropertiesAnyType.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesAnyType.Builder toBuilder() { + AdditionalPropertiesAnyType.Builder builder = new AdditionalPropertiesAnyType.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java index 2233a85264eb..b6bfd56b3e81 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java @@ -125,5 +125,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesArray instance; + + public Builder() { + this(new AdditionalPropertiesArray()); + } + + protected Builder(AdditionalPropertiesArray instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesArray value) { + this.instance.setName(value.name); + return this; + } + + public AdditionalPropertiesArray.Builder name(String name) { + this.instance.name(name); + return this; + } + + public AdditionalPropertiesArray.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + + /** + * returns a built AdditionalPropertiesArray instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesArray build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesArray.Builder builder() { + return new AdditionalPropertiesArray.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesArray.Builder toBuilder() { + AdditionalPropertiesArray.Builder builder = new AdditionalPropertiesArray.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java index 07cb595c94d5..b3277d02e174 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -124,5 +124,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesBoolean instance; + + public Builder() { + this(new AdditionalPropertiesBoolean()); + } + + protected Builder(AdditionalPropertiesBoolean instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesBoolean value) { + this.instance.setName(value.name); + return this; + } + + public AdditionalPropertiesBoolean.Builder name(String name) { + this.instance.name(name); + return this; + } + + public AdditionalPropertiesBoolean.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + + /** + * returns a built AdditionalPropertiesBoolean instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesBoolean build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesBoolean.Builder builder() { + return new AdditionalPropertiesBoolean.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesBoolean.Builder toBuilder() { + AdditionalPropertiesBoolean.Builder builder = new AdditionalPropertiesBoolean.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index 9c16759329f4..3a87a5601db2 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -410,5 +410,128 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesClass instance; + + public Builder() { + this(new AdditionalPropertiesClass()); + } + + protected Builder(AdditionalPropertiesClass instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesClass value) { + this.instance.setMapString(value.mapString); + this.instance.setMapNumber(value.mapNumber); + this.instance.setMapInteger(value.mapInteger); + this.instance.setMapBoolean(value.mapBoolean); + this.instance.setMapArrayInteger(value.mapArrayInteger); + this.instance.setMapArrayAnytype(value.mapArrayAnytype); + this.instance.setMapMapString(value.mapMapString); + this.instance.setMapMapAnytype(value.mapMapAnytype); + this.instance.setAnytype1(value.anytype1); + this.instance.setAnytype2(value.anytype2); + this.instance.setAnytype3(value.anytype3); + return this; + } + + public AdditionalPropertiesClass.Builder mapString(Map mapString) { + this.instance.mapString(mapString); + return this; + } + + public AdditionalPropertiesClass.Builder mapNumber(Map mapNumber) { + this.instance.mapNumber(mapNumber); + return this; + } + + public AdditionalPropertiesClass.Builder mapInteger(Map mapInteger) { + this.instance.mapInteger(mapInteger); + return this; + } + + public AdditionalPropertiesClass.Builder mapBoolean(Map mapBoolean) { + this.instance.mapBoolean(mapBoolean); + return this; + } + + public AdditionalPropertiesClass.Builder mapArrayInteger(Map> mapArrayInteger) { + this.instance.mapArrayInteger(mapArrayInteger); + return this; + } + + public AdditionalPropertiesClass.Builder mapArrayAnytype(Map> mapArrayAnytype) { + this.instance.mapArrayAnytype(mapArrayAnytype); + return this; + } + + public AdditionalPropertiesClass.Builder mapMapString(Map> mapMapString) { + this.instance.mapMapString(mapMapString); + return this; + } + + public AdditionalPropertiesClass.Builder mapMapAnytype(Map> mapMapAnytype) { + this.instance.mapMapAnytype(mapMapAnytype); + return this; + } + + public AdditionalPropertiesClass.Builder anytype1(Object anytype1) { + this.instance.anytype1(anytype1); + return this; + } + + public AdditionalPropertiesClass.Builder anytype2(Object anytype2) { + this.instance.anytype2(anytype2); + return this; + } + + public AdditionalPropertiesClass.Builder anytype2(JsonNullable anytype2) { + this.instance.anytype2 = anytype2; + return this; + } + + public AdditionalPropertiesClass.Builder anytype3(Object anytype3) { + this.instance.anytype3(anytype3); + return this; + } + + /** + * returns a built AdditionalPropertiesClass instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesClass.Builder builder() { + return new AdditionalPropertiesClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesClass.Builder toBuilder() { + AdditionalPropertiesClass.Builder builder = new AdditionalPropertiesClass.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java index 42784d373a04..d049914a7ec1 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java @@ -124,5 +124,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesInteger instance; + + public Builder() { + this(new AdditionalPropertiesInteger()); + } + + protected Builder(AdditionalPropertiesInteger instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesInteger value) { + this.instance.setName(value.name); + return this; + } + + public AdditionalPropertiesInteger.Builder name(String name) { + this.instance.name(name); + return this; + } + + public AdditionalPropertiesInteger.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + + /** + * returns a built AdditionalPropertiesInteger instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesInteger build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesInteger.Builder builder() { + return new AdditionalPropertiesInteger.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesInteger.Builder toBuilder() { + AdditionalPropertiesInteger.Builder builder = new AdditionalPropertiesInteger.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java index fc0ed8c8f31e..63ddfaba3bf0 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java @@ -125,5 +125,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesNumber instance; + + public Builder() { + this(new AdditionalPropertiesNumber()); + } + + protected Builder(AdditionalPropertiesNumber instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesNumber value) { + this.instance.setName(value.name); + return this; + } + + public AdditionalPropertiesNumber.Builder name(String name) { + this.instance.name(name); + return this; + } + + public AdditionalPropertiesNumber.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + + /** + * returns a built AdditionalPropertiesNumber instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesNumber build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesNumber.Builder builder() { + return new AdditionalPropertiesNumber.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesNumber.Builder toBuilder() { + AdditionalPropertiesNumber.Builder builder = new AdditionalPropertiesNumber.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java index 964ae18650a2..992d20812f68 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java @@ -125,5 +125,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesObject instance; + + public Builder() { + this(new AdditionalPropertiesObject()); + } + + protected Builder(AdditionalPropertiesObject instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesObject value) { + this.instance.setName(value.name); + return this; + } + + public AdditionalPropertiesObject.Builder name(String name) { + this.instance.name(name); + return this; + } + + public AdditionalPropertiesObject.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + + /** + * returns a built AdditionalPropertiesObject instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesObject build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesObject.Builder builder() { + return new AdditionalPropertiesObject.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesObject.Builder toBuilder() { + AdditionalPropertiesObject.Builder builder = new AdditionalPropertiesObject.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesString.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesString.java index 6114e3675403..e7c88efce4a4 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesString.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesString.java @@ -124,5 +124,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private AdditionalPropertiesString instance; + + public Builder() { + this(new AdditionalPropertiesString()); + } + + protected Builder(AdditionalPropertiesString instance) { + this.instance = instance; + } + + protected Builder copyOf(AdditionalPropertiesString value) { + this.instance.setName(value.name); + return this; + } + + public AdditionalPropertiesString.Builder name(String name) { + this.instance.name(name); + return this; + } + + public AdditionalPropertiesString.Builder additionalProperties(Map additionalProperties) { + this.instance.additionalProperties = additionalProperties; + return this; + } + + /** + * returns a built AdditionalPropertiesString instance. + * + * The builder is not reusable (NullPointerException) + */ + public AdditionalPropertiesString build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static AdditionalPropertiesString.Builder builder() { + return new AdditionalPropertiesString.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AdditionalPropertiesString.Builder toBuilder() { + AdditionalPropertiesString.Builder builder = new AdditionalPropertiesString.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Animal.java index d989505862d5..b8839c1929b6 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Animal.java @@ -129,5 +129,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Animal instance; + + public Builder() { + this(new Animal()); + } + + protected Builder(Animal instance) { + this.instance = instance; + } + + protected Builder copyOf(Animal value) { + this.instance.setClassName(value.className); + this.instance.setColor(value.color); + return this; + } + + public Animal.Builder className(String className) { + this.instance.className(className); + return this; + } + + public Animal.Builder color(String color) { + this.instance.color(color); + return this; + } + + /** + * returns a built Animal instance. + * + * The builder is not reusable (NullPointerException) + */ + public Animal build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Animal.Builder builder() { + return new Animal.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Animal.Builder toBuilder() { + Animal.Builder builder = new Animal.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java index e3f4d272de5c..79105f8b9e16 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -93,5 +93,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ArrayOfArrayOfNumberOnly instance; + + public Builder() { + this(new ArrayOfArrayOfNumberOnly()); + } + + protected Builder(ArrayOfArrayOfNumberOnly instance) { + this.instance = instance; + } + + protected Builder copyOf(ArrayOfArrayOfNumberOnly value) { + this.instance.setArrayArrayNumber(value.arrayArrayNumber); + return this; + } + + public ArrayOfArrayOfNumberOnly.Builder arrayArrayNumber(List> arrayArrayNumber) { + this.instance.arrayArrayNumber(arrayArrayNumber); + return this; + } + + /** + * returns a built ArrayOfArrayOfNumberOnly instance. + * + * The builder is not reusable (NullPointerException) + */ + public ArrayOfArrayOfNumberOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ArrayOfArrayOfNumberOnly.Builder builder() { + return new ArrayOfArrayOfNumberOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ArrayOfArrayOfNumberOnly.Builder toBuilder() { + ArrayOfArrayOfNumberOnly.Builder builder = new ArrayOfArrayOfNumberOnly.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java index 6a71d37dcf1c..1257ac5909f2 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -93,5 +93,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ArrayOfNumberOnly instance; + + public Builder() { + this(new ArrayOfNumberOnly()); + } + + protected Builder(ArrayOfNumberOnly instance) { + this.instance = instance; + } + + protected Builder copyOf(ArrayOfNumberOnly value) { + this.instance.setArrayNumber(value.arrayNumber); + return this; + } + + public ArrayOfNumberOnly.Builder arrayNumber(List arrayNumber) { + this.instance.arrayNumber(arrayNumber); + return this; + } + + /** + * returns a built ArrayOfNumberOnly instance. + * + * The builder is not reusable (NullPointerException) + */ + public ArrayOfNumberOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ArrayOfNumberOnly.Builder builder() { + return new ArrayOfNumberOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ArrayOfNumberOnly.Builder toBuilder() { + ArrayOfNumberOnly.Builder builder = new ArrayOfNumberOnly.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayTest.java index f5aa226a3d27..fd2675d0e901 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayTest.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ArrayTest.java @@ -159,5 +159,75 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ArrayTest instance; + + public Builder() { + this(new ArrayTest()); + } + + protected Builder(ArrayTest instance) { + this.instance = instance; + } + + protected Builder copyOf(ArrayTest value) { + this.instance.setArrayOfString(value.arrayOfString); + this.instance.setArrayArrayOfInteger(value.arrayArrayOfInteger); + this.instance.setArrayArrayOfModel(value.arrayArrayOfModel); + return this; + } + + public ArrayTest.Builder arrayOfString(List arrayOfString) { + this.instance.arrayOfString(arrayOfString); + return this; + } + + public ArrayTest.Builder arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.instance.arrayArrayOfInteger(arrayArrayOfInteger); + return this; + } + + public ArrayTest.Builder arrayArrayOfModel(List> arrayArrayOfModel) { + this.instance.arrayArrayOfModel(arrayArrayOfModel); + return this; + } + + /** + * returns a built ArrayTest instance. + * + * The builder is not reusable (NullPointerException) + */ + public ArrayTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ArrayTest.Builder builder() { + return new ArrayTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ArrayTest.Builder toBuilder() { + ArrayTest.Builder builder = new ArrayTest.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java index 5d15e8f65a64..cbd8b4a14ef5 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java @@ -153,5 +153,84 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Cat.Builder { + + private BigCat instance; + + public Builder() { + this(new BigCat()); + } + + protected Builder(BigCat instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(BigCat value) { + super.copyOf(instance); + this.instance.setKind(value.kind); + return this; + } + + public BigCat.Builder kind(KindEnum kind) { + this.instance.kind(kind); + return this; + } + + @Override + public BigCat.Builder declawed(Boolean declawed) { + this.instance.declawed(declawed); + return this; + } + + @Override + public BigCat.Builder className(String className) { + this.instance.className(className); + return this; + } + + @Override + public BigCat.Builder color(String color) { + this.instance.color(color); + return this; + } + + /** + * returns a built BigCat instance. + * + * The builder is not reusable (NullPointerException) + */ + public BigCat build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static BigCat.Builder builder() { + return new BigCat.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public BigCat.Builder toBuilder() { + BigCat.Builder builder = new BigCat.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Capitalization.java index 2ff8a2bbf000..48b5e10adae5 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Capitalization.java @@ -200,5 +200,93 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Capitalization instance; + + public Builder() { + this(new Capitalization()); + } + + protected Builder(Capitalization instance) { + this.instance = instance; + } + + protected Builder copyOf(Capitalization value) { + this.instance.setSmallCamel(value.smallCamel); + this.instance.setCapitalCamel(value.capitalCamel); + this.instance.setSmallSnake(value.smallSnake); + this.instance.setCapitalSnake(value.capitalSnake); + this.instance.setScAETHFlowPoints(value.scAETHFlowPoints); + this.instance.setATTNAME(value.ATT_NAME); + return this; + } + + public Capitalization.Builder smallCamel(String smallCamel) { + this.instance.smallCamel(smallCamel); + return this; + } + + public Capitalization.Builder capitalCamel(String capitalCamel) { + this.instance.capitalCamel(capitalCamel); + return this; + } + + public Capitalization.Builder smallSnake(String smallSnake) { + this.instance.smallSnake(smallSnake); + return this; + } + + public Capitalization.Builder capitalSnake(String capitalSnake) { + this.instance.capitalSnake(capitalSnake); + return this; + } + + public Capitalization.Builder scAETHFlowPoints(String scAETHFlowPoints) { + this.instance.scAETHFlowPoints(scAETHFlowPoints); + return this; + } + + public Capitalization.Builder ATT_NAME(String ATT_NAME) { + this.instance.ATT_NAME(ATT_NAME); + return this; + } + + /** + * returns a built Capitalization instance. + * + * The builder is not reusable (NullPointerException) + */ + public Capitalization build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Capitalization.Builder builder() { + return new Capitalization.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Capitalization.Builder toBuilder() { + Capitalization.Builder builder = new Capitalization.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java index 6eafc4dcfa26..0fe922483120 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java @@ -116,5 +116,78 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Animal.Builder { + + private Cat instance; + + public Builder() { + this(new Cat()); + } + + protected Builder(Cat instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(Cat value) { + super.copyOf(instance); + this.instance.setDeclawed(value.declawed); + return this; + } + + public Cat.Builder declawed(Boolean declawed) { + this.instance.declawed(declawed); + return this; + } + + @Override + public Cat.Builder className(String className) { + this.instance.className(className); + return this; + } + + @Override + public Cat.Builder color(String color) { + this.instance.color(color); + return this; + } + + /** + * returns a built Cat instance. + * + * The builder is not reusable (NullPointerException) + */ + public Cat build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Cat.Builder builder() { + return new Cat.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Cat.Builder toBuilder() { + Cat.Builder builder = new Cat.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java index d41d7792134d..ce2a64d65e90 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java @@ -115,5 +115,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Category instance; + + public Builder() { + this(new Category()); + } + + protected Builder(Category instance) { + this.instance = instance; + } + + protected Builder copyOf(Category value) { + this.instance.setId(value.id); + this.instance.setName(value.name); + return this; + } + + public Category.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Category.Builder name(String name) { + this.instance.name(name); + return this; + } + + /** + * returns a built Category instance. + * + * The builder is not reusable (NullPointerException) + */ + public Category build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Category.Builder builder() { + return new Category.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Category.Builder toBuilder() { + Category.Builder builder = new Category.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ChildWithNullable.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ChildWithNullable.java index d4d72ddaccb4..4b3e323e2db1 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ChildWithNullable.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ChildWithNullable.java @@ -111,5 +111,83 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends ParentWithNullable.Builder { + + private ChildWithNullable instance; + + public Builder() { + this(new ChildWithNullable()); + } + + protected Builder(ChildWithNullable instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(ChildWithNullable value) { + super.copyOf(instance); + this.instance.setOtherProperty(value.otherProperty); + return this; + } + + public ChildWithNullable.Builder otherProperty(String otherProperty) { + this.instance.otherProperty(otherProperty); + return this; + } + + @Override + public ChildWithNullable.Builder type(TypeEnum type) { + this.instance.type(type); + return this; + } + + @Override + public ChildWithNullable.Builder nullableProperty(String nullableProperty) { + this.instance.nullableProperty(nullableProperty); + return this; + } + + public ChildWithNullable.Builder nullableProperty(JsonNullable nullableProperty) { + this.instance.setNullableProperty(nullableProperty); + return this; + } + + /** + * returns a built ChildWithNullable instance. + * + * The builder is not reusable (NullPointerException) + */ + public ChildWithNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ChildWithNullable.Builder builder() { + return new ChildWithNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ChildWithNullable.Builder toBuilder() { + ChildWithNullable.Builder builder = new ChildWithNullable.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ClassModel.java index d73043244820..e0b25f6fd7c6 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ClassModel.java @@ -81,5 +81,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ClassModel instance; + + public Builder() { + this(new ClassModel()); + } + + protected Builder(ClassModel instance) { + this.instance = instance; + } + + protected Builder copyOf(ClassModel value) { + this.instance.setPropertyClass(value.propertyClass); + return this; + } + + public ClassModel.Builder propertyClass(String propertyClass) { + this.instance.propertyClass(propertyClass); + return this; + } + + /** + * returns a built ClassModel instance. + * + * The builder is not reusable (NullPointerException) + */ + public ClassModel build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ClassModel.Builder builder() { + return new ClassModel.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ClassModel.Builder toBuilder() { + ClassModel.Builder builder = new ClassModel.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Client.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Client.java index c27291237890..935c6f813bcb 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Client.java @@ -80,5 +80,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Client instance; + + public Builder() { + this(new Client()); + } + + protected Builder(Client instance) { + this.instance = instance; + } + + protected Builder copyOf(Client value) { + this.instance.setClient(value.client); + return this; + } + + public Client.Builder client(String client) { + this.instance.client(client); + return this; + } + + /** + * returns a built Client instance. + * + * The builder is not reusable (NullPointerException) + */ + public Client build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Client.Builder builder() { + return new Client.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Client.Builder toBuilder() { + Client.Builder builder = new Client.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java index f635ce8a4b69..3ab4a13e1f71 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -216,5 +216,96 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ContainerDefaultValue instance; + + public Builder() { + this(new ContainerDefaultValue()); + } + + protected Builder(ContainerDefaultValue instance) { + this.instance = instance; + } + + protected Builder copyOf(ContainerDefaultValue value) { + this.instance.setNullableArray(value.nullableArray); + this.instance.setNullableRequiredArray(value.nullableRequiredArray); + this.instance.setRequiredArray(value.requiredArray); + this.instance.setNullableArrayWithDefault(value.nullableArrayWithDefault); + return this; + } + + public ContainerDefaultValue.Builder nullableArray(List nullableArray) { + this.instance.nullableArray(nullableArray); + return this; + } + + public ContainerDefaultValue.Builder nullableArray(JsonNullable> nullableArray) { + this.instance.nullableArray = nullableArray; + return this; + } + + public ContainerDefaultValue.Builder nullableRequiredArray(List nullableRequiredArray) { + this.instance.nullableRequiredArray(nullableRequiredArray); + return this; + } + + public ContainerDefaultValue.Builder nullableRequiredArray(JsonNullable> nullableRequiredArray) { + this.instance.nullableRequiredArray = nullableRequiredArray; + return this; + } + + public ContainerDefaultValue.Builder requiredArray(List requiredArray) { + this.instance.requiredArray(requiredArray); + return this; + } + + public ContainerDefaultValue.Builder nullableArrayWithDefault(List nullableArrayWithDefault) { + this.instance.nullableArrayWithDefault(nullableArrayWithDefault); + return this; + } + + public ContainerDefaultValue.Builder nullableArrayWithDefault(JsonNullable> nullableArrayWithDefault) { + this.instance.nullableArrayWithDefault = nullableArrayWithDefault; + return this; + } + + /** + * returns a built ContainerDefaultValue instance. + * + * The builder is not reusable (NullPointerException) + */ + public ContainerDefaultValue build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ContainerDefaultValue.Builder builder() { + return new ContainerDefaultValue.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ContainerDefaultValue.Builder toBuilder() { + ContainerDefaultValue.Builder builder = new ContainerDefaultValue.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java index 2671d3b023d4..cde4c8461e04 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java @@ -108,5 +108,78 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder extends Animal.Builder { + + private Dog instance; + + public Builder() { + this(new Dog()); + } + + protected Builder(Dog instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(Dog value) { + super.copyOf(instance); + this.instance.setBreed(value.breed); + return this; + } + + public Dog.Builder breed(String breed) { + this.instance.breed(breed); + return this; + } + + @Override + public Dog.Builder className(String className) { + this.instance.className(className); + return this; + } + + @Override + public Dog.Builder color(String color) { + this.instance.color(color); + return this; + } + + /** + * returns a built Dog instance. + * + * The builder is not reusable (NullPointerException) + */ + public Dog build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Dog.Builder builder() { + return new Dog.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Dog.Builder toBuilder() { + Dog.Builder builder = new Dog.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumArrays.java index 9304eab13523..0d61255a8cb1 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumArrays.java @@ -187,5 +187,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private EnumArrays instance; + + public Builder() { + this(new EnumArrays()); + } + + protected Builder(EnumArrays instance) { + this.instance = instance; + } + + protected Builder copyOf(EnumArrays value) { + this.instance.setJustSymbol(value.justSymbol); + this.instance.setArrayEnum(value.arrayEnum); + return this; + } + + public EnumArrays.Builder justSymbol(JustSymbolEnum justSymbol) { + this.instance.justSymbol(justSymbol); + return this; + } + + public EnumArrays.Builder arrayEnum(List arrayEnum) { + this.instance.arrayEnum(arrayEnum); + return this; + } + + /** + * returns a built EnumArrays instance. + * + * The builder is not reusable (NullPointerException) + */ + public EnumArrays build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static EnumArrays.Builder builder() { + return new EnumArrays.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public EnumArrays.Builder toBuilder() { + EnumArrays.Builder builder = new EnumArrays.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumTest.java index b8fc67659c78..ce8e80f0235e 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumTest.java @@ -335,5 +335,87 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private EnumTest instance; + + public Builder() { + this(new EnumTest()); + } + + protected Builder(EnumTest instance) { + this.instance = instance; + } + + protected Builder copyOf(EnumTest value) { + this.instance.setEnumString(value.enumString); + this.instance.setEnumStringRequired(value.enumStringRequired); + this.instance.setEnumInteger(value.enumInteger); + this.instance.setEnumNumber(value.enumNumber); + this.instance.setOuterEnum(value.outerEnum); + return this; + } + + public EnumTest.Builder enumString(EnumStringEnum enumString) { + this.instance.enumString(enumString); + return this; + } + + public EnumTest.Builder enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.instance.enumStringRequired(enumStringRequired); + return this; + } + + public EnumTest.Builder enumInteger(EnumIntegerEnum enumInteger) { + this.instance.enumInteger(enumInteger); + return this; + } + + public EnumTest.Builder enumNumber(EnumNumberEnum enumNumber) { + this.instance.enumNumber(enumNumber); + return this; + } + + public EnumTest.Builder outerEnum(OuterEnum outerEnum) { + this.instance.outerEnum(outerEnum); + return this; + } + + /** + * returns a built EnumTest instance. + * + * The builder is not reusable (NullPointerException) + */ + public EnumTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static EnumTest.Builder builder() { + return new EnumTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public EnumTest.Builder toBuilder() { + EnumTest.Builder builder = new EnumTest.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/File.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/File.java index 7ac760a29543..f591df1c3d52 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/File.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/File.java @@ -81,5 +81,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private File instance; + + public Builder() { + this(new File()); + } + + protected Builder(File instance) { + this.instance = instance; + } + + protected Builder copyOf(File value) { + this.instance.setSourceURI(value.sourceURI); + return this; + } + + public File.Builder sourceURI(String sourceURI) { + this.instance.sourceURI(sourceURI); + return this; + } + + /** + * returns a built File instance. + * + * The builder is not reusable (NullPointerException) + */ + public File build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static File.Builder builder() { + return new File.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public File.Builder toBuilder() { + File.Builder builder = new File.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FileSchemaTestClass.java index 8b451c79b77e..64c474a1860d 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FileSchemaTestClass.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FileSchemaTestClass.java @@ -117,5 +117,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private FileSchemaTestClass instance; + + public Builder() { + this(new FileSchemaTestClass()); + } + + protected Builder(FileSchemaTestClass instance) { + this.instance = instance; + } + + protected Builder copyOf(FileSchemaTestClass value) { + this.instance.setFile(value.file); + this.instance.setFiles(value.files); + return this; + } + + public FileSchemaTestClass.Builder file(File file) { + this.instance.file(file); + return this; + } + + public FileSchemaTestClass.Builder files(List<@Valid File> files) { + this.instance.files(files); + return this; + } + + /** + * returns a built FileSchemaTestClass instance. + * + * The builder is not reusable (NullPointerException) + */ + public FileSchemaTestClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static FileSchemaTestClass.Builder builder() { + return new FileSchemaTestClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FileSchemaTestClass.Builder toBuilder() { + FileSchemaTestClass.Builder builder = new FileSchemaTestClass.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java index 6d1fad2c21df..b37c5f0d4f03 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java @@ -426,5 +426,141 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private FormatTest instance; + + public Builder() { + this(new FormatTest()); + } + + protected Builder(FormatTest instance) { + this.instance = instance; + } + + protected Builder copyOf(FormatTest value) { + this.instance.setInteger(value.integer); + this.instance.setInt32(value.int32); + this.instance.setInt64(value.int64); + this.instance.setNumber(value.number); + this.instance.setFloat(value._float); + this.instance.setDouble(value._double); + this.instance.setString(value.string); + this.instance.setByte(value._byte); + this.instance.setBinary(value.binary); + this.instance.setDate(value.date); + this.instance.setDateTime(value.dateTime); + this.instance.setUuid(value.uuid); + this.instance.setPassword(value.password); + this.instance.setBigDecimal(value.bigDecimal); + return this; + } + + public FormatTest.Builder integer(Integer integer) { + this.instance.integer(integer); + return this; + } + + public FormatTest.Builder int32(Integer int32) { + this.instance.int32(int32); + return this; + } + + public FormatTest.Builder int64(Long int64) { + this.instance.int64(int64); + return this; + } + + public FormatTest.Builder number(BigDecimal number) { + this.instance.number(number); + return this; + } + + public FormatTest.Builder _float(Float _float) { + this.instance._float(_float); + return this; + } + + public FormatTest.Builder _double(Double _double) { + this.instance._double(_double); + return this; + } + + public FormatTest.Builder string(String string) { + this.instance.string(string); + return this; + } + + public FormatTest.Builder _byte(byte[] _byte) { + this.instance._byte(_byte); + return this; + } + + public FormatTest.Builder binary(org.springframework.core.io.Resource binary) { + this.instance.binary(binary); + return this; + } + + public FormatTest.Builder date(LocalDate date) { + this.instance.date(date); + return this; + } + + public FormatTest.Builder dateTime(OffsetDateTime dateTime) { + this.instance.dateTime(dateTime); + return this; + } + + public FormatTest.Builder uuid(UUID uuid) { + this.instance.uuid(uuid); + return this; + } + + public FormatTest.Builder password(String password) { + this.instance.password(password); + return this; + } + + public FormatTest.Builder bigDecimal(BigDecimal bigDecimal) { + this.instance.bigDecimal(bigDecimal); + return this; + } + + /** + * returns a built FormatTest instance. + * + * The builder is not reusable (NullPointerException) + */ + public FormatTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static FormatTest.Builder builder() { + return new FormatTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FormatTest.Builder toBuilder() { + FormatTest.Builder builder = new FormatTest.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/HasOnlyReadOnly.java index 4da93bdc44d5..4095eb3bd8d4 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/HasOnlyReadOnly.java @@ -106,5 +106,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private HasOnlyReadOnly instance; + + public Builder() { + this(new HasOnlyReadOnly()); + } + + protected Builder(HasOnlyReadOnly instance) { + this.instance = instance; + } + + protected Builder copyOf(HasOnlyReadOnly value) { + this.instance.setBar(value.bar); + this.instance.setFoo(value.foo); + return this; + } + + public HasOnlyReadOnly.Builder bar(String bar) { + this.instance.bar(bar); + return this; + } + + public HasOnlyReadOnly.Builder foo(String foo) { + this.instance.foo(foo); + return this; + } + + /** + * returns a built HasOnlyReadOnly instance. + * + * The builder is not reusable (NullPointerException) + */ + public HasOnlyReadOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static HasOnlyReadOnly.Builder builder() { + return new HasOnlyReadOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public HasOnlyReadOnly.Builder toBuilder() { + HasOnlyReadOnly.Builder builder = new HasOnlyReadOnly.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MapTest.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MapTest.java index 58d65f476b76..e7cf6b885a08 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MapTest.java @@ -226,5 +226,81 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private MapTest instance; + + public Builder() { + this(new MapTest()); + } + + protected Builder(MapTest instance) { + this.instance = instance; + } + + protected Builder copyOf(MapTest value) { + this.instance.setMapMapOfString(value.mapMapOfString); + this.instance.setMapOfEnumString(value.mapOfEnumString); + this.instance.setDirectMap(value.directMap); + this.instance.setIndirectMap(value.indirectMap); + return this; + } + + public MapTest.Builder mapMapOfString(Map> mapMapOfString) { + this.instance.mapMapOfString(mapMapOfString); + return this; + } + + public MapTest.Builder mapOfEnumString(Map mapOfEnumString) { + this.instance.mapOfEnumString(mapOfEnumString); + return this; + } + + public MapTest.Builder directMap(Map directMap) { + this.instance.directMap(directMap); + return this; + } + + public MapTest.Builder indirectMap(Map indirectMap) { + this.instance.indirectMap(indirectMap); + return this; + } + + /** + * returns a built MapTest instance. + * + * The builder is not reusable (NullPointerException) + */ + public MapTest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static MapTest.Builder builder() { + return new MapTest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public MapTest.Builder toBuilder() { + MapTest.Builder builder = new MapTest.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index a3845d0107ec..7b002a83a22e 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -144,5 +144,75 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private MixedPropertiesAndAdditionalPropertiesClass instance; + + public Builder() { + this(new MixedPropertiesAndAdditionalPropertiesClass()); + } + + protected Builder(MixedPropertiesAndAdditionalPropertiesClass instance) { + this.instance = instance; + } + + protected Builder copyOf(MixedPropertiesAndAdditionalPropertiesClass value) { + this.instance.setUuid(value.uuid); + this.instance.setDateTime(value.dateTime); + this.instance.setMap(value.map); + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass.Builder uuid(UUID uuid) { + this.instance.uuid(uuid); + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass.Builder dateTime(OffsetDateTime dateTime) { + this.instance.dateTime(dateTime); + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass.Builder map(Map map) { + this.instance.map(map); + return this; + } + + /** + * returns a built MixedPropertiesAndAdditionalPropertiesClass instance. + * + * The builder is not reusable (NullPointerException) + */ + public MixedPropertiesAndAdditionalPropertiesClass build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static MixedPropertiesAndAdditionalPropertiesClass.Builder builder() { + return new MixedPropertiesAndAdditionalPropertiesClass.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public MixedPropertiesAndAdditionalPropertiesClass.Builder toBuilder() { + MixedPropertiesAndAdditionalPropertiesClass.Builder builder = new MixedPropertiesAndAdditionalPropertiesClass.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Model200Response.java index 8ab057fc33c5..ef4a6e9400f1 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Model200Response.java @@ -107,5 +107,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Model200Response instance; + + public Builder() { + this(new Model200Response()); + } + + protected Builder(Model200Response instance) { + this.instance = instance; + } + + protected Builder copyOf(Model200Response value) { + this.instance.setName(value.name); + this.instance.setPropertyClass(value.propertyClass); + return this; + } + + public Model200Response.Builder name(Integer name) { + this.instance.name(name); + return this; + } + + public Model200Response.Builder propertyClass(String propertyClass) { + this.instance.propertyClass(propertyClass); + return this; + } + + /** + * returns a built Model200Response instance. + * + * The builder is not reusable (NullPointerException) + */ + public Model200Response build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Model200Response.Builder builder() { + return new Model200Response.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Model200Response.Builder toBuilder() { + Model200Response.Builder builder = new Model200Response.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelApiResponse.java index 9a9c8445cb89..2c7e686cd431 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -130,5 +130,75 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ModelApiResponse instance; + + public Builder() { + this(new ModelApiResponse()); + } + + protected Builder(ModelApiResponse instance) { + this.instance = instance; + } + + protected Builder copyOf(ModelApiResponse value) { + this.instance.setCode(value.code); + this.instance.setType(value.type); + this.instance.setMessage(value.message); + return this; + } + + public ModelApiResponse.Builder code(Integer code) { + this.instance.code(code); + return this; + } + + public ModelApiResponse.Builder type(String type) { + this.instance.type(type); + return this; + } + + public ModelApiResponse.Builder message(String message) { + this.instance.message(message); + return this; + } + + /** + * returns a built ModelApiResponse instance. + * + * The builder is not reusable (NullPointerException) + */ + public ModelApiResponse build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ModelApiResponse.Builder builder() { + return new ModelApiResponse.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelApiResponse.Builder toBuilder() { + ModelApiResponse.Builder builder = new ModelApiResponse.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelList.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelList.java index 79768b5d8e3d..c29cfdc3ceb1 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelList.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelList.java @@ -82,5 +82,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ModelList instance; + + public Builder() { + this(new ModelList()); + } + + protected Builder(ModelList instance) { + this.instance = instance; + } + + protected Builder copyOf(ModelList value) { + this.instance.set123list(value._123list); + return this; + } + + public ModelList.Builder _123list(String _123list) { + this.instance._123list(_123list); + return this; + } + + /** + * returns a built ModelList instance. + * + * The builder is not reusable (NullPointerException) + */ + public ModelList build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ModelList.Builder builder() { + return new ModelList.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelList.Builder toBuilder() { + ModelList.Builder builder = new ModelList.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelReturn.java index 6d54c0a05f5b..46298ecf6388 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelReturn.java @@ -83,5 +83,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ModelReturn instance; + + public Builder() { + this(new ModelReturn()); + } + + protected Builder(ModelReturn instance) { + this.instance = instance; + } + + protected Builder copyOf(ModelReturn value) { + this.instance.setReturn(value._return); + return this; + } + + public ModelReturn.Builder _return(Integer _return) { + this.instance._return(_return); + return this; + } + + /** + * returns a built ModelReturn instance. + * + * The builder is not reusable (NullPointerException) + */ + public ModelReturn build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ModelReturn.Builder builder() { + return new ModelReturn.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelReturn.Builder toBuilder() { + ModelReturn.Builder builder = new ModelReturn.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Name.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Name.java index 50a41b54f361..333459a240c6 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Name.java @@ -164,5 +164,81 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Name instance; + + public Builder() { + this(new Name()); + } + + protected Builder(Name instance) { + this.instance = instance; + } + + protected Builder copyOf(Name value) { + this.instance.setName(value.name); + this.instance.setSnakeCase(value.snakeCase); + this.instance.setProperty(value.property); + this.instance.set123number(value._123number); + return this; + } + + public Name.Builder name(Integer name) { + this.instance.name(name); + return this; + } + + public Name.Builder snakeCase(Integer snakeCase) { + this.instance.snakeCase(snakeCase); + return this; + } + + public Name.Builder property(String property) { + this.instance.property(property); + return this; + } + + public Name.Builder _123number(Integer _123number) { + this.instance._123number(_123number); + return this; + } + + /** + * returns a built Name instance. + * + * The builder is not reusable (NullPointerException) + */ + public Name build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Name.Builder builder() { + return new Name.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Name.Builder toBuilder() { + Name.Builder builder = new Name.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java index bc0a415abe0b..f57825e3a7df 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -105,5 +105,68 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private NullableMapProperty instance; + + public Builder() { + this(new NullableMapProperty()); + } + + protected Builder(NullableMapProperty instance) { + this.instance = instance; + } + + protected Builder copyOf(NullableMapProperty value) { + this.instance.setLanguageValues(value.languageValues); + return this; + } + + public NullableMapProperty.Builder languageValues(Map languageValues) { + this.instance.languageValues(languageValues); + return this; + } + + public NullableMapProperty.Builder languageValues(JsonNullable> languageValues) { + this.instance.languageValues = languageValues; + return this; + } + + /** + * returns a built NullableMapProperty instance. + * + * The builder is not reusable (NullPointerException) + */ + public NullableMapProperty build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static NullableMapProperty.Builder builder() { + return new NullableMapProperty.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public NullableMapProperty.Builder toBuilder() { + NullableMapProperty.Builder builder = new NullableMapProperty.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NumberOnly.java index 5d5857c8d876..e328dd287745 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NumberOnly.java @@ -81,5 +81,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private NumberOnly instance; + + public Builder() { + this(new NumberOnly()); + } + + protected Builder(NumberOnly instance) { + this.instance = instance; + } + + protected Builder copyOf(NumberOnly value) { + this.instance.setJustNumber(value.justNumber); + return this; + } + + public NumberOnly.Builder justNumber(BigDecimal justNumber) { + this.instance.justNumber(justNumber); + return this; + } + + /** + * returns a built NumberOnly instance. + * + * The builder is not reusable (NullPointerException) + */ + public NumberOnly build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static NumberOnly.Builder builder() { + return new NumberOnly.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public NumberOnly.Builder toBuilder() { + NumberOnly.Builder builder = new NumberOnly.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Order.java index ddd58e60bf9f..87f205528773 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Order.java @@ -241,5 +241,93 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Order instance; + + public Builder() { + this(new Order()); + } + + protected Builder(Order instance) { + this.instance = instance; + } + + protected Builder copyOf(Order value) { + this.instance.setId(value.id); + this.instance.setPetId(value.petId); + this.instance.setQuantity(value.quantity); + this.instance.setShipDate(value.shipDate); + this.instance.setStatus(value.status); + this.instance.setComplete(value.complete); + return this; + } + + public Order.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Order.Builder petId(Long petId) { + this.instance.petId(petId); + return this; + } + + public Order.Builder quantity(Integer quantity) { + this.instance.quantity(quantity); + return this; + } + + public Order.Builder shipDate(OffsetDateTime shipDate) { + this.instance.shipDate(shipDate); + return this; + } + + public Order.Builder status(StatusEnum status) { + this.instance.status(status); + return this; + } + + public Order.Builder complete(Boolean complete) { + this.instance.complete(complete); + return this; + } + + /** + * returns a built Order instance. + * + * The builder is not reusable (NullPointerException) + */ + public Order build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Order.Builder builder() { + return new Order.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Order.Builder toBuilder() { + Order.Builder builder = new Order.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OuterComposite.java index 42fdbbca421e..341a192d0991 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OuterComposite.java @@ -129,5 +129,75 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private OuterComposite instance; + + public Builder() { + this(new OuterComposite()); + } + + protected Builder(OuterComposite instance) { + this.instance = instance; + } + + protected Builder copyOf(OuterComposite value) { + this.instance.setMyNumber(value.myNumber); + this.instance.setMyString(value.myString); + this.instance.setMyBoolean(value.myBoolean); + return this; + } + + public OuterComposite.Builder myNumber(BigDecimal myNumber) { + this.instance.myNumber(myNumber); + return this; + } + + public OuterComposite.Builder myString(String myString) { + this.instance.myString(myString); + return this; + } + + public OuterComposite.Builder myBoolean(Boolean myBoolean) { + this.instance.myBoolean(myBoolean); + return this; + } + + /** + * returns a built OuterComposite instance. + * + * The builder is not reusable (NullPointerException) + */ + public OuterComposite build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static OuterComposite.Builder builder() { + return new OuterComposite.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public OuterComposite.Builder toBuilder() { + OuterComposite.Builder builder = new OuterComposite.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ParentWithNullable.java index c35004724ddc..06e876e749fe 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -164,5 +164,74 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ParentWithNullable instance; + + public Builder() { + this(new ParentWithNullable()); + } + + protected Builder(ParentWithNullable instance) { + this.instance = instance; + } + + protected Builder copyOf(ParentWithNullable value) { + this.instance.setType(value.type); + this.instance.setNullableProperty(value.nullableProperty); + return this; + } + + public ParentWithNullable.Builder type(TypeEnum type) { + this.instance.type(type); + return this; + } + + public ParentWithNullable.Builder nullableProperty(String nullableProperty) { + this.instance.nullableProperty(nullableProperty); + return this; + } + + public ParentWithNullable.Builder nullableProperty(JsonNullable nullableProperty) { + this.instance.nullableProperty = nullableProperty; + return this; + } + + /** + * returns a built ParentWithNullable instance. + * + * The builder is not reusable (NullPointerException) + */ + public ParentWithNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ParentWithNullable.Builder builder() { + return new ParentWithNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ParentWithNullable.Builder toBuilder() { + ParentWithNullable.Builder builder = new ParentWithNullable.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Pet.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Pet.java index 4e6fec4f209d..f077901b3c06 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Pet.java @@ -284,5 +284,95 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Pet instance; + + public Builder() { + this(new Pet()); + } + + protected Builder(Pet instance) { + this.instance = instance; + } + + protected Builder copyOf(Pet value) { + this.instance.setId(value.id); + this.instance.setCategory(value.category); + this.instance.setName(value.name); + this.instance.setPhotoUrls(value.photoUrls); + this.instance.setTags(value.tags); + this.instance.setStatus(value.status); + return this; + } + + public Pet.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Pet.Builder category(Category category) { + this.instance.category(category); + return this; + } + + public Pet.Builder name(String name) { + this.instance.name(name); + return this; + } + + public Pet.Builder photoUrls(Set photoUrls) { + this.instance.photoUrls(photoUrls); + return this; + } + + public Pet.Builder tags(List<@Valid Tag> tags) { + this.instance.tags(tags); + return this; + } + + @Deprecated + public Pet.Builder status(StatusEnum status) { + this.instance.status(status); + return this; + } + @Deprecated + + /** + * returns a built Pet instance. + * + * The builder is not reusable (NullPointerException) + */ + public Pet build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Pet.Builder builder() { + return new Pet.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Pet.Builder toBuilder() { + Pet.Builder builder = new Pet.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ReadOnlyFirst.java index c4dee488a930..c681f43e9f7b 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ReadOnlyFirst.java @@ -104,5 +104,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ReadOnlyFirst instance; + + public Builder() { + this(new ReadOnlyFirst()); + } + + protected Builder(ReadOnlyFirst instance) { + this.instance = instance; + } + + protected Builder copyOf(ReadOnlyFirst value) { + this.instance.setBar(value.bar); + this.instance.setBaz(value.baz); + return this; + } + + public ReadOnlyFirst.Builder bar(String bar) { + this.instance.bar(bar); + return this; + } + + public ReadOnlyFirst.Builder baz(String baz) { + this.instance.baz(baz); + return this; + } + + /** + * returns a built ReadOnlyFirst instance. + * + * The builder is not reusable (NullPointerException) + */ + public ReadOnlyFirst build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ReadOnlyFirst.Builder builder() { + return new ReadOnlyFirst.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ReadOnlyFirst.Builder toBuilder() { + ReadOnlyFirst.Builder builder = new ReadOnlyFirst.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java index dafef938f076..ae21f7e50e73 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ResponseObjectWithDifferentFieldNames.java @@ -152,5 +152,81 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private ResponseObjectWithDifferentFieldNames instance; + + public Builder() { + this(new ResponseObjectWithDifferentFieldNames()); + } + + protected Builder(ResponseObjectWithDifferentFieldNames instance) { + this.instance = instance; + } + + protected Builder copyOf(ResponseObjectWithDifferentFieldNames value) { + this.instance.setNormalPropertyName(value.normalPropertyName); + this.instance.setUPPERCASEPROPERTYSNAKE(value.UPPER_CASE_PROPERTY_SNAKE); + this.instance.setLowerCasePropertyDashes(value.lowerCasePropertyDashes); + this.instance.setPropertyNameWithSpaces(value.propertyNameWithSpaces); + return this; + } + + public ResponseObjectWithDifferentFieldNames.Builder normalPropertyName(String normalPropertyName) { + this.instance.normalPropertyName(normalPropertyName); + return this; + } + + public ResponseObjectWithDifferentFieldNames.Builder UPPER_CASE_PROPERTY_SNAKE(String UPPER_CASE_PROPERTY_SNAKE) { + this.instance.UPPER_CASE_PROPERTY_SNAKE(UPPER_CASE_PROPERTY_SNAKE); + return this; + } + + public ResponseObjectWithDifferentFieldNames.Builder lowerCasePropertyDashes(String lowerCasePropertyDashes) { + this.instance.lowerCasePropertyDashes(lowerCasePropertyDashes); + return this; + } + + public ResponseObjectWithDifferentFieldNames.Builder propertyNameWithSpaces(String propertyNameWithSpaces) { + this.instance.propertyNameWithSpaces(propertyNameWithSpaces); + return this; + } + + /** + * returns a built ResponseObjectWithDifferentFieldNames instance. + * + * The builder is not reusable (NullPointerException) + */ + public ResponseObjectWithDifferentFieldNames build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static ResponseObjectWithDifferentFieldNames.Builder builder() { + return new ResponseObjectWithDifferentFieldNames.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ResponseObjectWithDifferentFieldNames.Builder toBuilder() { + ResponseObjectWithDifferentFieldNames.Builder builder = new ResponseObjectWithDifferentFieldNames.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/SpecialModelName.java index e4c8856cf7c5..bdbcd884347f 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/SpecialModelName.java @@ -82,5 +82,63 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private SpecialModelName instance; + + public Builder() { + this(new SpecialModelName()); + } + + protected Builder(SpecialModelName instance) { + this.instance = instance; + } + + protected Builder copyOf(SpecialModelName value) { + this.instance.set$SpecialPropertyName(value.$specialPropertyName); + return this; + } + + public SpecialModelName.Builder $specialPropertyName(Long $specialPropertyName) { + this.instance.$specialPropertyName($specialPropertyName); + return this; + } + + /** + * returns a built SpecialModelName instance. + * + * The builder is not reusable (NullPointerException) + */ + public SpecialModelName build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static SpecialModelName.Builder builder() { + return new SpecialModelName.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public SpecialModelName.Builder toBuilder() { + SpecialModelName.Builder builder = new SpecialModelName.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Tag.java index 1aa58e54b307..29d218fcfc25 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Tag.java @@ -104,5 +104,69 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private Tag instance; + + public Builder() { + this(new Tag()); + } + + protected Builder(Tag instance) { + this.instance = instance; + } + + protected Builder copyOf(Tag value) { + this.instance.setId(value.id); + this.instance.setName(value.name); + return this; + } + + public Tag.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public Tag.Builder name(String name) { + this.instance.name(name); + return this; + } + + /** + * returns a built Tag instance. + * + * The builder is not reusable (NullPointerException) + */ + public Tag build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static Tag.Builder builder() { + return new Tag.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public Tag.Builder toBuilder() { + Tag.Builder builder = new Tag.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderDefault.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderDefault.java index ee2790ac7c95..9062db776b85 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderDefault.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderDefault.java @@ -204,5 +204,87 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private TypeHolderDefault instance; + + public Builder() { + this(new TypeHolderDefault()); + } + + protected Builder(TypeHolderDefault instance) { + this.instance = instance; + } + + protected Builder copyOf(TypeHolderDefault value) { + this.instance.setStringItem(value.stringItem); + this.instance.setNumberItem(value.numberItem); + this.instance.setIntegerItem(value.integerItem); + this.instance.setBoolItem(value.boolItem); + this.instance.setArrayItem(value.arrayItem); + return this; + } + + public TypeHolderDefault.Builder stringItem(String stringItem) { + this.instance.stringItem(stringItem); + return this; + } + + public TypeHolderDefault.Builder numberItem(BigDecimal numberItem) { + this.instance.numberItem(numberItem); + return this; + } + + public TypeHolderDefault.Builder integerItem(Integer integerItem) { + this.instance.integerItem(integerItem); + return this; + } + + public TypeHolderDefault.Builder boolItem(Boolean boolItem) { + this.instance.boolItem(boolItem); + return this; + } + + public TypeHolderDefault.Builder arrayItem(List arrayItem) { + this.instance.arrayItem(arrayItem); + return this; + } + + /** + * returns a built TypeHolderDefault instance. + * + * The builder is not reusable (NullPointerException) + */ + public TypeHolderDefault build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static TypeHolderDefault.Builder builder() { + return new TypeHolderDefault.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public TypeHolderDefault.Builder toBuilder() { + TypeHolderDefault.Builder builder = new TypeHolderDefault.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderExample.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderExample.java index 728785d71ad1..edcd5d56253a 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderExample.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/TypeHolderExample.java @@ -229,5 +229,93 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private TypeHolderExample instance; + + public Builder() { + this(new TypeHolderExample()); + } + + protected Builder(TypeHolderExample instance) { + this.instance = instance; + } + + protected Builder copyOf(TypeHolderExample value) { + this.instance.setStringItem(value.stringItem); + this.instance.setNumberItem(value.numberItem); + this.instance.setFloatItem(value.floatItem); + this.instance.setIntegerItem(value.integerItem); + this.instance.setBoolItem(value.boolItem); + this.instance.setArrayItem(value.arrayItem); + return this; + } + + public TypeHolderExample.Builder stringItem(String stringItem) { + this.instance.stringItem(stringItem); + return this; + } + + public TypeHolderExample.Builder numberItem(BigDecimal numberItem) { + this.instance.numberItem(numberItem); + return this; + } + + public TypeHolderExample.Builder floatItem(Float floatItem) { + this.instance.floatItem(floatItem); + return this; + } + + public TypeHolderExample.Builder integerItem(Integer integerItem) { + this.instance.integerItem(integerItem); + return this; + } + + public TypeHolderExample.Builder boolItem(Boolean boolItem) { + this.instance.boolItem(boolItem); + return this; + } + + public TypeHolderExample.Builder arrayItem(List arrayItem) { + this.instance.arrayItem(arrayItem); + return this; + } + + /** + * returns a built TypeHolderExample instance. + * + * The builder is not reusable (NullPointerException) + */ + public TypeHolderExample build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static TypeHolderExample.Builder builder() { + return new TypeHolderExample.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public TypeHolderExample.Builder toBuilder() { + TypeHolderExample.Builder builder = new TypeHolderExample.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/User.java index 81ae1f82e67b..4fc36367c73c 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/User.java @@ -248,5 +248,105 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private User instance; + + public Builder() { + this(new User()); + } + + protected Builder(User instance) { + this.instance = instance; + } + + protected Builder copyOf(User value) { + this.instance.setId(value.id); + this.instance.setUsername(value.username); + this.instance.setFirstName(value.firstName); + this.instance.setLastName(value.lastName); + this.instance.setEmail(value.email); + this.instance.setPassword(value.password); + this.instance.setPhone(value.phone); + this.instance.setUserStatus(value.userStatus); + return this; + } + + public User.Builder id(Long id) { + this.instance.id(id); + return this; + } + + public User.Builder username(String username) { + this.instance.username(username); + return this; + } + + public User.Builder firstName(String firstName) { + this.instance.firstName(firstName); + return this; + } + + public User.Builder lastName(String lastName) { + this.instance.lastName(lastName); + return this; + } + + public User.Builder email(String email) { + this.instance.email(email); + return this; + } + + public User.Builder password(String password) { + this.instance.password(password); + return this; + } + + public User.Builder phone(String phone) { + this.instance.phone(phone); + return this; + } + + public User.Builder userStatus(Integer userStatus) { + this.instance.userStatus(userStatus); + return this; + } + + /** + * returns a built User instance. + * + * The builder is not reusable (NullPointerException) + */ + public User build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static User.Builder builder() { + return new User.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public User.Builder toBuilder() { + User.Builder builder = new User.Builder(); + return builder.copyOf(this); + } + } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/XmlItem.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/XmlItem.java index 0ccdee97a000..027719ae764e 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/XmlItem.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/XmlItem.java @@ -837,5 +837,231 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + public static class Builder { + + private XmlItem instance; + + public Builder() { + this(new XmlItem()); + } + + protected Builder(XmlItem instance) { + this.instance = instance; + } + + protected Builder copyOf(XmlItem value) { + this.instance.setAttributeString(value.attributeString); + this.instance.setAttributeNumber(value.attributeNumber); + this.instance.setAttributeInteger(value.attributeInteger); + this.instance.setAttributeBoolean(value.attributeBoolean); + this.instance.setWrappedArray(value.wrappedArray); + this.instance.setNameString(value.nameString); + this.instance.setNameNumber(value.nameNumber); + this.instance.setNameInteger(value.nameInteger); + this.instance.setNameBoolean(value.nameBoolean); + this.instance.setNameArray(value.nameArray); + this.instance.setNameWrappedArray(value.nameWrappedArray); + this.instance.setPrefixString(value.prefixString); + this.instance.setPrefixNumber(value.prefixNumber); + this.instance.setPrefixInteger(value.prefixInteger); + this.instance.setPrefixBoolean(value.prefixBoolean); + this.instance.setPrefixArray(value.prefixArray); + this.instance.setPrefixWrappedArray(value.prefixWrappedArray); + this.instance.setNamespaceString(value.namespaceString); + this.instance.setNamespaceNumber(value.namespaceNumber); + this.instance.setNamespaceInteger(value.namespaceInteger); + this.instance.setNamespaceBoolean(value.namespaceBoolean); + this.instance.setNamespaceArray(value.namespaceArray); + this.instance.setNamespaceWrappedArray(value.namespaceWrappedArray); + this.instance.setPrefixNsString(value.prefixNsString); + this.instance.setPrefixNsNumber(value.prefixNsNumber); + this.instance.setPrefixNsInteger(value.prefixNsInteger); + this.instance.setPrefixNsBoolean(value.prefixNsBoolean); + this.instance.setPrefixNsArray(value.prefixNsArray); + this.instance.setPrefixNsWrappedArray(value.prefixNsWrappedArray); + return this; + } + + public XmlItem.Builder attributeString(String attributeString) { + this.instance.attributeString(attributeString); + return this; + } + + public XmlItem.Builder attributeNumber(BigDecimal attributeNumber) { + this.instance.attributeNumber(attributeNumber); + return this; + } + + public XmlItem.Builder attributeInteger(Integer attributeInteger) { + this.instance.attributeInteger(attributeInteger); + return this; + } + + public XmlItem.Builder attributeBoolean(Boolean attributeBoolean) { + this.instance.attributeBoolean(attributeBoolean); + return this; + } + + public XmlItem.Builder wrappedArray(List wrappedArray) { + this.instance.wrappedArray(wrappedArray); + return this; + } + + public XmlItem.Builder nameString(String nameString) { + this.instance.nameString(nameString); + return this; + } + + public XmlItem.Builder nameNumber(BigDecimal nameNumber) { + this.instance.nameNumber(nameNumber); + return this; + } + + public XmlItem.Builder nameInteger(Integer nameInteger) { + this.instance.nameInteger(nameInteger); + return this; + } + + public XmlItem.Builder nameBoolean(Boolean nameBoolean) { + this.instance.nameBoolean(nameBoolean); + return this; + } + + public XmlItem.Builder nameArray(List nameArray) { + this.instance.nameArray(nameArray); + return this; + } + + public XmlItem.Builder nameWrappedArray(List nameWrappedArray) { + this.instance.nameWrappedArray(nameWrappedArray); + return this; + } + + public XmlItem.Builder prefixString(String prefixString) { + this.instance.prefixString(prefixString); + return this; + } + + public XmlItem.Builder prefixNumber(BigDecimal prefixNumber) { + this.instance.prefixNumber(prefixNumber); + return this; + } + + public XmlItem.Builder prefixInteger(Integer prefixInteger) { + this.instance.prefixInteger(prefixInteger); + return this; + } + + public XmlItem.Builder prefixBoolean(Boolean prefixBoolean) { + this.instance.prefixBoolean(prefixBoolean); + return this; + } + + public XmlItem.Builder prefixArray(List prefixArray) { + this.instance.prefixArray(prefixArray); + return this; + } + + public XmlItem.Builder prefixWrappedArray(List prefixWrappedArray) { + this.instance.prefixWrappedArray(prefixWrappedArray); + return this; + } + + public XmlItem.Builder namespaceString(String namespaceString) { + this.instance.namespaceString(namespaceString); + return this; + } + + public XmlItem.Builder namespaceNumber(BigDecimal namespaceNumber) { + this.instance.namespaceNumber(namespaceNumber); + return this; + } + + public XmlItem.Builder namespaceInteger(Integer namespaceInteger) { + this.instance.namespaceInteger(namespaceInteger); + return this; + } + + public XmlItem.Builder namespaceBoolean(Boolean namespaceBoolean) { + this.instance.namespaceBoolean(namespaceBoolean); + return this; + } + + public XmlItem.Builder namespaceArray(List namespaceArray) { + this.instance.namespaceArray(namespaceArray); + return this; + } + + public XmlItem.Builder namespaceWrappedArray(List namespaceWrappedArray) { + this.instance.namespaceWrappedArray(namespaceWrappedArray); + return this; + } + + public XmlItem.Builder prefixNsString(String prefixNsString) { + this.instance.prefixNsString(prefixNsString); + return this; + } + + public XmlItem.Builder prefixNsNumber(BigDecimal prefixNsNumber) { + this.instance.prefixNsNumber(prefixNsNumber); + return this; + } + + public XmlItem.Builder prefixNsInteger(Integer prefixNsInteger) { + this.instance.prefixNsInteger(prefixNsInteger); + return this; + } + + public XmlItem.Builder prefixNsBoolean(Boolean prefixNsBoolean) { + this.instance.prefixNsBoolean(prefixNsBoolean); + return this; + } + + public XmlItem.Builder prefixNsArray(List prefixNsArray) { + this.instance.prefixNsArray(prefixNsArray); + return this; + } + + public XmlItem.Builder prefixNsWrappedArray(List prefixNsWrappedArray) { + this.instance.prefixNsWrappedArray(prefixNsWrappedArray); + return this; + } + + /** + * returns a built XmlItem instance. + * + * The builder is not reusable (NullPointerException) + */ + public XmlItem build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static XmlItem.Builder builder() { + return new XmlItem.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public XmlItem.Builder toBuilder() { + XmlItem.Builder builder = new XmlItem.Builder(); + return builder.copyOf(this); + } + }