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 e1b5c883da213..1c7efa14ec828 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 0e88003e86031..7f60cf91dbde7 100644
--- a/docs/generators/java-helidon-client.md
+++ b/docs/generators/java-helidon-client.md
@@ -38,9 +38,10 @@ 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 version for generated code| |3.0.1|
+|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.|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|ignoreAnyOfInEnum|Ignore anyOf keyword in enum| |false|
|implicitHeaders|Skip header parameters in the generated API methods using @ApiImplicitParams annotation.| |false|
diff --git a/docs/generators/java-helidon-server.md b/docs/generators/java-helidon-server.md
index bb21f053b44f6..2035bb8c6fbd5 100644
--- a/docs/generators/java-helidon-server.md
+++ b/docs/generators/java-helidon-server.md
@@ -37,17 +37,18 @@ 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|
-|helidonVersion|Helidon version for generated code| |3.0.1|
+|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.|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|ignoreAnyOfInEnum|Ignore anyOf keyword in enum| |false|
|implicitHeaders|Skip header parameters in the generated API methods using @ApiImplicitParams annotation.| |false|
|implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null|
|invokerPackage|root package for generated code| |org.openapitools.server|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true|
-|library|library template (sub-template) to use|
**mp**
Helidon MP Server
**se**
Helidon SE Server
**nima**
Helidon NIMA Server
**nima-annotations**
Helidon NIMA Annotations Server
|se|
+|library|library template (sub-template) to use|
**mp**
Helidon MP Server
**se**
Helidon SE Server
|se|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.server.model|
diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md
index ef93ebfa9478a..c97cc488b150c 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 5a02be5ce719c..f8c968280ec48 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 dbf99b6d81d88..9cb2ad4dbbcb2 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 255ecb891ef59..dada45f96d53d 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 ee7ede5d0829d..52455c5fea16c 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 074ba58ea9469..6ecb576ac9013 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 91206d35863c6..bfdef88970f02 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 7bbf2cc6f1837..202f013209d0e 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 65af14ea9dc6a..3144df23e1a1b 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 8456d54beaabf..4592996516e13 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 91d46a8c3cb48..1ae178f9927c9 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 acf44d3854e6a..028280b456217 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 f62da7ca428d2..f990de40ddb65 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 e71f240e8766b..68d153daf2099 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 401db4e918ea7..f72c477c3b734 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 d0a73f242178a..89caf27c7ad34 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 81af0a811e185..d3b30f001e467 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 50bd75bc92977..8645361f84352 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 7204ab79be762..af6e8c0aa2dd0 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 1d45f8a1a1929..f1ff6d31bb66c 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 9bf9b50cfda00..6ae3b647ac67e 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-gradle-plugin/README.adoc b/modules/openapi-generator-gradle-plugin/README.adoc
index fb74722df473b..1dbc35ad84c21 100644
--- a/modules/openapi-generator-gradle-plugin/README.adoc
+++ b/modules/openapi-generator-gradle-plugin/README.adoc
@@ -545,9 +545,7 @@ openApiGenerate {
apiPackage.set("org.openapi.example.api")
invokerPackage.set("org.openapi.example.invoker")
modelPackage.set("org.openapi.example.model")
- configOptions.set([
- dateLibrary: "java8"
- ])
+ configOptions.put("dateLibrary", "java8")
}
----
diff --git a/modules/openapi-generator-gradle-plugin/build.gradle b/modules/openapi-generator-gradle-plugin/build.gradle
index f660266e856d7..90bf9dcc8d1e6 100644
--- a/modules/openapi-generator-gradle-plugin/build.gradle
+++ b/modules/openapi-generator-gradle-plugin/build.gradle
@@ -8,7 +8,7 @@ plugins {
id("java-gradle-plugin")
id("maven-publish")
id("org.gradle.kotlin.kotlin-dsl") version "2.4.1"
- id("org.jetbrains.kotlin.jvm") version "1.7.10"
+ id("org.jetbrains.kotlin.jvm") version "1.9.0"
id("signing")
}
@@ -26,8 +26,8 @@ specifications as part of your build. Other tasks are available as command line
java {
withSourcesJar()
withJavadocJar()
- sourceCompatibility = 1.11
- targetCompatibility = 1.11
+ sourceCompatibility = JavaVersion.VERSION_11
+ targetCompatibility = JavaVersion.VERSION_11
}
repositories {
@@ -41,7 +41,7 @@ repositories {
dependencies {
implementation("org.openapitools:openapi-generator:$openApiGeneratorVersion")
- testImplementation("org.jetbrains.kotlin:kotlin-test-testng:1.7.10")
+ testImplementation("org.jetbrains.kotlin:kotlin-test-testng:1.9.0")
}
tasks.named("test", Test).configure {
@@ -63,7 +63,7 @@ tasks.named("test", Test).configure {
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
- jvmTarget = "1.8"
+ jvmTarget = "11"
}
}
diff --git a/modules/openapi-generator-gradle-plugin/gradle/wrapper/gradle-wrapper.properties b/modules/openapi-generator-gradle-plugin/gradle/wrapper/gradle-wrapper.properties
index f398c33c4b08d..c7d437bbb476b 100644
--- a/modules/openapi-generator-gradle-plugin/gradle/wrapper/gradle-wrapper.properties
+++ b/modules/openapi-generator-gradle-plugin/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/modules/openapi-generator-gradle-plugin/pom.xml b/modules/openapi-generator-gradle-plugin/pom.xml
index 3e84f3d2f7318..e794d44cc1a91 100644
--- a/modules/openapi-generator-gradle-plugin/pom.xml
+++ b/modules/openapi-generator-gradle-plugin/pom.xml
@@ -17,8 +17,8 @@
true
- 7.6
- 7.3-20210825160000+0000
+ 7.6.4
+ 7.4.2
diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties
index 068cdb2dc260b..3994438e22920 100644
--- a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties
+++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskConfigurationCacheTest.kt b/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskConfigurationCacheTest.kt
index b1636e2b0aeae..b9ec75eb42934 100644
--- a/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskConfigurationCacheTest.kt
+++ b/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskConfigurationCacheTest.kt
@@ -20,7 +20,7 @@ class GenerateTaskConfigurationCacheTest : TestBase() {
}
@DataProvider(name = "gradle_version_provider")
- private fun gradleVersionProviderWithConfigurationCache(): Array> = arrayOf(arrayOf("8.1.1"), arrayOf("7.6"))
+ private fun gradleVersionProviderWithConfigurationCache(): Array> = arrayOf(arrayOf("8.7"), arrayOf("7.6.4"))
@DataProvider(name = "gradle_version_provider_without_cc")
private fun gradleVersionProviderWithoutConfigurationCache(): Array> = arrayOf(arrayOf("5.6.1"))
diff --git a/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskFromCacheTest.kt b/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskFromCacheTest.kt
index 9f73e0e388a32..e66f6264578d8 100644
--- a/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskFromCacheTest.kt
+++ b/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskFromCacheTest.kt
@@ -22,7 +22,7 @@ class GenerateTaskFromCacheTest : TestBase() {
}
@DataProvider(name = "gradle_version_provider")
- private fun gradleVersionProvider(): Array> = arrayOf(arrayOf("8.1.1"), arrayOf("7.6"))
+ private fun gradleVersionProvider(): Array> = arrayOf(arrayOf("8.7"), arrayOf("7.6.4"))
// inputSpec tests
diff --git a/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskUpToDateTest.kt b/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskUpToDateTest.kt
index 7cfe81fd27666..f8932c6bcc452 100644
--- a/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskUpToDateTest.kt
+++ b/modules/openapi-generator-gradle-plugin/src/test/kotlin/GenerateTaskUpToDateTest.kt
@@ -9,7 +9,7 @@ import kotlin.test.assertEquals
class GenerateTaskUpToDateTest : TestBase() {
@DataProvider(name = "gradle_version_provider")
- private fun gradleVersionProvider(): Array> = arrayOf(arrayOf("8.1.1"), arrayOf("7.6"))
+ private fun gradleVersionProvider(): Array> = arrayOf(arrayOf("8.7"), arrayOf("7.6.4"))
// inputSpec tests
diff --git a/modules/openapi-generator-gradle-plugin/src/test/kotlin/ValidateTaskDslTest.kt b/modules/openapi-generator-gradle-plugin/src/test/kotlin/ValidateTaskDslTest.kt
index aa80ed587f8e7..c6687bd69a014 100644
--- a/modules/openapi-generator-gradle-plugin/src/test/kotlin/ValidateTaskDslTest.kt
+++ b/modules/openapi-generator-gradle-plugin/src/test/kotlin/ValidateTaskDslTest.kt
@@ -17,8 +17,8 @@ class ValidateTaskDslTest : TestBase() {
@DataProvider(name = "gradle_version_provider")
fun gradleVersionProvider(): Array> = arrayOf(
arrayOf(null), // uses the version of Gradle used to build the plugin itself
- arrayOf("8.1.1"),
- arrayOf("7.6")
+ arrayOf("8.7"),
+ arrayOf("7.6.4")
)
private fun getGradleRunner(gradleVersion: String?): GradleRunner {
diff --git a/modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml b/modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml
index fdc0d5272e05e..ab59209425d30 100644
--- a/modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml
+++ b/modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml
@@ -19,7 +19,7 @@
0.2.12.71.0.0
- 4.13.2
+ 5.10.21.4
diff --git a/modules/openapi-generator-maven-plugin/pom.xml b/modules/openapi-generator-maven-plugin/pom.xml
index 29d1eb27ccd61..708c506dff910 100644
--- a/modules/openapi-generator-maven-plugin/pom.xml
+++ b/modules/openapi-generator-maven-plugin/pom.xml
@@ -59,8 +59,8 @@
${project.version}
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api${junit.version}test
diff --git a/modules/openapi-generator-maven-plugin/src/test/java/org/openapitools/codegen/plugin/CodeGenMojoTest.java b/modules/openapi-generator-maven-plugin/src/test/java/org/openapitools/codegen/plugin/CodeGenMojoTest.java
index 4881db21921bd..89dc94c4300a5 100644
--- a/modules/openapi-generator-maven-plugin/src/test/java/org/openapitools/codegen/plugin/CodeGenMojoTest.java
+++ b/modules/openapi-generator-maven-plugin/src/test/java/org/openapitools/codegen/plugin/CodeGenMojoTest.java
@@ -16,7 +16,7 @@
package org.openapitools.codegen.plugin;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.File;
import java.nio.file.Files;
diff --git a/modules/openapi-generator-online/pom.xml b/modules/openapi-generator-online/pom.xml
index fee18406f0f73..548ccb826cfdf 100644
--- a/modules/openapi-generator-online/pom.xml
+++ b/modules/openapi-generator-online/pom.xml
@@ -127,8 +127,8 @@
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api${junit.version}test
diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java
index 7cf052e308367..be5326278cb29 100644
--- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java
+++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java
@@ -118,14 +118,9 @@ private static String generate(String language, GeneratorInput opts, Type type)
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The OpenAPI specification supplied was not valid");
}
- String destPath = null;
-
- if (opts.getOptions() != null) {
- destPath = opts.getOptions().get("outputFolder");
- }
- if (destPath == null) {
- destPath = language + "-" + type.getTypeName();
- }
+ // do not use opts.getOptions().get("outputFolder") as the input can contain ../../
+ // to access other folders in the server
+ String destPath = language + "-" + type.getTypeName();
ClientOptInput clientOptInput = new ClientOptInput();
String outputFolder = getTmpFolder().getAbsolutePath() + File.separator + destPath;
diff --git a/modules/openapi-generator-online/src/test/java/org/openapitools/codegen/online/api/GenApiControllerTest.java b/modules/openapi-generator-online/src/test/java/org/openapitools/codegen/online/api/GenApiControllerTest.java
index 8df33829c9268..394f09ac844da 100644
--- a/modules/openapi-generator-online/src/test/java/org/openapitools/codegen/online/api/GenApiControllerTest.java
+++ b/modules/openapi-generator-online/src/test/java/org/openapitools/codegen/online/api/GenApiControllerTest.java
@@ -1,14 +1,14 @@
package org.openapitools.codegen.online.api;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.openapitools.codegen.online.model.ResponseCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
-import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.servlet.MockMvc;
import static org.hamcrest.Matchers.hasItem;
@@ -18,7 +18,7 @@
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
-@RunWith(SpringRunner.class)
+@ExtendWith(SpringExtension.class)
@WebMvcTest(GenApiController.class)
public class GenApiControllerTest {
diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml
index dbb884301b74c..15e0d19819bfe 100644
--- a/modules/openapi-generator/pom.xml
+++ b/modules/openapi-generator/pom.xml
@@ -299,6 +299,11 @@
commons-text${commons-text.version}
+
+ org.apache.maven.resolver
+ maven-resolver-util
+ ${resolver-util-version}
+ commons-clicommons-cli
@@ -322,10 +327,16 @@
com.tngtech.archunit
- archunit-junit4
+ archunit-junit5${archunit.version}test
+
+ org.junit.jupiter
+ junit-jupiter-api
+ ${junit.version}
+ test
+ org.testngtestng
@@ -386,6 +397,11 @@
jackson-datatype-joda${jackson.version}
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+ ${jackson.version}
+ com.github.joschi.jacksonjackson-datatype-threetenbp
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
index 1c0ac8ec20b4d..7882cc3ab04ba 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
@@ -17,7 +17,6 @@
package org.openapitools.codegen;
-import com.fasterxml.jackson.annotation.JsonCreator;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.Ticker;
@@ -26,7 +25,6 @@
import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Mustache.Compiler;
import com.samskivert.mustache.Mustache.Lambda;
-import io.swagger.v3.core.util.AnnotationsUtils;
import io.swagger.v3.core.util.Json;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
@@ -65,7 +63,6 @@
import org.openapitools.codegen.serializer.SerializerUtils;
import org.openapitools.codegen.templating.MustacheEngineAdapter;
import org.openapitools.codegen.templating.mustache.*;
-import org.openapitools.codegen.utils.CamelizeOption;
import org.openapitools.codegen.utils.ModelUtils;
import org.openapitools.codegen.utils.OneOfImplementorAdditionalData;
import org.slf4j.Logger;
@@ -2492,10 +2489,10 @@ protected String getSingleSchemaType(Schema schema) {
private String getPrimitiveType(Schema schema) {
if (schema == null) {
throw new RuntimeException("schema cannot be null in getPrimitiveType");
- } else if (typeMapping.containsKey(schema.getType() + "+" + schema.getFormat())) {
+ } else if (typeMapping.containsKey(ModelUtils.getType(schema) + "+" + schema.getFormat())) {
// allows custom type_format mapping.
// use {type}+{format}
- return typeMapping.get(schema.getType() + "+" + schema.getFormat());
+ return typeMapping.get(ModelUtils.getType(schema) + "+" + schema.getFormat());
} else if (ModelUtils.isNullType(schema)) {
// The 'null' type is allowed in OAS 3.1 and above. It is not supported by OAS 3.0.x,
// though this tooling supports it.
@@ -2536,7 +2533,7 @@ private String getPrimitiveType(Schema schema) {
} else if (ModelUtils.isShortSchema(schema)) {// int32
return "integer";
} else {
- return schema.getType(); // integer
+ return ModelUtils.getType(schema); // integer
}
} else if (ModelUtils.isMapSchema(schema)) {
return "map";
@@ -2567,11 +2564,11 @@ private String getPrimitiveType(Schema schema) {
return "object";
} else if (ModelUtils.isAnyType(schema)) {
return "AnyType";
- } else if (StringUtils.isNotEmpty(schema.getType())) {
- if (!schemaMapping.containsKey(schema.getType())) {
- LOGGER.warn("Unknown type found in the schema: {}. To map it, please use the schema mapping option (e.g. --schema-mappings in CLI)", schema.getType());
+ } else if (StringUtils.isNotEmpty(ModelUtils.getType(schema))) {
+ if (!schemaMapping.containsKey(ModelUtils.getType(schema))) {
+ LOGGER.warn("Unknown type found in the schema: {}. To map it, please use the schema mapping option (e.g. --schema-mappings in CLI)", ModelUtils.getType(schema));
}
- return schema.getType();
+ return ModelUtils.getType(schema);
}
// The 'type' attribute has not been set in the OAS schema, which means the value
// can be an arbitrary type, e.g. integer, string, object, array, number...
@@ -2945,11 +2942,7 @@ private void mergeProperties(Map existingProperties, Map
- existingProperties.put(
- key,
- ModelUtils.cloneSchema(value, specVersionGreaterThanOrEqualTo310(openAPI))
- ));
+ newProperties.forEach((key, value) -> existingProperties.put(key, ModelUtils.cloneSchema(value)));
if (null != existingType && null != newType && null != newType.getEnum() && !newType.getEnum().isEmpty()) {
for (Object e : newType.getEnum()) {
// ensure all interface enum types are added to schema
@@ -4019,10 +4012,10 @@ public CodegenProperty fromProperty(String name, Schema p, boolean required, boo
property.name = toVarName(name);
property.baseName = name;
- if (p.getType() == null) {
+ if (ModelUtils.getType(p) == null) {
property.openApiType = getSchemaType(p);
} else {
- property.openApiType = p.getType();
+ property.openApiType = ModelUtils.getType(p);
}
property.nameInPascalCase = camelize(property.name);
property.nameInCamelCase = camelize(property.name, LOWERCASE_FIRST_LETTER);
@@ -7128,7 +7121,7 @@ public List fromRequestBodyToFormParameters(RequestBody body,
Schema original = null;
// check if it's allOf (only 1 sub schema) with or without default/nullable/etc set in the top level
if (ModelUtils.isAllOf(schema) && schema.getAllOf().size() == 1 &&
- schema.getType() == null && schema.getTypes() == null) {
+ ModelUtils.getType(schema) == null) {
if (schema.getAllOf().get(0) instanceof Schema) {
original = schema;
schema = (Schema) schema.getAllOf().get(0);
@@ -7781,7 +7774,7 @@ public CodegenParameter fromRequestBody(RequestBody body, Set imports, S
Schema original = null;
// check if it's allOf (only 1 sub schema) with or without default/nullable/etc set in the top level
if (ModelUtils.isAllOf(schema) && schema.getAllOf().size() == 1 &&
- schema.getType() == null && schema.getTypes() == null) {
+ ModelUtils.getType(schema) == null) {
if (schema.getAllOf().get(0) instanceof Schema) {
original = schema;
schema = (Schema) schema.getAllOf().get(0);
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java
index b65a5fbd5d68a..416dba5a8ac28 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java
@@ -442,7 +442,7 @@ private void generateModel(List files, Map models, String
}
}
- void generateModels(List files, List allModels, List unusedModels) {
+ void generateModels(List files, List allModels, List unusedModels, List aliasModels) {
if (!generateModels) {
// TODO: Process these anyway and add to dryRun info
LOGGER.info("Skipping generation of models.");
@@ -567,6 +567,8 @@ void generateModels(List files, List allModels, List unu
CodegenModel m = modelTemplate.getModel();
if (m.isAlias) {
// alias to number, string, enum, etc, which should not be generated as model
+ // but aliases are still used to dereference models in some languages (such as in html2).
+ aliasModels.add(modelTemplate); // Store aliases in the separate list.
continue; // Don't create user-defined classes for aliases
}
}
@@ -1074,11 +1076,11 @@ private void generateSupportingFiles(List files, Map bundl
generateVersionMetadata(files);
}
- Map buildSupportFileBundle(List allOperations, List allModels) {
- return this.buildSupportFileBundle(allOperations, allModels, null);
+ Map buildSupportFileBundle(List allOperations, List allModels, List aliasModels) {
+ return this.buildSupportFileBundle(allOperations, allModels, aliasModels, null);
}
- Map buildSupportFileBundle(List allOperations, List allModels, List allWebhooks) {
+ Map buildSupportFileBundle(List allOperations, List allModels, List aliasModels, List allWebhooks) {
Map bundle = new HashMap<>(config.additionalProperties());
bundle.put("apiPackage", config.apiPackage());
@@ -1100,6 +1102,7 @@ Map buildSupportFileBundle(List allOperations, Li
bundle.put("apiInfo", apis);
bundle.put("webhooks", allWebhooks);
bundle.put("models", allModels);
+ bundle.put("aliasModels", aliasModels);
bundle.put("apiFolder", config.apiPackage().replace('.', File.separatorChar));
bundle.put("modelPackage", config.modelPackage());
bundle.put("library", config.getLibrary());
@@ -1225,7 +1228,8 @@ public List generate() {
// models
List filteredSchemas = ModelUtils.getSchemasUsedOnlyInFormParam(openAPI);
List allModels = new ArrayList<>();
- generateModels(files, allModels, filteredSchemas);
+ List aliasModels = new ArrayList<>();
+ generateModels(files, allModels, filteredSchemas, aliasModels);
// apis
List allOperations = new ArrayList<>();
generateApis(files, allOperations, allModels);
@@ -1233,7 +1237,7 @@ public List generate() {
List allWebhooks = new ArrayList<>();
generateWebhooks(files, allWebhooks, allModels);
// supporting files
- Map bundle = buildSupportFileBundle(allOperations, allModels, allWebhooks);
+ Map bundle = buildSupportFileBundle(allOperations, allModels, aliasModels, allWebhooks);
generateSupportingFiles(files, bundle);
if (dryRun) {
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/examples/ExampleGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/examples/ExampleGenerator.java
index e5a041c2010a0..48ade3ebc5c28 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/examples/ExampleGenerator.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/examples/ExampleGenerator.java
@@ -377,7 +377,7 @@ private Object resolveModelToExample(String name, String mediaType, Schema schem
return null;
}
return resolvePropertyToExample(name, mediaType, found.get(), processedModels);
- } else if (ModelUtils.isArraySchema(schema)) {
+ } else if (ModelUtils.isArraySchema(schema) || ModelUtils.isEnumSchema(schema)) {
return resolvePropertyToExample(schema.getName(), mediaType, schema, processedModels);
} else {
// TODO log an error message as the model does not have any properties
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 66e06e70180f2..0ca8bcc2b360e 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).");
@@ -607,7 +613,9 @@ public void processOpts() {
importMapping.put("JsonIgnore", "com.fasterxml.jackson.annotation.JsonIgnore");
importMapping.put("JsonIgnoreProperties", "com.fasterxml.jackson.annotation.JsonIgnoreProperties");
importMapping.put("JsonInclude", "com.fasterxml.jackson.annotation.JsonInclude");
- importMapping.put("JsonNullable", "org.openapitools.jackson.nullable.JsonNullable");
+ if (openApiNullable) {
+ importMapping.put("JsonNullable", "org.openapitools.jackson.nullable.JsonNullable");
+ }
importMapping.put("SerializedName", "com.google.gson.annotations.SerializedName");
importMapping.put("TypeAdapter", "com.google.gson.TypeAdapter");
importMapping.put("JsonAdapter", "com.google.gson.annotations.JsonAdapter");
@@ -684,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.
@@ -777,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/AbstractPythonCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java
index 7808c7ffb29a3..36b74be9578b6 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java
@@ -992,7 +992,10 @@ private ModelsMap postProcessModelsMap(ModelsMap objs) {
enumVars.put("name", toEnumVariableName((String) enumVars.get("value"), "str"));
} else {
model.vendorExtensions.putIfAbsent("x-py-enum-type", "int");
- enumVars.put("name", toEnumVariableName((String) enumVars.get("value"), "int"));
+ // Do not overwrite the variable name if already set through x-enum-varnames
+ if (model.vendorExtensions.get("x-enum-varnames") == null) {
+ enumVars.put("name", toEnumVariableName((String) enumVars.get("value"), "int"));
+ }
}
}
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonConnexionServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonConnexionServerCodegen.java
index d24fbcabb9550..e6480bac8d3f3 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonConnexionServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonConnexionServerCodegen.java
@@ -408,8 +408,14 @@ public void preprocessOpenAPI(OpenAPI openAPI) {
}
if (operation.getParameters() != null) {
for (Parameter parameter : operation.getParameters()) {
+ if (StringUtils.isNotEmpty(parameter.get$ref())) {
+ parameter = ModelUtils.getReferencedParameter(openAPI, parameter);
+ }
String swaggerParameterName = parameter.getName();
String pythonParameterName = this.toParamName(swaggerParameterName);
+ if (swaggerParameterName == null) {
+ throw new RuntimeException("Please report the issue as the parameter name cannot be null: " + parameter);
+ }
if (!swaggerParameterName.equals(pythonParameterName)) {
LOGGER.warn(
"Parameter name '{}' is not consistent with Python variable names. It will be replaced by '{}'",
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java
index 92638aaec3c88..1d1084596b28d 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java
@@ -70,7 +70,10 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
/** std:map (for map) */
private static final String STD_MAP = "std::map";
- /** std:vector (for array, set) */
+ /** std:set (for set) */
+ private static final String STD_SET = "std::set";
+
+ /** std:vector (for array) */
private static final String STD_VECTOR = "std::vector";
@Override
@@ -148,7 +151,7 @@ public CppPistacheServerCodegen() {
typeMapping.put("boolean", "bool");
typeMapping.put("array", STD_VECTOR);
typeMapping.put("map", STD_MAP);
- typeMapping.put("set", STD_VECTOR);
+ typeMapping.put("set", STD_SET);
typeMapping.put("file", STD_STRING);
typeMapping.put("object", NLOHMANN_JSON);
typeMapping.put("binary", STD_STRING);
@@ -161,6 +164,7 @@ public CppPistacheServerCodegen() {
super.importMapping = new HashMap<>();
importMapping.put(STD_VECTOR, "#include ");
importMapping.put(STD_MAP, "#include
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api${junit-version}test
@@ -366,6 +365,6 @@
{{#useBeanValidation}}
3.0.2
{{/useBeanValidation}}
- 4.13.2
+ 5.10.2
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/api_test.mustache
index f4bac8ac54350..bfb939f955289 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/api_test.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/api_test.mustache
@@ -4,8 +4,8 @@ package {{package}};
{{#imports}}import {{import}};
{{/imports}}
-import org.junit.Test;
-import org.junit.Ignore;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.time.LocalDate;
@@ -18,12 +18,12 @@ import java.util.Map;
/**
* API tests for {{classname}}
*/
-@Ignore
public class {{classname}}Test {
private final {{classname}} api = new {{classname}}();
- {{#operations}}{{#operation}}
+ {{#operations}}
+ {{#operation}}
/**
* {{summary}}
*
@@ -37,9 +37,12 @@ public class {{classname}}Test {
{{#allParams}}
{{{dataType}}} {{paramName}} = null;
{{/allParams}}
- {{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
+ // uncomment below to test the API function
+ //{{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
// TODO: test validations
}
- {{/operation}}{{/operations}}
+
+ {{/operation}}
+ {{/operations}}
}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache
index 8444791d7d49e..0bbe3ae51438a 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache
@@ -63,7 +63,7 @@
org.apache.maven.pluginsmaven-surefire-plugin
- 2.12
+ 2.22.2
@@ -73,7 +73,6 @@
-Xms512m -Xmx1500mmethods
- pertest
@@ -295,8 +294,8 @@
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api${junit-version}test
@@ -326,6 +325,6 @@
1.3.5
{{/useJakartaEe}}
1.0.0
- 4.13.2
+ 5.10.2
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api_test.mustache
index a6567c3eba01a..d9af87719b475 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api_test.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api_test.mustache
@@ -4,9 +4,13 @@ package {{package}};
{{#imports}}import {{import}};
{{/imports}}
-import org.junit.Test;
-import org.junit.Before;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
+{{#generateSpringBootApplication}}
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+{{/generateSpringBootApplication}}
import org.eclipse.microprofile.rest.client.RestClientBuilder;
@@ -26,7 +30,7 @@ import java.util.Set;
* API tests for {{classname}}
*/
{{#generateSpringBootApplication}}
-@RunWith(SpringJUnit4ClassRunner.class)
+@ExtendWith(SpringExtension.class)
@SpringApplicationConfiguration(classes = SpringBootApplication.class)
@WebAppConfiguration
@IntegrationTest("server.port=0")
@@ -36,7 +40,7 @@ public class {{classname}}Test {
private {{classname}} client;
private String baseUrl = "http://localhost:9080";
- @Before
+ @BeforeEach
public void setup() throws MalformedURLException {
{{#microprofile3}}
// TODO initialize the client
@@ -69,7 +73,7 @@ public class {{classname}}Test {
{{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}}
{{/allParams}}
//{{^vendorExtensions.x-java-is-response-void}}{{#microprofileMutiny}}Uni<{{{returnType}}}>{{/microprofileMutiny}}{{^microprofileMutiny}}{{{returnType}}}{{/microprofileMutiny}} response = {{/vendorExtensions.x-java-is-response-void}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
- //{{#returnType}}assertNotNull(response);{{/returnType}}
+ //{{#returnType}}Assertions.assertNotNull(response);{{/returnType}}
}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/kumuluzee.pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/kumuluzee.pom.mustache
index ac235b7edf597..195aa9d445451 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/kumuluzee.pom.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/kumuluzee.pom.mustache
@@ -18,7 +18,7 @@
1.2.31.4.13.2.6
- 4.13
+ 5.10.22.28
@@ -70,8 +70,8 @@
${cxf-rt-rs-extension-providers.version}
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api${junit-version}test
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache
index c91673c896c2e..47aa6b9e2349b 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache
@@ -58,9 +58,9 @@
-
- junit
- junit
+
+ org.junit.jupiter
+ junit-jupiter-api${junit.version}test
@@ -212,7 +212,7 @@
${java.version}1.5.189.2.9.v20150224
- 4.13.2
+ 5.10.21.4.14
{{#useBeanValidation}}
3.0.2
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom_3.0.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom_3.0.mustache
index 038b0e28a2397..3cda34fa7ecbf 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom_3.0.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom_3.0.mustache
@@ -58,9 +58,9 @@
-
- junit
- junit
+
+ org.junit.jupiter
+ junit-jupiter-api${junit.version}test
@@ -205,7 +205,7 @@
${java.version}1.5.189.2.9.v20150224
- 4.13.2
+ 5.10.21.4.14
{{#useBeanValidation}}
3.0.1
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/api_test.mustache
index dc56ce78474d4..a4121a475c323 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/native/api_test.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/api_test.mustache
@@ -5,8 +5,8 @@ package {{package}};
import {{invokerPackage}}.ApiException;
{{#imports}}import {{import}};
{{/imports}}
-import org.junit.Test;
-import org.junit.Ignore;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.HashMap;
@@ -21,7 +21,7 @@ import java.util.concurrent.CompletableFuture;
/**
* API tests for {{classname}}
*/
-@Ignore
+@Disabled
public class {{classname}}Test {
private final {{classname}} api = new {{classname}}();
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/build.gradle.mustache
index f0a051ee90c24..b706f454f4ad9 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/native/build.gradle.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/build.gradle.mustache
@@ -74,7 +74,7 @@ ext {
{{/swagger2AnnotationLibrary}}
jackson_version = "2.14.1"
jakarta_annotation_version = "1.3.5"
- junit_version = "4.13.2"
+ junit_version = "5.10.2"
{{#hasFormParamsInSpec}}
httpmime_version = "4.5.13"
{{/hasFormParamsInSpec}}
@@ -97,7 +97,7 @@ dependencies {
{{#hasFormParamsInSpec}}
implementation "org.apache.httpcomponents:httpmime:$httpmime_version"
{{/hasFormParamsInSpec}}
- testImplementation "junit:junit:$junit_version"
+ testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
}
// Use spotless plugin to automatically format code, remove unused import, etc
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 c440057eb76ec..15bd2f96d2446 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/libraries/native/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/pom.mustache
index a8be8d1ed9995..d79f088193e67 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/native/pom.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/pom.mustache
@@ -64,7 +64,7 @@
maven-surefire-plugin
- 3.0.0-M7
+ 3.2.5conf/log4j.properties
@@ -265,8 +265,8 @@
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api${junit-version}test
@@ -293,7 +293,7 @@
{{#hasFormParamsInSpec}}
4.5.14
{{/hasFormParamsInSpec}}
- 4.13.2
+ 5.10.22.27.2
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/anyof_model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/anyof_model.mustache
index 33d93192d4cd0..18447fc12d0f0 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/anyof_model.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/anyof_model.mustache
@@ -54,8 +54,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/isArray}}
{{#isArray}}
- final Type typeInstance = new TypeToken<{{{dataType}}}>(){}.getType();
- final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance));
+ final Type typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = new TypeToken<{{{dataType}}}>(){}.getType();
+ final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}));
{{/isArray}}
{{/anyOf}}
{{/composedSchemas}}
@@ -210,13 +210,11 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
}
- {{#anyOf}}
- public {{classname}}({{{.}}} o) {
+ public {{classname}}(Object o) {
super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
setActualInstance(o);
}
- {{/anyOf}}
static {
{{#composedSchemas}}
{{#anyOf}}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache
index 71dbcc85300c9..859d322d08eae 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache
@@ -135,9 +135,9 @@ dependencies {
implementation 'io.swagger.parser.v3:swagger-parser-v3:2.0.30'
{{/dynamicOperations}}
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
- testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1'
+ testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testImplementation 'org.mockito:mockito-core:3.12.4'
- testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1'
+ testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
}
javadoc {
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache
index 05ec20bff2c57..68d9e7fc8efa8 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache
@@ -35,7 +35,7 @@ lazy val root = (project in file(".")).
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
- "org.junit.jupiter" % "junit-jupiter-api" % "5.9.1" % "test",
+ "org.junit.jupiter" % "junit-jupiter-api" % "5.10.2" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test",
"org.mockito" % "mockito-core" % "3.12.4" % "test"
)
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/oneof_model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/oneof_model.mustache
index 4a34934dce772..31c63263e1c28 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/oneof_model.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/oneof_model.mustache
@@ -48,15 +48,21 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{#composedSchemas}}
{{#oneOf}}
{{^isArray}}
+ {{^isMap}}
{{^vendorExtensions.x-duplicated-data-type}}
final TypeAdapter<{{{dataType}}}> adapter{{{dataType}}} = gson.getDelegateAdapter(this, TypeToken.get({{{dataType}}}.class));
{{/vendorExtensions.x-duplicated-data-type}}
+ {{/isMap}}
{{/isArray}}
{{#isArray}}
- final Type typeInstance = new TypeToken<{{{dataType}}}>(){}.getType();
- final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance));
+ final Type typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = new TypeToken<{{{dataType}}}>(){}.getType();
+ final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}));
{{/isArray}}
+ {{#isMap}}
+ final Type typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = new TypeToken<{{{dataType}}}>(){}.getType();
+ final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}));
+ {{/isMap}}
{{/oneOf}}
{{/composedSchemas}}
@@ -72,11 +78,18 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{#oneOf}}
{{^vendorExtensions.x-duplicated-data-type}}
// check if the actual instance is of the type `{{{dataType}}}`
- if (value.getActualInstance() instanceof {{#isArray}}List>{{/isArray}}{{^isArray}}{{{dataType}}}{{/isArray}}) {
+ if (value.getActualInstance() instanceof {{#isArray}}List>{{/isArray}}{{#isMap}}Map, ?>{{/isMap}}{{^isMap}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isMap}}) {
{{#isPrimitiveType}}
+ {{^isMap}}
JsonPrimitive primitive = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}.toJsonTree(({{{dataType}}})value.getActualInstance()).getAsJsonPrimitive();
elementAdapter.write(out, primitive);
return;
+ {{/isMap}}
+ {{#isMap}}
+ JsonObject object = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}.toJsonTree(({{{dataType}}})value.getActualInstance()).getAsJsonObject();
+ elementAdapter.write(out, object);
+ return;
+ {{/isMap}}
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{#isArray}}
@@ -88,6 +101,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
}
{{/isArray}}
{{/isPrimitiveType}}
+ {{^isMap}}
{{^isArray}}
{{^isPrimitiveType}}
JsonElement element = adapter{{{dataType}}}.toJsonTree(({{{dataType}}})value.getActualInstance());
@@ -95,6 +109,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
return;
{{/isPrimitiveType}}
{{/isArray}}
+ {{/isMap}}
}
{{/vendorExtensions.x-duplicated-data-type}}
{{/oneOf}}
@@ -143,6 +158,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
try {
// validate the JSON object to see if any exception is thrown
{{^isArray}}
+ {{^isMap}}
{{#isNumber}}
if (!jsonElement.getAsJsonPrimitive().isNumber()) {
throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
@@ -163,6 +179,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
actualAdapter = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}};
{{/isPrimitiveType}}
{{/isNumber}}
+ {{/isMap}}
{{/isArray}}
{{#isArray}}
if (!jsonElement.isJsonArray()) {
@@ -194,6 +211,38 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
}
actualAdapter = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}};
{{/isArray}}
+ {{#isMap}}
+ if (!jsonElement.isJsonObject()) {
+ throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString()));
+ }
+
+ {{^isFreeFormObject}}
+ Map map = jsonElement.getAsJsonObject().asMap();
+ // validate map items
+ for(JsonElement element : map.values()) {
+ {{#items}}
+ {{#isNumber}}
+ if (!jsonElement.getAsJsonPrimitive().isNumber()) {
+ throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
+ }
+ {{/isNumber}}
+ {{^isNumber}}
+ {{#isPrimitiveType}}
+ if (!element.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) {
+ throw new IllegalArgumentException(String.format("Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
+ }
+ {{/isPrimitiveType}}
+ {{/isNumber}}
+ {{^isNumber}}
+ {{^isPrimitiveType}}
+ {{{dataType}}}.validateJsonElement(element);
+ {{/isPrimitiveType}}
+ {{/isNumber}}
+ {{/items}}
+ }
+ {{/isFreeFormObject}}
+ actualAdapter = adapter{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}};
+ {{/isMap}}
match++;
log.log(Level.FINER, "Input data matches schema '{{{dataType}}}'");
} catch (Exception e) {
@@ -239,13 +288,11 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
}
- {{#oneOf}}
- public {{classname}}({{{.}}} o) {
+ public {{classname}}(Object o) {
super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
setActualInstance(o);
}
- {{/oneOf}}
static {
{{#composedSchemas}}
{{#oneOf}}
@@ -280,7 +327,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{#composedSchemas}}
{{#oneOf}}
{{^vendorExtensions.x-duplicated-data-type}}
- if (instance instanceof {{#isArray}}List>{{/isArray}}{{^isArray}}{{{dataType}}}{{/isArray}}) {
+ if (instance instanceof {{#isArray}}List>{{/isArray}}{{#isMap}}Map, ?>{{/isMap}}{{^isMap}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isMap}}) {
{{#isArray}}
List> list = (List>) instance;
if (list.get(0) instanceof {{{items.dataType}}}) {
@@ -322,7 +369,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
* @return The actual instance of `{{{dataType}}}`
* @throws ClassCastException if the instance is not `{{{dataType}}}`
*/
- public {{{dataType}}} get{{#isArray}}{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}{{/isArray}}{{^isArray}}{{{dataType}}}{{/isArray}}() throws ClassCastException {
+ public {{{dataType}}} get{{#sanitizeGeneric}}{{{dataType}}}{{/sanitizeGeneric}}() throws ClassCastException {
return ({{{dataType}}})super.getActualInstance();
}
{{/vendorExtensions.x-duplicated-data-type}}
@@ -345,6 +392,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
// validate the json string with {{{dataType}}}
try {
{{^hasVars}}
+ {{^isMap}}
{{^isArray}}
{{#isNumber}}
if (!jsonElement.getAsJsonPrimitive().isNumber()) {
@@ -364,6 +412,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/isPrimitiveType}}
{{/isNumber}}
{{/isArray}}
+ {{/isMap}}
{{#isArray}}
if (!jsonElement.isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString()));
@@ -392,6 +441,37 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/items}}
}
{{/isArray}}
+ {{#isMap}}
+ if (!jsonElement.isJsonObject()) {
+ throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString()));
+ }
+
+ {{^isFreeFormObject}}
+ Map map = jsonElement.getAsJsonObject().asMap();
+ // validate map items
+ for(JsonElement element : map.values()) {
+ {{#items}}
+ {{#isNumber}}
+ if (!jsonElement.getAsJsonPrimitive().isNumber()) {
+ throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
+ }
+ {{/isNumber}}
+ {{^isNumber}}
+ {{#isPrimitiveType}}
+ if (!element.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) {
+ throw new IllegalArgumentException(String.format("Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
+ }
+ {{/isPrimitiveType}}
+ {{/isNumber}}
+ {{^isNumber}}
+ {{^isPrimitiveType}}
+ {{{dataType}}}.validateJsonElement(element);
+ {{/isPrimitiveType}}
+ {{/isNumber}}
+ {{/items}}
+ }
+ {{/isFreeFormObject}}
+ {{/isMap}}
{{/hasVars}}
{{#hasVars}}
{{{.}}}.validateJsonElement(jsonElement);
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache
index 7d2d6337336c6..36f91f2592c47 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache
@@ -438,7 +438,7 @@
{{#useBeanValidation}}
3.0.2
{{/useBeanValidation}}
- 5.10.0
+ 5.10.21.10.02.1.11.1.1
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache
index 76c43913474e1..483cf84422add 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache
@@ -106,7 +106,8 @@ ext {
jakarta_annotation_version = "1.3.5"
threetenbp_version = "2.9.10"
resteasy_version = "4.5.11.Final"
- junit_version = "4.13"
+ assertj_version = "3.23.1"
+ junit_version = "5.10.2"
}
dependencies {
@@ -124,5 +125,6 @@ dependencies {
{{/openApiNullable}}
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
- testImplementation "junit:junit:$junit_version"
+ testImplementation "org.assertj:assertj-core:$assertj_version"
+ testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.sbt.mustache
index 3e1de7399e1fe..aa656c54f086b 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.sbt.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.sbt.mustache
@@ -19,7 +19,8 @@ lazy val root = (project in file(".")).
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.10" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
- "junit" % "junit" % "4.13" % "test",
+ "org.assertj" % "assertj-core" % "3.23.1" % "test",
+ "junit" % "junit" % "5.10.2" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
)
)
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache
index 80e6bc49d4ddc..3674b48b9903b 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache
@@ -61,7 +61,7 @@
org.apache.maven.pluginsmaven-surefire-plugin
- 2.12
+ 2.22.2
@@ -71,7 +71,6 @@
-Xms512m -Xmx1500mmethods
- pertest
@@ -278,8 +277,14 @@
- junit
- junit
+ org.assertj
+ assertj-core
+ ${assertj-version}
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-api${junit-version}test
@@ -306,6 +311,7 @@
{{/useJakartaEe}}
2.9.101.0.0
- 4.13
+ 3.23.1
+ 5.10.2
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/api_test.mustache
index 8698cdcb84d20..771b84de22329 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/api_test.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/api_test.mustache
@@ -3,8 +3,8 @@ package {{package}};
import {{invokerPackage}}.ApiClient;
{{#imports}}import {{import}};
{{/imports}}
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.HashMap;
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache
index c745392012f4c..f0df804e264c0 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache
@@ -680,54 +680,54 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
private final Map authentications = new LinkedHashMap<>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
- public void add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String username, String password) {
+ public void add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String username, String password) {
HttpBasicAuth auth = new HttpBasicAuth();
auth.setUsername(username);
auth.setPassword(password);
authentications.put("{{name}}", auth);
}{{/isBasicBasic}}{{#isBasicBearer}}
- public void add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String bearerToken) {
+ public void add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String bearerToken) {
HttpBearerAuth auth = new
HttpBearerAuth("{{scheme}}");
auth.setBearerToken(bearerToken);
authentications.put("{{name}}", auth);
}{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
- public void add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String apikey, String apiKeyPrefix) {
+ public void add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String apikey, String apiKeyPrefix) {
ApiKeyAuth auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}},"{{keyParamName}}");
auth.setApiKey(apikey);
auth.setApiKeyPrefix(apiKeyPrefix);
authentications.put("{{name}}", auth);
}{{/isApiKey}}{{#isOAuth}}
- public void add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String accessToken) {
+ public void add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String accessToken) {
OAuth auth = new OAuth();
auth.setAccessToken(accessToken);
authentications.put("{{name}}", auth);
}{{/isOAuth}}{{/authMethods}}{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
- public static AuthInfo for{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}(String username, String password) {
+ public static AuthInfo for{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}(String username, String password) {
AuthInfo authInfo = new AuthInfo();
- authInfo.add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(username, password);
+ authInfo.add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(username, password);
return authInfo;
}{{/isBasicBasic}}{{#isBasicBearer}}
- public static AuthInfo for{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String bearerToken) {
+ public static AuthInfo for{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String bearerToken) {
AuthInfo authInfo = new AuthInfo();
- authInfo.add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(bearerToken);
+ authInfo.add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(bearerToken);
return authInfo;
}{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
- public static AuthInfo for{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String apikey, String apiKeyPrefix) {
+ public static AuthInfo for{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String apikey, String apiKeyPrefix) {
AuthInfo authInfo = new AuthInfo();
- authInfo.add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(apikey, apiKeyPrefix);
+ authInfo.add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(apikey, apiKeyPrefix);
return authInfo;
}{{/isApiKey}}{{#isOAuth}}
- public static AuthInfo for{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String accessToken) {
+ public static AuthInfo for{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(String accessToken) {
AuthInfo authInfo = new AuthInfo();
- authInfo.add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(accessToken);
+ authInfo.add{{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication(accessToken);
return authInfo;
}{{/isOAuth}}{{/authMethods}}
}
diff --git a/modules/openapi-generator/src/main/resources/Java/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/pojo.mustache
index 8cee0ac5a5657..d4c6ec8d1540f 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/JavaJaxRS/beanValidation.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/beanValidation.mustache
index 29d193fe33741..efd11d223ff5e 100644
--- a/modules/openapi-generator/src/main/resources/JavaJaxRS/beanValidation.mustache
+++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/beanValidation.mustache
@@ -1 +1 @@
-{{#required}}@NotNull {{/required}}{{^isPrimitiveType}}{{^isDate}}{{^isDateTime}}{{^isString}}{{^isFile}}@Valid {{/isFile}}{{/isString}}{{/isDateTime}}{{/isDate}}{{/isPrimitiveType}}{{>beanValidationCore}}
\ No newline at end of file
+{{#required}}@NotNull {{/required}}{{#isContainer}}{{^items.isPrimitiveType}}{{^items.isDate}}{{^items.isDateTime}}{{^items.isString}}{{^items.isFile}}{{^items.isEnumOrRef}}@Valid {{/items.isEnumOrRef}}{{/items.isFile}}{{/items.isString}}{{/items.isDateTime}}{{/items.isDate}}{{/items.isPrimitiveType}}{{/isContainer}}{{^isContainer}}{{^isPrimitiveType}}{{^isDate}}{{^isDateTime}}{{^isString}}{{^isFile}}{{^isEnumOrRef}}@Valid {{/isEnumOrRef}}{{/isFile}}{{/isString}}{{/isDateTime}}{{/isDate}}{{/isPrimitiveType}}{{/isContainer}}{{>beanValidationCore}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/api_test.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/api_test.mustache
index 85c4dd5b69506..a4477b5a0aa3b 100644
--- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/api_test.mustache
+++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/api_test.mustache
@@ -23,8 +23,14 @@ import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
{{/useLoggingFeature}}
+{{#useJakartaEe}}
+import com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProvider;
+import com.fasterxml.jackson.jakarta.rs.xml.JacksonXMLProvider;
+{{/useJakartaEe}}
+{{^useJakartaEe}}
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import com.fasterxml.jackson.jaxrs.xml.JacksonXMLProvider;
+{{/useJakartaEe}}
import org.apache.cxf.jaxrs.provider.MultipartProvider;
import java.util.Arrays;
diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/pom.mustache
index bc5c66425f898..98269df93e8d2 100644
--- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/pom.mustache
+++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/pom.mustache
@@ -138,8 +138,8 @@ for this project used jakarta.validation-api -->
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api${junit-version}test
@@ -150,8 +150,8 @@ for this project used jakarta.validation-api -->
test
- junit
- junit
+ junit-jupiter-api
+ org.junit.jupitersnakeyaml
@@ -198,7 +198,7 @@ for this project used jakarta.validation-api -->
9.2.9.v201502243.0.11.Final1.6.3
- 4.13.2
+ 5.10.24.0.4
{{#useBeanValidation}}
2.0.2
diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/pom.mustache
index 5d41db46781bb..ab482a0590aa2 100644
--- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/pom.mustache
+++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/pom.mustache
@@ -160,8 +160,8 @@ for this project used jakarta.validation-api -->
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api${junit-version}test
@@ -172,8 +172,8 @@ for this project used jakarta.validation-api -->
test
- junit
- junit
+ junit-jupiter-api
+ org.junit.jupitersnakeyaml
@@ -216,7 +216,7 @@ for this project used jakarta.validation-api -->
9.2.9.v201502243.13.0.Final1.6.3
- 4.13.2
+ 5.10.24.0.4
{{#useJakartaEe}}
2.1.1
diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache
index 65a46053d534c..f44c6083fdd36 100644
--- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache
+++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache
@@ -162,7 +162,14 @@
${beanvalidation-version}provided
-{{/useBeanValidation}}
+ {{/useBeanValidation}}
+ {{#openApiNullable}}
+
+ org.openapitools
+ jackson-databind-nullable
+ ${jackson-databind-nullable-version}
+
+ {{/openApiNullable}}
1.8
@@ -192,5 +199,8 @@
{{^useJakartaEe}}
2.1.6
{{/useJakartaEe}}
+{{#openApiNullable}}
+ 0.2.6
+{{/openApiNullable}}
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 0000000000000..9f369e65cfcad
--- /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 db03e875533a6..44be9a4089817 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/main/resources/codegen/generatorClassTest.mustache b/modules/openapi-generator/src/main/resources/codegen/generatorClassTest.mustache
index d4773b14f813e..adc71b7f0bd8a 100644
--- a/modules/openapi-generator/src/main/resources/codegen/generatorClassTest.mustache
+++ b/modules/openapi-generator/src/main/resources/codegen/generatorClassTest.mustache
@@ -1,6 +1,6 @@
package {{generatorPackage}};
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.openapitools.codegen.ClientOptInput;
import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.config.CodegenConfigurator;
diff --git a/modules/openapi-generator/src/main/resources/codegen/pom.mustache b/modules/openapi-generator/src/main/resources/codegen/pom.mustache
index 144e81a08eb48..81a80f9df1767 100644
--- a/modules/openapi-generator/src/main/resources/codegen/pom.mustache
+++ b/modules/openapi-generator/src/main/resources/codegen/pom.mustache
@@ -31,7 +31,7 @@
org.apache.maven.pluginsmaven-surefire-plugin
- 2.12
+ 2.22.2
@@ -41,7 +41,6 @@
-Xms512m -Xmx1500mmethods
- pertest
@@ -114,15 +113,16 @@
provided
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api${junit-version}
+ testUTF-8{{openapiGeneratorVersion}}1.0.0
- 4.13.2
+ 5.10.2
diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/helpers-header.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/helpers-header.mustache
index d3489fad40267..ca7d7c684dd6b 100644
--- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/helpers-header.mustache
+++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/helpers-header.mustache
@@ -13,6 +13,7 @@
#include
#include
#include
+#include
namespace {{helpersNamespace}}
{
@@ -82,6 +83,15 @@ namespace {{helpersNamespace}}
return true;
}
+ ///
+ /// Determine if the given vector only has unique elements. T must provide the == operator.
+ ///
+ template
+ bool hasOnlyUniqueItems(const std::set& set)
+ {
+ return true;
+ }
+
std::string toStringValue(const std::string &value);
std::string toStringValue(const int32_t value);
std::string toStringValue(const int64_t value);
diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache
index ac016229aee67..ae6f06a4cf435 100644
--- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache
+++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache
@@ -61,7 +61,7 @@ bool {{classname}}::validate(std::stringstream& msg, const std::string& pathPref
{{> model-validation-body }}
}
{{/hasValidation}}{{#required}}{{#isModel}}
- if (!m_{{name}}.validate()) {
+ if (!m_{{name}}.validate(msg, _pathPrefix + ".{{nameInCamelCase}}")) {
msg << _pathPrefix << ": {{name}} is invalid;";
success = false;
}{{/isModel}}{{/required}}{{/isArray}}{{/vars}}{{/isEnum}}{{#vendorExtensions.x-is-string-enum-container}}{{#anyOf}}{{#-first}}
diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache
index a108b96f5d9da..665c9e7e8a325 100644
--- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache
+++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache
@@ -17,6 +17,7 @@
#include
#include
+#include
#include
{{#modelNamespaceDeclarations}}
@@ -52,6 +53,8 @@ public:
static utility::string_t toString( const std::shared_ptr& val );
template
static utility::string_t toString( const std::vector & val );
+ template
+ static utility::string_t toString( const std::set & val );
static web::json::value toJson( bool val );
static web::json::value toJson( float val );
@@ -68,6 +71,8 @@ public:
template
static web::json::value toJson( const std::vector& val );
template
+ static web::json::value toJson( const std::set& val );
+ template
static web::json::value toJson( const std::map& val );
static bool fromString( const utility::string_t& val, bool & );
@@ -85,6 +90,8 @@ public:
template
static bool fromString( const utility::string_t& val, std::vector & );
template
+ static bool fromString( const utility::string_t& val, std::set & );
+ template
static bool fromString( const utility::string_t& val, std::map & );
static bool fromJson( const web::json::value& val, bool & );
@@ -102,6 +109,8 @@ public:
template
static bool fromJson( const web::json::value& val, std::vector & );
template
+ static bool fromJson( const web::json::value& val, std::set & );
+ template
static bool fromJson( const web::json::value& val, std::map & );
@@ -120,6 +129,8 @@ public:
template
static std::shared_ptr toHttpContent( const utility::string_t& name, const std::vector& value, const utility::string_t& contentType = utility::conversions::to_string_t("") );
template
+ static std::shared_ptr toHttpContent( const utility::string_t& name, const std::set& value, const utility::string_t& contentType = utility::conversions::to_string_t("") );
+ template
static std::shared_ptr toHttpContent( const utility::string_t& name, const std::map& value, const utility::string_t& contentType = utility::conversions::to_string_t("") );
static bool fromHttpContent( std::shared_ptr val, bool & );
@@ -136,6 +147,8 @@ public:
template
static bool fromHttpContent( std::shared_ptr val, std::vector & );
template
+ static bool fromHttpContent( std::shared_ptr val, std::set & );
+ template
static bool fromHttpContent( std::shared_ptr val, std::map & );
static utility::string_t toBase64( utility::string_t value );
@@ -155,6 +168,8 @@ utility::string_t ModelBase::toString( const std::shared_ptr& val )
}
return utility::string_t(ss.str());
}
+
+// std::vector to string
template
utility::string_t ModelBase::toString( const std::vector & val )
{
@@ -169,6 +184,24 @@ utility::string_t ModelBase::toString( const std::vector & val )
}
return strArray;
}
+
+// std::set to string
+template
+utility::string_t ModelBase::toString( const std::set & val )
+{
+ utility::string_t strArray;
+ for ( const auto &item : val )
+ {
+ strArray.append( toString(item) + "," );
+ }
+ if (val.count() > 0)
+ {
+ strArray.pop_back();
+ }
+ return strArray;
+}
+
+
template
web::json::value ModelBase::toJson( const std::shared_ptr& val )
{
@@ -179,6 +212,8 @@ web::json::value ModelBase::toJson( const std::shared_ptr& val )
}
return retVal;
}
+
+// std::vector to json
template
web::json::value ModelBase::toJson( const std::vector& value )
{
@@ -189,6 +224,21 @@ web::json::value ModelBase::toJson( const std::vector& value )
}
return web::json::value::array(ret);
}
+
+// std::set to json
+template
+web::json::value ModelBase::toJson( const std::set& value )
+{
+ // There's no protoype web::json::value::array(...) taking a std::set parameter. Converting to std::vector to get an array.
+ std::vector ret;
+ for ( const auto& x : value )
+ {
+ ret.push_back( toJson(x) );
+ }
+ return web::json::value::array(ret);
+}
+
+
template
web::json::value ModelBase::toJson( const std::map& val )
{
@@ -279,6 +329,7 @@ std::shared_ptr ModelBase::toHttpContent(const utility::string_t& n
}
return content;
}
+
template
std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, const std::vector& value, const utility::string_t& contentType )
{
@@ -290,6 +341,7 @@ std::shared_ptr ModelBase::toHttpContent( const utility::string_t&
content->setData( std::shared_ptr( new std::stringstream( utility::conversions::to_utf8string(json_array.serialize()) ) ) );
return content;
}
+
template
std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, const std::map& value, const utility::string_t& contentType )
{
diff --git a/modules/openapi-generator/src/main/resources/go-server/controller-api.mustache b/modules/openapi-generator/src/main/resources/go-server/controller-api.mustache
index e9c8ad0237823..5dc6fd9aebd15 100644
--- a/modules/openapi-generator/src/main/resources/go-server/controller-api.mustache
+++ b/modules/openapi-generator/src/main/resources/go-server/controller-api.mustache
@@ -47,7 +47,7 @@ func With{{classname}}ErrorHandler(h ErrorHandler) {{classname}}Option {
}
// New{{classname}}Controller creates a default api controller
-func New{{classname}}Controller(s {{classname}}Servicer, opts ...{{classname}}Option) Router {
+func New{{classname}}Controller(s {{classname}}Servicer, opts ...{{classname}}Option) *{{classname}}Controller {
controller := &{{classname}}Controller{
service: s,
errorHandler: DefaultErrorHandler,
@@ -631,5 +631,5 @@ func (c *{{classname}}Controller) {{nickname}}(w http.ResponseWriter, r *http.Re
return
}
// If no error, encode the body and the result code
- EncodeJSONResponse(result.Body, &result.Code,{{#addResponseHeaders}} result.Headers,{{/addResponseHeaders}} w)
+ _ = EncodeJSONResponse(result.Body, &result.Code,{{#addResponseHeaders}} result.Headers,{{/addResponseHeaders}} w)
}{{/operation}}{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/go-server/error.mustache b/modules/openapi-generator/src/main/resources/go-server/error.mustache
index f14e619861192..4c90a3b9f2533 100644
--- a/modules/openapi-generator/src/main/resources/go-server/error.mustache
+++ b/modules/openapi-generator/src/main/resources/go-server/error.mustache
@@ -25,9 +25,9 @@ func (e *ParsingError) Unwrap() error {
func (e *ParsingError) Error() string {
if e.Param == "" {
return e.Err.Error()
- } else {
- return e.Param + ": " + e.Err.Error()
}
+
+ return e.Param + ": " + e.Err.Error()
}
// RequiredError indicates that an error has occurred when parsing request parameters
@@ -45,15 +45,21 @@ type ErrorHandler func(w http.ResponseWriter, r *http.Request, err error, result
// DefaultErrorHandler defines the default logic on how to handle errors from the controller. Any errors from parsing
// request params will return a StatusBadRequest. Otherwise, the error code originating from the servicer will be used.
-func DefaultErrorHandler(w http.ResponseWriter, r *http.Request, err error, result *ImplResponse) {
- if _, ok := err.(*ParsingError); ok {
+func DefaultErrorHandler(w http.ResponseWriter, _ *http.Request, err error, result *ImplResponse) {
+ var parsingErr *ParsingError
+ if ok := errors.As(err, &parsingErr); ok {
// Handle parsing errors
- EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusBadRequest),{{#addResponseHeaders}} map[string][]string{},{{/addResponseHeaders}} w)
- } else if _, ok := err.(*RequiredError); ok {
- // Handle missing required errors
- EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusUnprocessableEntity),{{#addResponseHeaders}} map[string][]string{},{{/addResponseHeaders}} w)
- } else {
- // Handle all other errors
- EncodeJSONResponse(err.Error(), &result.Code,{{#addResponseHeaders}} result.Headers,{{/addResponseHeaders}} w)
+ _ = EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusBadRequest),{{#addResponseHeaders}} map[string][]string{},{{/addResponseHeaders}} w)
+ return
}
+
+ var requiredErr *RequiredError
+ if ok := errors.As(err, &requiredErr); ok {
+ // Handle missing required errors
+ _ = EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusUnprocessableEntity),{{#addResponseHeaders}} map[string][]string{},{{/addResponseHeaders}} w)
+ return
+ }
+
+ // Handle all other errors
+ _ = EncodeJSONResponse(err.Error(), &result.Code,{{#addResponseHeaders}} result.Headers,{{/addResponseHeaders}} w)
}
diff --git a/modules/openapi-generator/src/main/resources/go-server/helpers.mustache b/modules/openapi-generator/src/main/resources/go-server/helpers.mustache
index ba5954ff46b81..de8a203d84b92 100644
--- a/modules/openapi-generator/src/main/resources/go-server/helpers.mustache
+++ b/modules/openapi-generator/src/main/resources/go-server/helpers.mustache
@@ -56,7 +56,7 @@ func AssertRecurseValueRequired[T any](value reflect.Value, callback func(T) err
// If it is a slice we continue recursion
case reflect.Slice:
- for i := 0; i < value.Len(); i += 1 {
+ for i := 0; i < value.Len(); i++ {
if err := AssertRecurseValueRequired(value.Index(i), callback); err != nil {
return err
}
diff --git a/modules/openapi-generator/src/main/resources/go-server/model.mustache b/modules/openapi-generator/src/main/resources/go-server/model.mustache
index 302b8448f50b6..e94a8b9a2dd8e 100644
--- a/modules/openapi-generator/src/main/resources/go-server/model.mustache
+++ b/modules/openapi-generator/src/main/resources/go-server/model.mustache
@@ -49,9 +49,9 @@ func New{{{classname}}}FromValue(v {{{format}}}{{^format}}{{dataType}}{{/format}
ev := {{{classname}}}(v)
if ev.IsValid() {
return ev, nil
- } else {
- return "", fmt.Errorf("invalid value '%v' for {{{classname}}}: valid values are %v", v, Allowed{{{classname}}}EnumValues)
}
+
+ return "", fmt.Errorf("invalid value '%v' for {{{classname}}}: valid values are %v", v, Allowed{{{classname}}}EnumValues)
}
{{/isEnum}}{{^isEnum}}{{#description}}
@@ -174,6 +174,61 @@ func Assert{{classname}}Constraints(obj {{classname}}) error {
return &ParsingError{Param: "{{name}}", Err: errors.New(errMsgMaxValueConstraint)}
}
{{/maximum}}
+{{#isNullable}}
+{{#isModel}}
+ if obj.{{name}} != nil {
+{{/isModel}}
+{{#isArray}}
+{{#items.isModel}}
+ if obj.{{name}} != nil {
+{{/items.isModel}}
+{{/isArray}}
+{{/isNullable}}
+{{#isModel}}
+{{#isNullable}} {{/isNullable}} if err := Assert{{baseType}}Constraints({{#isNullable}}*{{/isNullable}}obj.{{name}}); err != nil {
+{{#isNullable}} {{/isNullable}} return err
+{{#isNullable}} {{/isNullable}} }
+{{/isModel}}
+{{#isArray}}
+{{#items.isModel}}
+{{#isNullable}} {{/isNullable}} for _, el := range {{#isNullable}}*{{/isNullable}}obj.{{name}} {
+{{#isNullable}} {{/isNullable}} if err := Assert{{items.baseType}}Constraints(el); err != nil {
+{{#isNullable}} {{/isNullable}} return err
+{{#isNullable}} {{/isNullable}} }
+{{#isNullable}} {{/isNullable}} }
+{{/items.isModel}}
+{{^items.isModel}}
+{{#mostInnerItems.isModel}}
+{{^mostInnerItems.isPrimitiveType}}
+{{#isNullable}}
+ if obj.{{name}} != nil {
+{{/isNullable}}
+{{#isNullable}} {{/isNullable}} if err := AssertRecurseInterfaceRequired({{#isNullable}}*{{/isNullable}}obj.{{name}}, Assert{{mostInnerItems.dataType}}Constraints); err != nil {
+{{#isNullable}} {{/isNullable}} return err
+{{#isNullable}} {{/isNullable}} }
+{{/mostInnerItems.isPrimitiveType}}
+{{/mostInnerItems.isModel}}
+{{/items.isModel}}
+{{/isArray}}
+{{#isNullable}}
+{{#isModel}}
+ }
+{{/isModel}}
+{{#isArray}}
+{{#items.isModel}}
+ }
+{{/items.isModel}}
+{{^items.isModel}}
+{{#mostInnerItems.isModel}}
+{{^mostInnerItems.isPrimitiveType}}
+{{#isNullable}}
+ }
+{{/isNullable}}
+{{/mostInnerItems.isPrimitiveType}}
+{{/mostInnerItems.isModel}}
+{{/items.isModel}}
+{{/isArray}}
+{{/isNullable}}
{{/Vars}}
return nil
}{{/model}}{{/models}}
diff --git a/modules/openapi-generator/src/main/resources/go-server/routers.mustache b/modules/openapi-generator/src/main/resources/go-server/routers.mustache
index fb2d043076a9f..207df91d9aadc 100644
--- a/modules/openapi-generator/src/main/resources/go-server/routers.mustache
+++ b/modules/openapi-generator/src/main/resources/go-server/routers.mustache
@@ -64,8 +64,7 @@ func NewRouter(routers ...Router) {{#routers}}{{#mux}}*mux.Router{{/mux}}{{#chi}
{{/routers}}
for _, api := range routers {
for {{#routers}}{{#mux}}name{{/mux}}{{#chi}}_{{/chi}}{{/routers}}, route := range api.Routes() {
- var handler http.Handler
- handler = route.HandlerFunc
+ var handler http.Handler = route.HandlerFunc
{{#routers}}
{{#mux}}
handler = Logger(handler, name)
@@ -373,7 +372,7 @@ func parseNumericArrayParameter[T Number](param, delim string, required bool, fn
}
-// parseQuery parses query paramaters and returns an error if any malformed value pairs are encountered.
+// parseQuery parses query parameters and returns an error if any malformed value pairs are encountered.
func parseQuery(rawQuery string) (url.Values, error) {
return url.ParseQuery(rawQuery)
}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/go-server/service.mustache b/modules/openapi-generator/src/main/resources/go-server/service.mustache
index 799c682373971..52ddb6ac23b0f 100644
--- a/modules/openapi-generator/src/main/resources/go-server/service.mustache
+++ b/modules/openapi-generator/src/main/resources/go-server/service.mustache
@@ -15,7 +15,7 @@ type {{classname}}Service struct {
}
// New{{classname}}Service creates a default api service
-func New{{classname}}Service() {{classname}}Servicer {
+func New{{classname}}Service() *{{classname}}Service {
return &{{classname}}Service{}
}{{#operations}}{{#operation}}
diff --git a/modules/openapi-generator/src/main/resources/go/model_simple.mustache b/modules/openapi-generator/src/main/resources/go/model_simple.mustache
index cf9ecac947f50..9299b9e5b942f 100644
--- a/modules/openapi-generator/src/main/resources/go/model_simple.mustache
+++ b/modules/openapi-generator/src/main/resources/go/model_simple.mustache
@@ -5,10 +5,10 @@ var _ MappedNullable = &{{classname}}{}
type {{classname}} struct {
{{#parentModel.name}}
{{^isArray}}
- {{{parentModel.name}}}
+ {{{parentModel.classname}}}
{{/isArray}}
{{#isArray}}
- Items {{{parentModel.name}}}
+ Items {{{parentModel.classname}}}
{{/isArray}}
{{/parentModel.name}}
{{#vars}}
diff --git a/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache b/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache
index 2865781b099c1..04dafb2803bd1 100644
--- a/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache
+++ b/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache
@@ -151,6 +151,12 @@
{{/model}}
{{/models}}
+ {{#aliasModels}}
+ {{#model}}
+ defs["{{name}}"] = {{{modelJson}}};
+ {{/model}}
+ {{/aliasModels}}
+
var errs = {};
{{#swagger.vendorExtensions.x-shared-errors}}
{
@@ -459,11 +465,13 @@
}
if (schema.$ref != null) {
schema = defsParser.$refs.get(schema.$ref);
- Object.keys(schema.properties).forEach( (item) => {
- if (schema.properties[item].$ref != null) {
- schema.properties[item] = defsParser.$refs.get(schema.properties[item].$ref);
- }
- });
+ if (schema.properties != null) {
+ Object.keys(schema.properties).forEach( (item) => {
+ if (schema.properties[item].$ref != null) {
+ schema.properties[item] = defsParser.$refs.get(schema.properties[item].$ref);
+ }
+ });
+ }
} else if (schema.items != null && schema.items.$ref != null) {
schema.items = defsParser.$refs.get(schema.items.$ref);
} else {
diff --git a/modules/openapi-generator/src/main/resources/htmlDocs2/js_jsonschemaview.mustache b/modules/openapi-generator/src/main/resources/htmlDocs2/js_jsonschemaview.mustache
index 0bf2ddd5e6195..20f0746201e64 100644
--- a/modules/openapi-generator/src/main/resources/htmlDocs2/js_jsonschemaview.mustache
+++ b/modules/openapi-generator/src/main/resources/htmlDocs2/js_jsonschemaview.mustache
@@ -133,7 +133,7 @@ var JSONSchemaView = (function () {
// Determine if a schema is an array
this.isArray = !this.isAny && this.schema && this.schema.type === 'array';
- this.isObject = this.schema && (this.schema.type === 'object' || this.schema.properties || this.schema.anyOf || this.schema.oneof || this.schema.allOf);
+ this.isObject = this.schema && (this.schema.type === 'object' || this.schema.properties || this.schema.anyOf || this.schema.oneOf || this.schema.allOf);
// Determine if a schema is a primitive
this.isPrimitive = !this.isAny && !this.isArray && !this.isObject;
diff --git a/modules/openapi-generator/src/main/resources/java-helidon/client/libraries/mp/pom.mustache b/modules/openapi-generator/src/main/resources/java-helidon/client/libraries/mp/pom.mustache
index 653dbbdf48438..212b544b855fe 100644
--- a/modules/openapi-generator/src/main/resources/java-helidon/client/libraries/mp/pom.mustache
+++ b/modules/openapi-generator/src/main/resources/java-helidon/client/libraries/mp/pom.mustache
@@ -85,8 +85,14 @@
+{{^x-helidon-useSmallRyeJandexPlugin}}
org.jboss.jandexjandex-maven-plugin
+{{/x-helidon-useSmallRyeJandexPlugin}}
+{{#x-helidon-useSmallRyeJandexPlugin}}
+ io.smallrye
+ jandex-maven-plugin
+{{/x-helidon-useSmallRyeJandexPlugin}}
make-index
diff --git a/modules/openapi-generator/src/main/resources/java-helidon/server/libraries/mp/pom.mustache b/modules/openapi-generator/src/main/resources/java-helidon/server/libraries/mp/pom.mustache
index 8a0ef05f22204..e8222336a11dd 100644
--- a/modules/openapi-generator/src/main/resources/java-helidon/server/libraries/mp/pom.mustache
+++ b/modules/openapi-generator/src/main/resources/java-helidon/server/libraries/mp/pom.mustache
@@ -68,11 +68,20 @@
junit-jupiter-apitest
+{{^x-helidon-useMpTesting}}
io.helidon.microprofile.testshelidon-microprofile-tests-junit5test
+{{/x-helidon-useMpTesting}}
+{{#x-helidon-useMpTesting}}
+
+ io.helidon.microprofile.testing
+ helidon-microprofile-testing-junit5
+ test
+
+{{/x-helidon-useMpTesting}}
@@ -87,8 +96,14 @@
+{{^x-helidon-useSmallRyeJandexPlugin}}
org.jboss.jandexjandex-maven-plugin
+{{/x-helidon-useSmallRyeJandexPlugin}}
+{{#x-helidon-useSmallRyeJandexPlugin}}
+ io.smallrye
+ jandex-maven-plugin
+{{/x-helidon-useSmallRyeJandexPlugin}}
make-index
diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache
index 0652f569ebe3a..8d6b5c9733f8d 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache
@@ -191,7 +191,7 @@ dependencies {
implementation "com.squareup.retrofit2:converter-moshi:$retrofitVersion"
{{/moshi}}
{{#kotlinx_serialization}}
- implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0"
+ implementation "com.squareup.retrofit2:converter-kotlinx-serialization:$retrofitVersion"
{{/kotlinx_serialization}}
{{#jackson}}
implementation "com.squareup.retrofit2:converter-jackson:$retrofitVersion"
diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache
index a2a4a20ae73d5..1683b45e2ea86 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache
@@ -55,7 +55,7 @@ import retrofit2.converter.jackson.JacksonConverterFactory
{{/jackson}}
{{#kotlinx_serialization}}
-import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
+import retrofit2.converter.kotlinx.serialization.asConverterFactory
import {{packageName}}.infrastructure.Serializer.kotlinxSerializationJson
import okhttp3.MediaType.Companion.toMediaType
{{/kotlinx_serialization}}
diff --git a/modules/openapi-generator/src/main/resources/php-flight/api.mustache b/modules/openapi-generator/src/main/resources/php-flight/api.mustache
index a0b146bd07dc1..9824f8f8697d2 100644
--- a/modules/openapi-generator/src/main/resources/php-flight/api.mustache
+++ b/modules/openapi-generator/src/main/resources/php-flight/api.mustache
@@ -11,7 +11,8 @@ namespace {{apiPackage}};
{{#operation}}
/**
* Operation {{{operationId}}}
- * Path: {{{path}}}
+ *
+ * Path: `{{{path}}}`
*
{{#summary}}
* {{{summary}}}
@@ -31,10 +32,11 @@ namespace {{apiPackage}};
throw new \Exception('Not implemented');
}
- {{#returnContainer}}
/**
* Operation {{{operationId}}} (stream)
*
+ * Path: `{{{path}}}`
+ *
{{#summary}}
* {{{summary}}}
*
@@ -51,7 +53,6 @@ namespace {{apiPackage}};
{
throw new \Exception('Not implemented');
}
- {{/returnContainer}}
{{/operation}}
}
{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/php-flight/register_routes.mustache b/modules/openapi-generator/src/main/resources/php-flight/register_routes.mustache
index 42aebdee00a74..1056f6be4c8b0 100644
--- a/modules/openapi-generator/src/main/resources/php-flight/register_routes.mustache
+++ b/modules/openapi-generator/src/main/resources/php-flight/register_routes.mustache
@@ -27,17 +27,16 @@ class RegisterRoutes {
);
{{^vendorExtensions.x-return-type-is-void}}
if ($result === null) {
- \Flight::halt(204);
+ \Flight::halt({{{vendorExtensions.x-default-status-code}}});
} else {
- \Flight::json($result);
+ \Flight::json($result, {{{vendorExtensions.x-default-status-code}}});
}
{{/vendorExtensions.x-return-type-is-void}}
{{#vendorExtensions.x-return-type-is-void}}
- \Flight::halt(204);
+ \Flight::halt({{{vendorExtensions.x-default-status-code}}});
{{/vendorExtensions.x-return-type-is-void}}
});
}
- {{#returnContainer}}
if (declaresMethod($reflectionClass, '{{operationId}}Stream')) {
\Flight::route('{{httpMethod}} {{vendorExtensions.x-path}}', function ({{#pathParams}}string ${{paramName}}{{^-last}}, {{/-last}}{{/pathParams}}) use ($handler) {
$r = \Flight::request();
@@ -47,9 +46,8 @@ class RegisterRoutes {
{{/vendorExtensions.x-nonFormParams}}
);
// ignore return value: streaming expected
- })->streamWithHeaders(['Content-Type' => 'application/json']);
+ })->streamWithHeaders(['status' => {{{vendorExtensions.x-default-status-code}}}{{#vendorExtensions.x-default-media-type}}, 'Content-Type' => '{{{vendorExtensions.x-default-media-type}}}'{{/vendorExtensions.x-default-media-type}}]);
}
- {{/returnContainer}}
{{/operation}}
{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache b/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache
index f33ba924deca2..f7c286439a09c 100644
--- a/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache
+++ b/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache
@@ -16,7 +16,7 @@ httptools==0.1.2
httpx==0.24.1
idna==3.7
itsdangerous==1.1.0
-Jinja2==2.11.3
+Jinja2==3.1.4
MarkupSafe==2.0.1
orjson==3.9.15
promise==2.3
diff --git a/modules/openapi-generator/src/main/resources/rust-axum/header.mustache b/modules/openapi-generator/src/main/resources/rust-axum/header.mustache
index 4d1cc4c6dccdf..36bfcf45f7b7e 100644
--- a/modules/openapi-generator/src/main/resources/rust-axum/header.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-axum/header.mustache
@@ -1,4 +1,4 @@
-use std::{convert::TryFrom, fmt, ops::Deref};
+use std::{convert::TryFrom, fmt, ops::Deref{{#renderUuidConversionImpl}}, str::FromStr{{/renderUuidConversionImpl}}};
use chrono::{DateTime, Utc};
use http::HeaderValue;
@@ -178,3 +178,39 @@ impl TryFrom>> for HeaderValue {
}
}
}
+
+{{#renderUuidConversionImpl}}
+// uuid::Uuid
+
+impl TryFrom for IntoHeaderValue {
+ type Error = String;
+
+ fn try_from(hdr_value: HeaderValue) -> Result {
+ match hdr_value.to_str() {
+ Ok(hdr_value) => match uuid::Uuid::from_str(hdr_value) {
+ Ok(uuid) => Ok(IntoHeaderValue(uuid)),
+ Err(e) => Err(format!("Unable to parse: {} as uuid - {}", hdr_value, e)),
+ },
+ Err(e) => Err(format!(
+ "Unable to convert header {:?} to string {}",
+ hdr_value, e
+ )),
+ }
+ }
+}
+
+impl TryFrom> for HeaderValue {
+ type Error = String;
+
+ fn try_from(hdr_value: IntoHeaderValue) -> Result {
+ match HeaderValue::from_bytes(hdr_value.0.as_bytes()) {
+ Ok(hdr_value) => Ok(hdr_value),
+ Err(e) => Err(format!(
+ "Unable to convert {:?} to a header: {}",
+ hdr_value, e
+ )),
+ }
+ }
+}
+
+{{/renderUuidConversionImpl}}
diff --git a/modules/openapi-generator/src/main/resources/rust-axum/lib.mustache b/modules/openapi-generator/src/main/resources/rust-axum/lib.mustache
index d96088f86a4ab..b0b755b131f28 100644
--- a/modules/openapi-generator/src/main/resources/rust-axum/lib.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-axum/lib.mustache
@@ -6,9 +6,13 @@
unused_extern_crates,
non_camel_case_types,
unused_imports,
- unused_attributes
+ unused_attributes,
+)]
+#![allow(
+ clippy::derive_partial_eq_without_eq,
+ clippy::disallowed_names,
+ clippy::too_many_arguments
)]
-#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]
use async_trait::async_trait;
use axum::extract::*;
diff --git a/modules/openapi-generator/src/main/resources/rust-axum/server-mod.mustache b/modules/openapi-generator/src/main/resources/rust-axum/server-mod.mustache
index 69a703ca0706a..cf43a8dd11e1a 100644
--- a/modules/openapi-generator/src/main/resources/rust-axum/server-mod.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-axum/server-mod.mustache
@@ -8,7 +8,9 @@ use crate::{Api{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}},
{{#apis}}
{{#operations}}
{{#operation}}
+{{^disableValidator}}
{{>server-operation-validate}}
+{{/disableValidator}}
{{>server-operation}}
{{/operation}}
{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache b/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache
index 794a5f8be6b73..806211893fea9 100644
--- a/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache
@@ -17,7 +17,7 @@ license = "{{.}}"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
{{/licenseInfo}}
-edition = "2018"
+edition = "2021"
{{#publishRustRegistry}}
publish = ["{{.}}"]
{{/publishRustRegistry}}
diff --git a/modules/openapi-generator/src/main/resources/rust-server/lib.mustache b/modules/openapi-generator/src/main/resources/rust-server/lib.mustache
index f82fe6f424e29..cbd262e97f1e7 100644
--- a/modules/openapi-generator/src/main/resources/rust-server/lib.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-server/lib.mustache
@@ -1,6 +1,6 @@
#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
#![allow(unused_imports, unused_attributes)]
-#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]
+#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names, clippy::too_many_arguments)]
use async_trait::async_trait;
use futures::Stream;
diff --git a/modules/openapi-generator/src/main/resources/rust/Cargo.mustache b/modules/openapi-generator/src/main/resources/rust/Cargo.mustache
index d6fa2e3efcb63..7b4e15d250597 100644
--- a/modules/openapi-generator/src/main/resources/rust/Cargo.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/Cargo.mustache
@@ -17,7 +17,7 @@ license = "{{.}}"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
{{/licenseInfo}}
-edition = "2018"
+edition = "2021"
{{#publishRustRegistry}}
publish = ["{{.}}"]
{{/publishRustRegistry}}
@@ -32,14 +32,13 @@ homepage = "{{.}}
{{/homePageUrl}}
[dependencies]
-serde = "^1.0"
-serde_derive = "^1.0"
+serde = { version = "^1.0", features = ["derive"] }
{{#serdeWith}}
-serde_with = { version = "^3", default-features = false, features = ["base64", "std", "macros"] }
+serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] }
{{/serdeWith}}
serde_json = "^1.0"
-url = "^2.2"
-uuid = { version = "^1.0", features = ["serde", "v4"] }
+url = "^2.5"
+uuid = { version = "^1.8", features = ["serde", "v4"] }
{{#hyper}}
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
@@ -54,16 +53,15 @@ secrecy = "0.8.0"
{{/withAWSV4Signature}}
{{#reqwest}}
{{^supportAsync}}
-[dependencies.reqwest]
-version = "^0.11"
-features = ["json", "blocking", "multipart"]
+reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] }
+{{#supportMiddleware}}
+reqwest-middleware = { version = "^0.3", features = ["json", "blocking", "multipart"] }
+{{/supportMiddleware}}
{{/supportAsync}}
{{#supportAsync}}
+reqwest = { version = "^0.12", features = ["json", "multipart"] }
{{#supportMiddleware}}
-reqwest-middleware = "0.2.0"
+reqwest-middleware = { version = "^0.3", features = ["json", "multipart"] }
{{/supportMiddleware}}
-[dependencies.reqwest]
-version = "^0.11"
-features = ["json", "multipart"]
{{/supportAsync}}
{{/reqwest}}
diff --git a/modules/openapi-generator/src/main/resources/rust/hyper/api_mod.mustache b/modules/openapi-generator/src/main/resources/rust/hyper/api_mod.mustache
index 8314cb60b07b2..51a42ef361a56 100644
--- a/modules/openapi-generator/src/main/resources/rust/hyper/api_mod.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/hyper/api_mod.mustache
@@ -29,19 +29,19 @@ impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
impl From for Error {
fn from(e: http::Error) -> Self {
- return Error::Http(e)
+ Error::Http(e)
}
}
impl From for Error {
fn from(e: hyper::Error) -> Self {
- return Error::Hyper(e)
+ Error::Hyper(e)
}
}
impl From for Error {
fn from(e: serde_json::Error) -> Self {
- return Error::Serde(e)
+ Error::Serde(e)
}
}
diff --git a/modules/openapi-generator/src/main/resources/rust/lib.mustache b/modules/openapi-generator/src/main/resources/rust/lib.mustache
index 03ee005ea4c68..276ad12cfbbf3 100644
--- a/modules/openapi-generator/src/main/resources/rust/lib.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/lib.mustache
@@ -1,7 +1,5 @@
#![allow(unused_imports)]
-
-#[macro_use]
-extern crate serde_derive;
+#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
diff --git a/modules/openapi-generator/src/main/resources/rust/model.mustache b/modules/openapi-generator/src/main/resources/rust/model.mustache
index 7c2c1bcd00808..dd7ac5a1cdf6f 100644
--- a/modules/openapi-generator/src/main/resources/rust/model.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/model.mustache
@@ -1,5 +1,6 @@
{{>partial_header}}
use crate::models;
+use serde::{Deserialize, Serialize};
{{#models}}
{{#model}}
{{^isEnum}}{{#vendorExtensions.x-rust-has-byte-array}}
@@ -20,12 +21,12 @@ pub enum {{{classname}}} {
{{/enumVars}}{{/allowableValues}}
}
-impl ToString for {{{classname}}} {
- fn to_string(&self) -> String {
+impl std::fmt::Display for {{{classname}}} {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
{{#allowableValues}}
{{#enumVars}}
- Self::{{{name}}} => String::from("{{{value}}}"),
+ Self::{{{name}}} => write!(f, "{{{value}}}"),
{{/enumVars}}
{{/allowableValues}}
}
diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache
index 23c6300f99bbc..f9e6e9db5990e 100644
--- a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache
@@ -1,7 +1,7 @@
{{>partial_header}}
use reqwest;
-
+use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
@@ -174,7 +174,7 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration:
{{/bodyParams}}
{{/hasBodyParam}}
{{^hasBodyParam}}
- &"",
+ "",
{{/hasBodyParam}}
) {
Ok(new_headers) => new_headers,
diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache
index 0de2884a8bb88..fd6f7d052d974 100644
--- a/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/reqwest/configuration.mustache
@@ -64,7 +64,7 @@ impl AWSv4Key {
value.to_str().expect("header value should be a string").to_string()));
}
}
- return Ok(additional_headers);
+ Ok(additional_headers)
}
}
{{/withAWSV4Signature}}
diff --git a/modules/openapi-generator/src/main/resources/typescript-aurelia/package.json.mustache b/modules/openapi-generator/src/main/resources/typescript-aurelia/package.json.mustache
index 91a55a9140cd9..c6c12b4bf201a 100644
--- a/modules/openapi-generator/src/main/resources/typescript-aurelia/package.json.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-aurelia/package.json.mustache
@@ -22,6 +22,6 @@
},
"devDependencies": {
"tslint": "^3.15.1",
- "typescript": "^4.0"
+ "typescript": "^4.0 || ^5.0"
}
}
diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache
index 7ad585b937850..47c95f0e3544a 100644
--- a/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache
@@ -18,10 +18,10 @@ import FormData from 'form-data'
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '{{apiRelativeToRoot}}common';
// @ts-ignore
-import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError, operationServerMap } from '{{apiRelativeToRoot}}base';
+import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '{{apiRelativeToRoot}}base';
{{#imports}}
// @ts-ignore
-import { {{classname}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}';
+import type { {{classname}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}';
{{/imports}}
{{/withSeparateModelsAndApi}}
{{^withSeparateModelsAndApi}}
diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/model.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/model.mustache
index 9e1e84422bce9..4ec53a6c405dd 100644
--- a/modules/openapi-generator/src/main/resources/typescript-axios/model.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-axios/model.mustache
@@ -4,13 +4,13 @@
{{#withSeparateModelsAndApi}}{{#hasAllOf}}{{#allOf}}
// May contain unused imports in some cases
// @ts-ignore
-import { {{class}} } from './{{filename}}';{{/allOf}}{{/hasAllOf}}{{#hasOneOf}}{{#oneOf}}
+import type { {{class}} } from './{{filename}}';{{/allOf}}{{/hasAllOf}}{{#hasOneOf}}{{#oneOf}}
// May contain unused imports in some cases
// @ts-ignore
-import { {{class}} } from './{{filename}}';{{/oneOf}}{{/hasOneOf}}{{^hasAllOf}}{{^hasOneOf}}{{#imports}}
+import type { {{class}} } from './{{filename}}';{{/oneOf}}{{/hasOneOf}}{{^hasAllOf}}{{^hasOneOf}}{{#imports}}
// May contain unused imports in some cases
// @ts-ignore
-import { {{class}} } from './{{filename}}';{{/imports}}{{/hasOneOf}}{{/hasAllOf}}{{/withSeparateModelsAndApi}}
+import type { {{class}} } from './{{filename}}';{{/imports}}{{/hasOneOf}}{{/hasAllOf}}{{/withSeparateModelsAndApi}}
{{#models}}{{#model}}
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{#oneOf}}{{#-first}}{{>modelOneOf}}{{/-first}}{{/oneOf}}{{#allOf}}{{#-first}}{{>modelAllOf}}{{/-first}}{{/allOf}}{{^isEnum}}{{^oneOf}}{{^allOf}}{{>modelGeneric}}{{/allOf}}{{/oneOf}}{{/isEnum}}
{{/model}}{{/models}}
diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/package.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/package.mustache
index da599f177877b..b5ab30bba8f69 100644
--- a/modules/openapi-generator/src/main/resources/typescript-axios/package.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-axios/package.mustache
@@ -29,8 +29,8 @@
"axios": "^1.6.1"
},
"devDependencies": {
- "@types/node": "^12.11.5",
- "typescript": "^4.0"
+ "@types/node": "12.11.5 - 12.20.42",
+ "typescript": "^4.0 || ^5.0"
}{{#npmRepository}},{{/npmRepository}}
{{#npmRepository}}
"publishConfig": {
diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/package.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/package.mustache
index add4643dfe31e..ebb742fdb782e 100644
--- a/modules/openapi-generator/src/main/resources/typescript-fetch/package.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-fetch/package.mustache
@@ -30,7 +30,7 @@
"redux-ts-simple": "^3.2.0",
"reselect": "^4.0.0",
{{/sagasAndRecords}}
- "typescript": "^4.0"
+ "typescript": "^4.0 || ^5.0"
}{{#npmRepository}},{{/npmRepository}}
{{#npmRepository}}
"publishConfig": {
diff --git a/modules/openapi-generator/src/main/resources/typescript-jquery/package.mustache b/modules/openapi-generator/src/main/resources/typescript-jquery/package.mustache
index d9c7b69056025..b9b1a8b6d585d 100644
--- a/modules/openapi-generator/src/main/resources/typescript-jquery/package.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-jquery/package.mustache
@@ -19,7 +19,7 @@
},
"devDependencies": {
"@types/jquery": "^3.1",
- "typescript": "^4.0"
+ "typescript": "^4.0 || ^5.0"
}{{#npmRepository}},
"publishConfig": {
"registry": "{{npmRepository}}"
diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/package.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/package.mustache
index 1167ea07cd30e..58209fba34d92 100644
--- a/modules/openapi-generator/src/main/resources/typescript-nestjs/package.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/package.mustache
@@ -53,7 +53,7 @@
"ts-node": "8.3.0",
"tsconfig-paths": "3.8.0",
"tslint": "5.18.0",
- "typescript": "^4.0",
+ "typescript": "^4.0 || ^5.0",
"wait-on": "^3.2.0"
},
"jest": {
diff --git a/modules/openapi-generator/src/main/resources/typescript-node/package.mustache b/modules/openapi-generator/src/main/resources/typescript-node/package.mustache
index b9dc19c81a7ad..f8d6788d5bf27 100644
--- a/modules/openapi-generator/src/main/resources/typescript-node/package.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-node/package.mustache
@@ -23,7 +23,7 @@
"@types/bluebird": "^3.5.33",
"@types/node": "^12",
"@types/request": "^2.48.8",
- "typescript": "^4.0"
+ "typescript": "^4.0 || ^5.0"
}{{#npmRepository}},
"publishConfig": {
"registry": "{{npmRepository}}"
diff --git a/modules/openapi-generator/src/main/resources/typescript-redux-query/package.mustache b/modules/openapi-generator/src/main/resources/typescript-redux-query/package.mustache
index 722818d44cd64..d1f90533fcbaf 100644
--- a/modules/openapi-generator/src/main/resources/typescript-redux-query/package.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-redux-query/package.mustache
@@ -17,7 +17,7 @@
"redux-query": "^3.2.0"
},
"devDependencies": {
- "typescript": "^4.0"
+ "typescript": "^4.0 || ^5.0"
}{{#npmRepository}},{{/npmRepository}}
{{#npmRepository}}
"publishConfig": {
diff --git a/modules/openapi-generator/src/main/resources/typescript-rxjs/package.mustache b/modules/openapi-generator/src/main/resources/typescript-rxjs/package.mustache
index 65d8b348d1a60..34b64585a01ea 100644
--- a/modules/openapi-generator/src/main/resources/typescript-rxjs/package.mustache
+++ b/modules/openapi-generator/src/main/resources/typescript-rxjs/package.mustache
@@ -17,7 +17,7 @@
"rxjs": "^7.2.0"
},
"devDependencies": {
- "typescript": "^4.0"
+ "typescript": "^4.0 || ^5.0"
}{{#npmRepository}},{{/npmRepository}}
{{#npmRepository}}
"publishConfig": {
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java
index 81c4978e78734..0fcc7650f22fa 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java
@@ -17,10 +17,11 @@
package org.openapitools.codegen;
+import java.nio.file.Files;
+import java.util.stream.Collectors;
import io.swagger.v3.oas.models.OpenAPI;
import org.openapitools.codegen.testutils.IntegrationTestPathsConfig;
import org.testng.annotations.Test;
-import org.testng.reporters.Files;
import java.io.IOException;
import java.util.HashMap;
@@ -51,7 +52,7 @@ public void generatesCorrectDirectoryStructure() throws IOException {
IntegrationTestPathsConfig integrationTestPathsConfig = getIntegrationTestPathsConfig();
- String specContent = Files.readFile(integrationTestPathsConfig.getSpecPath().toFile());
+ String specContent = Files.lines(integrationTestPathsConfig.getSpecPath()).collect(Collectors.joining("\n"));
OpenAPI openAPI = TestUtils.parseContent(specContent);
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ArchUnitRulesTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ArchUnitRulesTest.java
index 1eb57d9014f6d..a4ca489e6b84d 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ArchUnitRulesTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ArchUnitRulesTest.java
@@ -4,7 +4,7 @@
import com.tngtech.archunit.core.domain.JavaModifier;
import com.tngtech.archunit.core.importer.ClassFileImporter;
import com.tngtech.archunit.lang.ArchRule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.*;
import static com.tngtech.archunit.library.GeneralCodingRules.NO_CLASSES_SHOULD_ACCESS_STANDARD_STREAMS;
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 8ef2ae4d61e8c..daaea9a263761 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
@@ -29,7 +29,6 @@
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.PathItem;
-import io.swagger.v3.oas.models.examples.Example;
import io.swagger.v3.oas.models.headers.Header;
import io.swagger.v3.oas.models.media.*;
import io.swagger.v3.oas.models.parameters.QueryParameter;
@@ -50,6 +49,8 @@
import org.testng.Assert;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;
+import org.junit.jupiter.api.Assertions;
+
import java.io.File;
import java.io.IOException;
@@ -57,7 +58,6 @@
import java.util.*;
import java.util.stream.Collectors;
-import static junit.framework.Assert.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;
import static org.testng.Assert.*;
@@ -72,7 +72,7 @@ public void testDeeplyNestedAdditionalPropertiesImports() {
codegen.setOpenAPI(openApi);
PathItem path = openApi.getPaths().get("/ping");
CodegenOperation operation = codegen.fromOperation("/ping", "post", path.getPost(), path.getServers());
- Assert.assertEquals(Sets.intersection(operation.imports, Sets.newHashSet("Person")).size(), 1);
+ Assertions.assertEquals(Sets.intersection(operation.imports, Sets.newHashSet("Person")).size(), 1);
}
@Test
@@ -82,7 +82,7 @@ public void testOptionalResponseImports() {
codegen.setOpenAPI(openApi);
PathItem path = openApi.getPaths().get("/api/Users/{userId}");
CodegenOperation operation = codegen.fromOperation("/api/Users/{userId}", "get", path.getGet(), path.getServers());
- Assert.assertEquals(operation.isResponseOptional, true);
+ Assertions.assertTrue(operation.isResponseOptional);
}
@Test
@@ -92,7 +92,7 @@ public void testEnumImports() {
codegen.setOpenAPI(openApi);
PathItem path = openApi.getPaths().get("/pets/petType/{type}");
CodegenOperation operation = codegen.fromOperation("/pets/petType/{type}", "get", path.getGet(), path.getServers());
- Assert.assertEquals(Sets.intersection(operation.imports, Sets.newHashSet("PetByType")).size(), 1);
+ Assertions.assertEquals(Sets.intersection(operation.imports, Sets.newHashSet("PetByType")).size(), 1);
}
@Test
@@ -116,8 +116,8 @@ public void testHasBodyParameter() {
final DefaultCodegen codegen = new DefaultCodegen();
codegen.setOpenAPI(openAPI);
- Assert.assertFalse(codegen.hasBodyParameter(pingOperation));
- Assert.assertTrue(codegen.hasBodyParameter(createOperation));
+ Assertions.assertFalse(codegen.hasBodyParameter(pingOperation));
+ Assertions.assertTrue(codegen.hasBodyParameter(createOperation));
}
@Test(expectedExceptions = RuntimeException.class)
@@ -128,7 +128,7 @@ public void testParameterEmptyDescription() {
}
@Test
- public void testGetConsumesInfoAndGetProducesInfo() throws Exception {
+ public void testGetConsumesInfoAndGetProducesInfo() {
final Schema refSchema = new Schema<>().$ref("#/components/schemas/Pet");
OpenAPI openAPI = new OpenAPI();
openAPI.setComponents(new Components());
@@ -151,61 +151,61 @@ public void testGetConsumesInfoAndGetProducesInfo() throws Exception {
new ApiResponses().addApiResponse("201", new ApiResponse()
.description("Created response")));
Set createConsumesInfo = DefaultCodegen.getConsumesInfo(openAPI, createOperation);
- Assert.assertEquals(createConsumesInfo.size(), 2);
- Assert.assertTrue(createConsumesInfo.contains("application/json"), "contains 'application/json'");
- Assert.assertTrue(createConsumesInfo.contains("application/xml"), "contains 'application/xml'");
+ Assertions.assertEquals(createConsumesInfo.size(), 2);
+ Assertions.assertTrue(createConsumesInfo.contains("application/json"), "contains 'application/json'");
+ Assertions.assertTrue(createConsumesInfo.contains("application/xml"), "contains 'application/xml'");
Set createProducesInfo = DefaultCodegen.getProducesInfo(openAPI, createOperation);
- Assert.assertEquals(createProducesInfo.size(), 0);
+ Assertions.assertEquals(createProducesInfo.size(), 0);
final DefaultCodegen codegen = new DefaultCodegen();
codegen.setOpenAPI(openAPI);
CodegenOperation coCreate = codegen.fromOperation("somepath", "post", createOperation, null);
- Assert.assertTrue(coCreate.hasConsumes);
- Assert.assertEquals(coCreate.consumes.size(), 2);
- Assert.assertFalse(coCreate.hasProduces);
+ Assertions.assertTrue(coCreate.hasConsumes);
+ Assertions.assertEquals(coCreate.consumes.size(), 2);
+ Assertions.assertFalse(coCreate.hasProduces);
Operation updateOperationWithRef = new Operation()
.requestBody(new RequestBody().$ref("#/components/requestBodies/MyRequestBody"))
.responses(new ApiResponses().addApiResponse("201", new ApiResponse().$ref("#/components/responses/MyResponse")));
Set updateConsumesInfo = DefaultCodegen.getConsumesInfo(openAPI, updateOperationWithRef);
- Assert.assertEquals(updateConsumesInfo.size(), 1);
- Assert.assertTrue(updateConsumesInfo.contains("application/json"), "contains 'application/json'");
+ Assertions.assertEquals(updateConsumesInfo.size(), 1);
+ Assertions.assertTrue(updateConsumesInfo.contains("application/json"), "contains 'application/json'");
Set updateProducesInfo = DefaultCodegen.getProducesInfo(openAPI, updateOperationWithRef);
- Assert.assertEquals(updateProducesInfo.size(), 1);
- Assert.assertTrue(updateProducesInfo.contains("application/xml"), "contains 'application/xml'");
+ Assertions.assertEquals(updateProducesInfo.size(), 1);
+ Assertions.assertTrue(updateProducesInfo.contains("application/xml"), "contains 'application/xml'");
CodegenOperation coUpdate = codegen.fromOperation("somepath", "post", updateOperationWithRef, null);
- Assert.assertTrue(coUpdate.hasConsumes);
- Assert.assertEquals(coUpdate.consumes.size(), 1);
- Assert.assertEquals(coUpdate.consumes.get(0).get("mediaType"), "application/json");
- Assert.assertTrue(coUpdate.hasProduces);
- Assert.assertEquals(coUpdate.produces.size(), 1);
- Assert.assertEquals(coUpdate.produces.get(0).get("mediaType"), "application/xml");
+ Assertions.assertTrue(coUpdate.hasConsumes);
+ Assertions.assertEquals(coUpdate.consumes.size(), 1);
+ Assertions.assertEquals(coUpdate.consumes.get(0).get("mediaType"), "application/json");
+ Assertions.assertTrue(coUpdate.hasProduces);
+ Assertions.assertEquals(coUpdate.produces.size(), 1);
+ Assertions.assertEquals(coUpdate.produces.get(0).get("mediaType"), "application/xml");
}
@Test
- public void testGetProducesInfo() throws Exception {
+ public void testGetProducesInfo() {
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/produces.yaml");
final DefaultCodegen codegen = new DefaultCodegen();
codegen.setOpenAPI(openAPI);
Operation textOperation = openAPI.getPaths().get("/ping/text").getGet();
CodegenOperation coText = codegen.fromOperation("/ping/text", "get", textOperation, null);
- Assert.assertTrue(coText.hasProduces);
- Assert.assertEquals(coText.produces.size(), 1);
- Assert.assertEquals(coText.produces.get(0).get("mediaType"), "text/plain");
+ Assertions.assertTrue(coText.hasProduces);
+ Assertions.assertEquals(coText.produces.size(), 1);
+ Assertions.assertEquals(coText.produces.get(0).get("mediaType"), "text/plain");
Operation jsonOperation = openAPI.getPaths().get("/ping/json").getGet();
CodegenOperation coJson = codegen.fromOperation("/ping/json", "get", jsonOperation, null);
- Assert.assertTrue(coJson.hasProduces);
- Assert.assertEquals(coJson.produces.size(), 1);
- Assert.assertEquals(coJson.produces.get(0).get("mediaType"), "application/json");
+ Assertions.assertTrue(coJson.hasProduces);
+ Assertions.assertEquals(coJson.produces.size(), 1);
+ Assertions.assertEquals(coJson.produces.get(0).get("mediaType"), "application/json");
Operation issue443Operation = openAPI.getPaths().get("/other/issue443").getGet();
CodegenOperation coIssue443 = codegen.fromOperation("/other/issue443", "get", issue443Operation, null);
- Assert.assertTrue(coIssue443.hasProduces);
- Assert.assertEquals(coIssue443.produces.size(), 2);
- Assert.assertEquals(coIssue443.produces.get(0).get("mediaType"), "application/json");
- Assert.assertEquals(coIssue443.produces.get(1).get("mediaType"), "application/text");
+ Assertions.assertTrue(coIssue443.hasProduces);
+ Assertions.assertEquals(coIssue443.produces.size(), 2);
+ Assertions.assertEquals(coIssue443.produces.get(0).get("mediaType"), "application/json");
+ Assertions.assertEquals(coIssue443.produces.get(1).get("mediaType"), "application/text");
}
@Test
@@ -213,8 +213,8 @@ public void testInitialConfigValues() throws Exception {
final DefaultCodegen codegen = new DefaultCodegen();
codegen.processOpts();
- Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
- Assert.assertTrue(codegen.isHideGenerationTimestamp());
+ Assertions.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
+ Assertions.assertTrue(codegen.isHideGenerationTimestamp());
}
@Test
@@ -223,8 +223,8 @@ public void testSettersForConfigValues() throws Exception {
codegen.setHideGenerationTimestamp(false);
codegen.processOpts();
- Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
- Assert.assertFalse(codegen.isHideGenerationTimestamp());
+ Assertions.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
+ Assertions.assertFalse(codegen.isHideGenerationTimestamp());
}
@Test
@@ -233,12 +233,12 @@ public void testAdditionalPropertiesPutForConfigValues() throws Exception {
codegen.additionalProperties().put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, false);
codegen.processOpts();
- Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
- Assert.assertFalse(codegen.isHideGenerationTimestamp());
+ Assertions.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
+ Assertions.assertFalse(codegen.isHideGenerationTimestamp());
}
@Test
- public void testArraySchemaIsNotIncludedInAliases() throws Exception {
+ public void testArraySchemaIsNotIncludedInAliases() {
final DefaultCodegen codegen = new DefaultCodegen();
Map schemas = new HashMap() {
{
@@ -249,7 +249,7 @@ public void testArraySchemaIsNotIncludedInAliases() throws Exception {
Map aliases = codegen.getAllAliases(schemas);
- Assert.assertEquals(aliases.size(), 0);
+ Assertions.assertEquals(aliases.size(), 0);
}
@Test
@@ -262,8 +262,8 @@ public void testFormParameterHasDefaultValue() {
ModelUtils.getSchemaFromRequestBody(openAPI.getPaths().get("/fake").getGet().getRequestBody()));
CodegenParameter codegenParameter = codegen.fromFormProperty("enum_form_string", (Schema) requestBodySchema.getProperties().get("enum_form_string"), new HashSet());
- Assert.assertEquals(codegenParameter.defaultValue, "-efg");
- Assert.assertEquals(codegenParameter.getSchema(), null);
+ Assertions.assertEquals(codegenParameter.defaultValue, "-efg");
+ Assertions.assertNull(codegenParameter.getSchema());
}
@Test
@@ -278,8 +278,8 @@ public void testDateTimeFormParameterHasDefaultValue() {
CodegenParameter codegenParameter = codegen.fromFormProperty("visitDate", (Schema) requestBodySchema.getProperties().get("visitDate"),
new HashSet<>());
- Assert.assertEquals(codegenParameter.defaultValue, "1971-12-19T03:39:57-08:00");
- Assert.assertEquals(codegenParameter.getSchema(), null);
+ Assertions.assertEquals(codegenParameter.defaultValue, "1971-12-19T03:39:57-08:00");
+ Assertions.assertNull(codegenParameter.getSchema());
}
@Test
@@ -288,13 +288,13 @@ public void testOriginalOpenApiDocumentVersion() {
String location = "src/test/resources/2_0/python-prior/petstore-with-fake-endpoints-models-for-testing.yaml";
OpenAPI openAPI = TestUtils.parseFlattenSpec(location);
SemVer version = ModelUtils.getOpenApiVersion(openAPI, location, null);
- Assert.assertEquals(version, new SemVer("2.0.0"));
+ Assertions.assertEquals(version, new SemVer("2.0.0"));
// Test with OAS 3.0 document.
location = "src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml";
openAPI = TestUtils.parseFlattenSpec(location);
version = ModelUtils.getOpenApiVersion(openAPI, location, null);
- Assert.assertEquals(version, new SemVer("3.0.0"));
+ Assertions.assertEquals(version, new SemVer("3.0.0"));
}
@Test
@@ -306,14 +306,14 @@ public void testAdditionalPropertiesV2SpecDisallowAdditionalPropertiesIfNotPrese
codegen.setDisallowAdditionalPropertiesIfNotPresent(true);
Schema schema = openAPI.getComponents().getSchemas().get("AdditionalPropertiesClass");
- Assert.assertNull(schema.getAdditionalProperties());
+ Assertions.assertNull(schema.getAdditionalProperties());
Schema addProps = ModelUtils.getAdditionalProperties(schema);
// The petstore-with-fake-endpoints-models-for-testing.yaml does not set the
// 'additionalProperties' keyword for this model, hence assert the value to be null.
- Assert.assertNull(addProps);
+ Assertions.assertNull(addProps);
CodegenModel cm = codegen.fromModel("AdditionalPropertiesClass", schema);
- Assert.assertNull(cm.getAdditionalProperties());
+ Assertions.assertNull(cm.getAdditionalProperties());
// When the 'additionalProperties' keyword is not present, the model
// should allow undeclared properties. However, due to bug
// https://github.com/swagger-api/swagger-parser/issues/1369, the swagger
@@ -341,41 +341,41 @@ public void testAdditionalPropertiesV2SpecDisallowAdditionalPropertiesIfNotPrese
// This property has the following inline schema.
// additionalProperties:
// type: string
- Assert.assertNotNull(map_string_sc);
- Assert.assertNotNull(map_string_sc.getAdditionalProperties());
- Assert.assertNotNull(map_string_cp.getAdditionalProperties());
+ Assertions.assertNotNull(map_string_sc);
+ Assertions.assertNotNull(map_string_sc.getAdditionalProperties());
+ Assertions.assertNotNull(map_string_cp.getAdditionalProperties());
// map_with_additional_properties
// This property has the following inline schema.
// additionalProperties: true
- Assert.assertNotNull(map_with_additional_properties_sc);
+ Assertions.assertNotNull(map_with_additional_properties_sc);
// It is unfortunate that child.getAdditionalProperties() returns null for a V2 schema.
// We cannot differentiate between 'additionalProperties' not present and
// additionalProperties: true.
// UPDATE fixed in swagger parser 2.1.14
- Assert.assertTrue((Boolean) map_with_additional_properties_sc.getAdditionalProperties());
+ Assertions.assertTrue((Boolean) map_with_additional_properties_sc.getAdditionalProperties());
addProps = ModelUtils.getAdditionalProperties(map_with_additional_properties_sc);
- Assert.assertEquals(addProps, new Schema());
- Assert.assertNotNull(map_with_additional_properties_cp.getAdditionalProperties());
+ Assertions.assertEquals(addProps, new Schema());
+ Assertions.assertNotNull(map_with_additional_properties_cp.getAdditionalProperties());
// map_without_additional_properties
// This property has the following inline schema.
// additionalProperties: false
- Assert.assertNotNull(map_without_additional_properties_sc);
+ Assertions.assertNotNull(map_without_additional_properties_sc);
// It is unfortunate that child.getAdditionalProperties() returns null for a V2 schema.
// We cannot differentiate between 'additionalProperties' not present and
// additionalProperties: false.
// UPDATE fixed in swagger parser 2.1.14
- Assert.assertFalse((Boolean) map_without_additional_properties_sc.getAdditionalProperties());
+ Assertions.assertFalse((Boolean) map_without_additional_properties_sc.getAdditionalProperties());
addProps = ModelUtils.getAdditionalProperties(map_without_additional_properties_sc);
- Assert.assertNull(addProps);
- Assert.assertNull(map_without_additional_properties_cp.getAdditionalProperties());
+ Assertions.assertNull(addProps);
+ Assertions.assertNull(map_without_additional_properties_cp.getAdditionalProperties());
// check of composed schema model
String schemaName = "Parent";
schema = openAPI.getComponents().getSchemas().get(schemaName);
cm = codegen.fromModel(schemaName, schema);
- Assert.assertNull(cm.getAdditionalProperties());
+ Assertions.assertNull(cm.getAdditionalProperties());
}
@Test
@@ -397,14 +397,14 @@ public void testAdditionalPropertiesV2SpecDisallowAdditionalPropertiesIfNotPrese
*/
Schema schema = openAPI.getComponents().getSchemas().get("AdditionalPropertiesClass");
- Assert.assertNull(schema.getAdditionalProperties());
+ Assertions.assertNull(schema.getAdditionalProperties());
Schema addProps = ModelUtils.getAdditionalProperties(schema);
// The petstore-with-fake-endpoints-models-for-testing.yaml does not set the
// 'additionalProperties' keyword for this model, hence assert the value to be null.
- Assert.assertNull(addProps);
+ Assertions.assertNull(addProps);
CodegenModel cm = codegen.fromModel("AdditionalPropertiesClass", schema);
- Assert.assertNotNull(cm.getAdditionalProperties());
+ Assertions.assertNotNull(cm.getAdditionalProperties());
// When the 'additionalProperties' keyword is not present, the model
// should allow undeclared properties. However, due to bug
// https://github.com/swagger-api/swagger-parser/issues/1369, the swagger
@@ -432,41 +432,41 @@ public void testAdditionalPropertiesV2SpecDisallowAdditionalPropertiesIfNotPrese
// This property has the following inline schema.
// additionalProperties:
// type: string
- Assert.assertNotNull(map_string_sc);
- Assert.assertNotNull(map_string_sc.getAdditionalProperties());
- Assert.assertNotNull(map_string_cp.getAdditionalProperties());
+ Assertions.assertNotNull(map_string_sc);
+ Assertions.assertNotNull(map_string_sc.getAdditionalProperties());
+ Assertions.assertNotNull(map_string_cp.getAdditionalProperties());
// map_with_additional_properties
// This property has the following inline schema.
// additionalProperties: true
- Assert.assertNotNull(map_with_additional_properties_sc);
+ Assertions.assertNotNull(map_with_additional_properties_sc);
// It is unfortunate that child.getAdditionalProperties() returns null for a V2 schema.
// We cannot differentiate between 'additionalProperties' not present and
// additionalProperties: true.
// UPDATE fixed in swagger parser 2.1.14
- Assert.assertTrue((Boolean) map_with_additional_properties_sc.getAdditionalProperties());
+ Assertions.assertTrue((Boolean) map_with_additional_properties_sc.getAdditionalProperties());
addProps = ModelUtils.getAdditionalProperties(map_with_additional_properties_sc);
- Assert.assertEquals(addProps, new Schema());
- Assert.assertNotNull(map_with_additional_properties_cp.getAdditionalProperties());
+ Assertions.assertEquals(addProps, new Schema());
+ Assertions.assertNotNull(map_with_additional_properties_cp.getAdditionalProperties());
// map_without_additional_properties
// This property has the following inline schema.
// additionalProperties: false
- Assert.assertNotNull(map_without_additional_properties_sc);
+ Assertions.assertNotNull(map_without_additional_properties_sc);
// It is unfortunate that child.getAdditionalProperties() returns null for a V2 schema.
// We cannot differentiate between 'additionalProperties' not present and
// additionalProperties: false.
// UPDATE fixed in swagger parser 2.1.14
- Assert.assertFalse((Boolean) map_without_additional_properties_sc.getAdditionalProperties());
+ Assertions.assertFalse((Boolean) map_without_additional_properties_sc.getAdditionalProperties());
addProps = ModelUtils.getAdditionalProperties(map_without_additional_properties_sc);
- Assert.assertEquals(addProps, null);
- Assert.assertNull(map_without_additional_properties_cp.getAdditionalProperties());
+ Assertions.assertEquals(addProps, null);
+ Assertions.assertNull(map_without_additional_properties_cp.getAdditionalProperties());
// check of composed schema model
String schemaName = "Parent";
schema = openAPI.getComponents().getSchemas().get(schemaName);
cm = codegen.fromModel(schemaName, schema);
- Assert.assertNotNull(cm.getAdditionalProperties());
+ Assertions.assertNotNull(cm.getAdditionalProperties());
}
@Test
@@ -478,15 +478,15 @@ public void testAdditionalPropertiesV3SpecDisallowAdditionalPropertiesIfNotPrese
codegen.setOpenAPI(openAPI);
Schema componentSchema = openAPI.getComponents().getSchemas().get("AdditionalPropertiesClass");
- Assert.assertNull(componentSchema.getAdditionalProperties());
+ Assertions.assertNull(componentSchema.getAdditionalProperties());
// When the 'additionalProperties' keyword is not present, the schema may be
// extended with any undeclared properties.
Schema addProps = ModelUtils.getAdditionalProperties(componentSchema);
- Assert.assertNotNull(addProps);
- Assert.assertEquals(addProps, new Schema());
+ Assertions.assertNotNull(addProps);
+ Assertions.assertEquals(addProps, new Schema());
CodegenModel cm = codegen.fromModel("AdditionalPropertiesClass", componentSchema);
- Assert.assertNotNull(cm.getAdditionalProperties());
+ Assertions.assertNotNull(cm.getAdditionalProperties());
Map modelPropSchemas = componentSchema.getProperties();
Schema map_with_undeclared_properties_string_sc = modelPropSchemas.get("map_with_undeclared_properties_string");
@@ -518,60 +518,60 @@ public void testAdditionalPropertiesV3SpecDisallowAdditionalPropertiesIfNotPrese
// This property has the following inline schema.
// additionalProperties:
// type: string
- Assert.assertNotNull(map_with_undeclared_properties_string_sc);
- Assert.assertNotNull(map_with_undeclared_properties_string_sc.getAdditionalProperties());
- Assert.assertNotNull(map_with_undeclared_properties_string_cp.getAdditionalProperties());
+ Assertions.assertNotNull(map_with_undeclared_properties_string_sc);
+ Assertions.assertNotNull(map_with_undeclared_properties_string_sc.getAdditionalProperties());
+ Assertions.assertNotNull(map_with_undeclared_properties_string_cp.getAdditionalProperties());
// map_with_undeclared_properties_anytype_1
// This property does not use the additionalProperties keyword,
// which means by default undeclared properties are allowed.
- Assert.assertNotNull(map_with_undeclared_properties_anytype_1_sc);
- Assert.assertNull(map_with_undeclared_properties_anytype_1_sc.getAdditionalProperties());
+ Assertions.assertNotNull(map_with_undeclared_properties_anytype_1_sc);
+ Assertions.assertNull(map_with_undeclared_properties_anytype_1_sc.getAdditionalProperties());
addProps = ModelUtils.getAdditionalProperties(map_with_undeclared_properties_anytype_1_sc);
- Assert.assertNotNull(addProps);
- Assert.assertEquals(addProps, new Schema());
- Assert.assertNotNull(map_with_undeclared_properties_anytype_1_cp.getAdditionalProperties());
+ Assertions.assertNotNull(addProps);
+ Assertions.assertEquals(addProps, new Schema());
+ Assertions.assertNotNull(map_with_undeclared_properties_anytype_1_cp.getAdditionalProperties());
// map_with_undeclared_properties_anytype_2
// This property does not use the additionalProperties keyword,
// which means by default undeclared properties are allowed.
- Assert.assertNotNull(map_with_undeclared_properties_anytype_2_sc);
- Assert.assertNull(map_with_undeclared_properties_anytype_2_sc.getAdditionalProperties());
+ Assertions.assertNotNull(map_with_undeclared_properties_anytype_2_sc);
+ Assertions.assertNull(map_with_undeclared_properties_anytype_2_sc.getAdditionalProperties());
addProps = ModelUtils.getAdditionalProperties(map_with_undeclared_properties_anytype_2_sc);
- Assert.assertNotNull(addProps);
- Assert.assertEquals(addProps, new Schema());
- Assert.assertNotNull(map_with_undeclared_properties_anytype_2_cp.getAdditionalProperties());
+ Assertions.assertNotNull(addProps);
+ Assertions.assertEquals(addProps, new Schema());
+ Assertions.assertNotNull(map_with_undeclared_properties_anytype_2_cp.getAdditionalProperties());
// map_with_undeclared_properties_anytype_3
// This property has the following inline schema.
// additionalProperties: true
- Assert.assertNotNull(map_with_undeclared_properties_anytype_3_sc);
+ Assertions.assertNotNull(map_with_undeclared_properties_anytype_3_sc);
// Unlike the V2 spec, in V3 we CAN differentiate between 'additionalProperties' not present and
// additionalProperties: true.
- Assert.assertNotNull(map_with_undeclared_properties_anytype_3_sc.getAdditionalProperties());
- Assert.assertEquals(map_with_undeclared_properties_anytype_3_sc.getAdditionalProperties(), Boolean.TRUE);
+ Assertions.assertNotNull(map_with_undeclared_properties_anytype_3_sc.getAdditionalProperties());
+ Assertions.assertEquals(map_with_undeclared_properties_anytype_3_sc.getAdditionalProperties(), Boolean.TRUE);
addProps = ModelUtils.getAdditionalProperties(map_with_undeclared_properties_anytype_3_sc);
- Assert.assertNotNull(addProps);
- Assert.assertEquals(addProps, new Schema());
- Assert.assertNotNull(map_with_undeclared_properties_anytype_3_cp.getAdditionalProperties());
+ Assertions.assertNotNull(addProps);
+ Assertions.assertEquals(addProps, new Schema());
+ Assertions.assertNotNull(map_with_undeclared_properties_anytype_3_cp.getAdditionalProperties());
// empty_map
// This property has the following inline schema.
// additionalProperties: false
- Assert.assertNotNull(empty_map_sc);
+ Assertions.assertNotNull(empty_map_sc);
// Unlike the V2 spec, in V3 we CAN differentiate between 'additionalProperties' not present and
// additionalProperties: false.
- Assert.assertNotNull(empty_map_sc.getAdditionalProperties());
- Assert.assertEquals(empty_map_sc.getAdditionalProperties(), Boolean.FALSE);
+ Assertions.assertNotNull(empty_map_sc.getAdditionalProperties());
+ Assertions.assertEquals(empty_map_sc.getAdditionalProperties(), Boolean.FALSE);
addProps = ModelUtils.getAdditionalProperties(empty_map_sc);
- Assert.assertNull(addProps);
- Assert.assertNull(empty_map_cp.getAdditionalProperties());
+ Assertions.assertNull(addProps);
+ Assertions.assertNull(empty_map_cp.getAdditionalProperties());
// check of composed schema model
String schemaName = "SomeObject";
Schema schema = openAPI.getComponents().getSchemas().get(schemaName);
cm = codegen.fromModel(schemaName, schema);
- Assert.assertNotNull(cm.getAdditionalProperties());
+ Assertions.assertNotNull(cm.getAdditionalProperties());
}
@Test
@@ -586,10 +586,10 @@ public void testAdditionalPropertiesV3SpecDisallowAdditionalPropertiesIfNotPrese
codegen.setOpenAPI(openAPI);
Schema schema = openAPI.getComponents().getSchemas().get("AdditionalPropertiesClass");
- Assert.assertNull(schema.getAdditionalProperties());
+ Assertions.assertNull(schema.getAdditionalProperties());
Schema addProps = ModelUtils.getAdditionalProperties(schema);
- Assert.assertNull(addProps);
+ Assertions.assertNull(addProps);
}
@Test
@@ -601,8 +601,8 @@ public void testEnsureNoDuplicateProduces() {
Operation operation = openAPI.getPaths().get("/test").getGet();
CodegenOperation co = codegen.fromOperation("/test", "get", operation, null);
- Assert.assertEquals(co.produces.size(), 1);
- Assert.assertEquals(co.produces.get(0).get("mediaType"), "application/json");
+ Assertions.assertEquals(co.produces.size(), 1);
+ Assertions.assertEquals(co.produces.get(0).get("mediaType"), "application/json");
}
@Test
@@ -617,14 +617,14 @@ public void testConsistentParameterNameAfterUniquenessRename() throws Exception
DefaultCodegen codegen = new DefaultCodegen();
codegen.setOpenAPI(openAPI);
CodegenOperation co = codegen.fromOperation("/some/path", "get", operation, null);
- Assert.assertEquals(co.path, "/some/path");
- Assert.assertEquals(co.allParams.size(), 2);
+ Assertions.assertEquals(co.path, "/some/path");
+ Assertions.assertEquals(co.allParams.size(), 2);
List allParamsNames = co.allParams.stream().map(p -> p.paramName).collect(Collectors.toList());
- Assert.assertTrue(allParamsNames.contains("myparam"));
- Assert.assertTrue(allParamsNames.contains("myparam2"));
+ Assertions.assertTrue(allParamsNames.contains("myparam"));
+ Assertions.assertTrue(allParamsNames.contains("myparam2"));
List queryParamsNames = co.queryParams.stream().map(p -> p.paramName).collect(Collectors.toList());
- Assert.assertTrue(queryParamsNames.contains("myparam"));
- Assert.assertTrue(queryParamsNames.contains("myparam2"));
+ Assertions.assertTrue(queryParamsNames.contains("myparam"));
+ Assertions.assertTrue(queryParamsNames.contains("myparam2"));
}
@Test
@@ -634,11 +634,11 @@ public void testUniquenessRenameOfFormParameters() throws Exception {
codegen.setOpenAPI(openAPI);
Operation operation = openAPI.getPaths().get("/form-param-poc/{id}").getPut();
CodegenOperation co = codegen.fromOperation("/form-param-poc/{id}", "put", operation, null);
- Assert.assertEquals(co.path, "/form-param-poc/{id}");
- Assert.assertEquals(co.allParams.size(), 2);
+ Assertions.assertEquals(co.path, "/form-param-poc/{id}");
+ Assertions.assertEquals(co.allParams.size(), 2);
List allParamsNames = co.allParams.stream().map(p -> p.paramName).collect(Collectors.toList());
- Assert.assertTrue(allParamsNames.contains("id"));
- Assert.assertTrue(allParamsNames.contains("id2"));
+ Assertions.assertTrue(allParamsNames.contains("id"));
+ Assertions.assertTrue(allParamsNames.contains("id2"));
}
@Test
@@ -651,8 +651,8 @@ public void testGetSchemaTypeWithComposedSchemaWithOneOf() {
ModelUtils.getSchemaFromRequestBody(operation.getRequestBody()));
String type = codegen.getSchemaType(schema);
- Assert.assertNotNull(type);
- Assert.assertEquals(type, "oneOf");
+ Assertions.assertNotNull(type);
+ Assertions.assertEquals(type, "oneOf");
}
@Test
@@ -668,7 +668,7 @@ public void testOneOfEnum() {
Set oneOf = new TreeSet();
oneOf.add("Dog");
oneOf.add("Cat");
- Assert.assertEquals(petItems.oneOf, oneOf);
+ Assertions.assertEquals(petItems.oneOf, oneOf);
// make sure that animal has the property type
boolean typeSeen = false;
boolean typeContainsEnums = false;
@@ -681,14 +681,14 @@ public void testOneOfEnum() {
break;
}
}
- Assert.assertTrue(typeSeen);
- Assert.assertTrue(typeContainsEnums);
+ Assertions.assertTrue(typeSeen);
+ Assertions.assertTrue(typeContainsEnums);
- Assert.assertEquals(
+ Assertions.assertEquals(
((StringSchema) openAPI.getComponents().getSchemas().get("Dog").getProperties().get("type")).getEnum().size(),
1
);
- Assert.assertEquals(
+ Assertions.assertEquals(
((StringSchema) openAPI.getComponents().getSchemas().get("Cat").getProperties().get("type")).getEnum().size(),
1
);
@@ -707,7 +707,7 @@ public void testOneOfMergeProperties() {
Set oneOf = new TreeSet();
oneOf.add("Dog");
oneOf.add("Cat");
- Assert.assertEquals(pet.oneOf, oneOf);
+ Assertions.assertEquals(pet.oneOf, oneOf);
// make sure that animal has the property type
boolean typeSeen = false;
for (CodegenProperty cp : pet.vars) {
@@ -716,7 +716,7 @@ public void testOneOfMergeProperties() {
break;
}
}
- Assert.assertTrue(typeSeen);
+ Assertions.assertTrue(typeSeen);
}
@Test
@@ -731,9 +731,9 @@ public void testComposedSchemaOneOfWithProperties() {
Set oneOf = new TreeSet();
oneOf.add("Apple");
oneOf.add("Banana");
- Assert.assertEquals(fruit.oneOf, oneOf);
- Assert.assertEquals(fruit.optionalVars.size(), 3);
- Assert.assertEquals(fruit.vars.size(), 3);
+ Assertions.assertEquals(fruit.oneOf, oneOf);
+ Assertions.assertEquals(fruit.optionalVars.size(), 3);
+ Assertions.assertEquals(fruit.vars.size(), 3);
// make sure that fruit has the property color
boolean colorSeen = false;
for (CodegenProperty cp : fruit.vars) {
@@ -742,7 +742,7 @@ public void testComposedSchemaOneOfWithProperties() {
break;
}
}
- Assert.assertTrue(colorSeen);
+ Assertions.assertTrue(colorSeen);
colorSeen = false;
for (CodegenProperty cp : fruit.optionalVars) {
if ("color".equals(cp.name)) {
@@ -750,19 +750,19 @@ public void testComposedSchemaOneOfWithProperties() {
break;
}
}
- Assert.assertTrue(colorSeen);
+ Assertions.assertTrue(colorSeen);
}
@Test
public void testEscapeText() {
final DefaultCodegen codegen = new DefaultCodegen();
- Assert.assertEquals(codegen.escapeText("\n"), " ");
- Assert.assertEquals(codegen.escapeText("\r"), " ");
- Assert.assertEquals(codegen.escapeText("\t"), " ");
- Assert.assertEquals(codegen.escapeText("\\"), "\\\\");
- Assert.assertEquals(codegen.escapeText("\""), "\\\"");
- Assert.assertEquals(codegen.escapeText("\\/"), "/");
+ Assertions.assertEquals(codegen.escapeText("\n"), " ");
+ Assertions.assertEquals(codegen.escapeText("\r"), " ");
+ Assertions.assertEquals(codegen.escapeText("\t"), " ");
+ Assertions.assertEquals(codegen.escapeText("\\"), "\\\\");
+ Assertions.assertEquals(codegen.escapeText("\""), "\\\"");
+ Assertions.assertEquals(codegen.escapeText("\\/"), "/");
}
@Test
@@ -770,14 +770,14 @@ public void testEscapeTextWhileAllowingNewLines() {
final DefaultCodegen codegen = new DefaultCodegen();
// allow new lines
- Assert.assertEquals(codegen.escapeTextWhileAllowingNewLines("\n"), "\n");
- Assert.assertEquals(codegen.escapeTextWhileAllowingNewLines("\r"), "\r");
+ Assertions.assertEquals(codegen.escapeTextWhileAllowingNewLines("\n"), "\n");
+ Assertions.assertEquals(codegen.escapeTextWhileAllowingNewLines("\r"), "\r");
// escape other special characters
- Assert.assertEquals(codegen.escapeTextWhileAllowingNewLines("\t"), " ");
- Assert.assertEquals(codegen.escapeTextWhileAllowingNewLines("\\"), "\\\\");
- Assert.assertEquals(codegen.escapeTextWhileAllowingNewLines("\""), "\\\"");
- Assert.assertEquals(codegen.escapeTextWhileAllowingNewLines("\\/"), "/");
+ Assertions.assertEquals(codegen.escapeTextWhileAllowingNewLines("\t"), " ");
+ Assertions.assertEquals(codegen.escapeTextWhileAllowingNewLines("\\"), "\\\\");
+ Assertions.assertEquals(codegen.escapeTextWhileAllowingNewLines("\""), "\\\"");
+ Assertions.assertEquals(codegen.escapeTextWhileAllowingNewLines("\\/"), "/");
}
@Test
@@ -788,12 +788,12 @@ public void updateCodegenPropertyEnum() {
codegen.updateCodegenPropertyEnum(array);
List> enumVars = (List>) array.getItems().getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars);
Map testedEnumVar = enumVars.get(0);
- Assert.assertNotNull(testedEnumVar);
- Assert.assertEquals(testedEnumVar.getOrDefault("name", ""), "_1");
- Assert.assertEquals(testedEnumVar.getOrDefault("value", ""), "\"1\"");
- Assert.assertEquals(testedEnumVar.getOrDefault("isString", ""), false);
+ Assertions.assertNotNull(testedEnumVar);
+ Assertions.assertEquals(testedEnumVar.getOrDefault("name", ""), "_1");
+ Assertions.assertEquals(testedEnumVar.getOrDefault("value", ""), "\"1\"");
+ Assertions.assertEquals(testedEnumVar.getOrDefault("isString", ""), false);
}
@Test
@@ -802,39 +802,39 @@ public void updateCodegenPropertyEnumWithExtension() {
CodegenProperty enumProperty = codegenPropertyWithXEnumVarName(Arrays.asList("dog", "cat"), Arrays.asList("DOGVAR", "CATVAR"));
(new DefaultCodegen()).updateCodegenPropertyEnum(enumProperty);
List> enumVars = (List>) enumProperty.getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
- Assert.assertNotNull(enumVars.get(0));
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOGVAR");
- Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"dog\"");
- Assert.assertNotNull(enumVars.get(1));
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CATVAR");
- Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"cat\"");
+ Assertions.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars.get(0));
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOGVAR");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"dog\"");
+ Assertions.assertNotNull(enumVars.get(1));
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CATVAR");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"cat\"");
}
{
CodegenProperty enumProperty = codegenPropertyWithXEnumVarName(Arrays.asList("1", "2"), Arrays.asList("ONE", "TWO"));
(new DefaultCodegen()).updateCodegenPropertyEnum(enumProperty);
List> enumVars = (List>) enumProperty.getAllowableValues().get("enumVars");
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "ONE");
- Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"1\"");
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "TWO");
- Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"2\"");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "ONE");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"1\"");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "TWO");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"2\"");
}
{
CodegenProperty enumProperty = codegenPropertyWithXEnumVarName(Arrays.asList("a", "b", "c", "d"), Arrays.asList("FOO", "BAR"));
(new DefaultCodegen()).updateCodegenPropertyEnum(enumProperty);
List> enumVars = (List>) enumProperty.getAllowableValues().get("enumVars");
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "FOO");
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "BAR");
- Assert.assertEquals(enumVars.get(2).getOrDefault("name", ""), "C");
- Assert.assertEquals(enumVars.get(3).getOrDefault("name", ""), "D");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "FOO");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "BAR");
+ Assertions.assertEquals(enumVars.get(2).getOrDefault("name", ""), "C");
+ Assertions.assertEquals(enumVars.get(3).getOrDefault("name", ""), "D");
}
{
CodegenProperty enumProperty = codegenPropertyWithXEnumVarName(Arrays.asList("a", "b"), Arrays.asList("FOO", "BAR", "BAZ"));
(new DefaultCodegen()).updateCodegenPropertyEnum(enumProperty);
List> enumVars = (List>) enumProperty.getAllowableValues().get("enumVars");
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "FOO");
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "BAR");
- Assert.assertEquals(enumVars.size(), 2);
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "FOO");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "BAR");
+ Assertions.assertEquals(enumVars.size(), 2);
}
}
@@ -846,13 +846,13 @@ public void updateCodegenPropertyEnumWithPrefixRemoved() {
codegen.updateCodegenPropertyEnum(enumProperty);
List> enumVars = (List>) enumProperty.getItems().getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
- Assert.assertNotNull(enumVars.get(0));
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOG");
- Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
- Assert.assertNotNull(enumVars.get(1));
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CAT");
- Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
+ Assertions.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars.get(0));
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOG");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
+ Assertions.assertNotNull(enumVars.get(1));
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CAT");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
}
@Test
@@ -865,13 +865,13 @@ public void updateCodegenPropertyEnumWithoutPrefixRemoved() {
codegen.updateCodegenPropertyEnum(enumProperty);
List> enumVars = (List>) enumProperty.getItems().getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
- Assert.assertNotNull(enumVars.get(0));
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "ANIMAL_DOG");
- Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
- Assert.assertNotNull(enumVars.get(1));
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "ANIMAL_CAT");
- Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
+ Assertions.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars.get(0));
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "ANIMAL_DOG");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
+ Assertions.assertNotNull(enumVars.get(1));
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "ANIMAL_CAT");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
}
@Test
@@ -883,13 +883,13 @@ public void postProcessModelsEnumWithPrefixRemoved() {
codegen.postProcessModelsEnum(objs);
List> enumVars = (List>) cm.getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
- Assert.assertNotNull(enumVars.get(0));
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOG");
- Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
- Assert.assertNotNull(enumVars.get(1));
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CAT");
- Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
+ Assertions.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars.get(0));
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOG");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
+ Assertions.assertNotNull(enumVars.get(1));
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CAT");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
}
@Test
@@ -902,13 +902,13 @@ public void postProcessModelsEnumWithoutPrefixRemoved() {
codegen.postProcessModelsEnum(objs);
List> enumVars = (List>) cm.getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
- Assert.assertNotNull(enumVars.get(0));
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "ANIMAL_DOG");
- Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
- Assert.assertNotNull(enumVars.get(1));
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "ANIMAL_CAT");
- Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
+ Assertions.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars.get(0));
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "ANIMAL_DOG");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"animal_dog\"");
+ Assertions.assertNotNull(enumVars.get(1));
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "ANIMAL_CAT");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"animal_cat\"");
}
@Test
@@ -920,15 +920,15 @@ public void postProcessModelsEnumWithExtension() {
codegen.postProcessModelsEnum(objs);
List> enumVars = (List>) cm.getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
- Assert.assertNotNull(enumVars.get(0));
- Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOGVAR");
- Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"dog\"");
- Assert.assertEquals(enumVars.get(0).getOrDefault("enumDescription", ""), "This is a dog");
- Assert.assertNotNull(enumVars.get(1));
- Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CATVAR");
- Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"cat\"");
- Assert.assertEquals(enumVars.get(1).getOrDefault("enumDescription", ""), "This is a cat");
+ Assertions.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars.get(0));
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOGVAR");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"dog\"");
+ Assertions.assertEquals(enumVars.get(0).getOrDefault("enumDescription", ""), "This is a dog");
+ Assertions.assertNotNull(enumVars.get(1));
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CATVAR");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"cat\"");
+ Assertions.assertEquals(enumVars.get(1).getOrDefault("enumDescription", ""), "This is a cat");
}
@Test
@@ -940,15 +940,15 @@ public void testExample1() {
CodegenParameter codegenParameter = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
codegen.setParameterExampleValue(codegenParameter, operation.getParameters().get(0));
- Assert.assertEquals(codegenParameter.example, "example1 value");
+ Assertions.assertEquals(codegenParameter.example, "example1 value");
Operation operation2 = openAPI.getPaths().get("/example1/plural").getGet();
CodegenParameter codegenParameter2 = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
codegen.setParameterExampleValue(codegenParameter2, operation2.getParameters().get(0));
- Assert.assertEquals(codegenParameter2.example, "An example1 value");
+ Assertions.assertEquals(codegenParameter2.example, "An example1 value");
// verify examples are available
codegen.setParameterExamples(codegenParameter2, operation2.getParameters().get(0));
- Assert.assertEquals(codegenParameter2.examples.size(), 1);
+ Assertions.assertEquals(codegenParameter2.examples.size(), 1);
}
@Test
@@ -960,7 +960,7 @@ public void testExample2() {
CodegenParameter codegenParameter = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
codegen.setParameterExampleValue(codegenParameter, operation.getParameters().get(0));
- Assert.assertEquals(codegenParameter.example, "example2 value");
+ Assertions.assertEquals(codegenParameter.example, "example2 value");
}
@Test
@@ -972,13 +972,13 @@ public void testExample3() {
CodegenParameter codegenParameter = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
codegen.setParameterExampleValue(codegenParameter, operation.getParameters().get(0));
- Assert.assertEquals(codegenParameter.example, "example3: parameter value");
+ Assertions.assertEquals(codegenParameter.example, "example3: parameter value");
Operation operation2 = openAPI.getPaths().get("/example3/plural").getGet();
CodegenParameter codegenParameter2 = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
codegen.setParameterExampleValue(codegenParameter2, operation2.getParameters().get(0));
- Assert.assertEquals(codegenParameter2.example, "An example3 value");
+ Assertions.assertEquals(codegenParameter2.example, "An example3 value");
}
@Test
@@ -990,13 +990,13 @@ public void testExample4() {
CodegenParameter codegenParameter = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
codegen.setParameterExampleValue(codegenParameter, operation.getRequestBody());
- Assert.assertEquals(codegenParameter.example, "example4 value");
+ Assertions.assertEquals(codegenParameter.example, "example4 value");
Operation operation2 = openAPI.getPaths().get("/example4/plural").getPost();
CodegenParameter codegenParameter2 = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
codegen.setParameterExampleValue(codegenParameter2, operation2.getRequestBody());
- Assert.assertEquals(codegenParameter2.example, "An example4 value");
+ Assertions.assertEquals(codegenParameter2.example, "An example4 value");
}
@Test
@@ -1010,23 +1010,23 @@ public void testExample5MultipleResponses() {
CodegenOperation codegenOperation = codegen.fromOperation(path, "GET", operation, null);
List> examples = codegenOperation.examples;
- Assert.assertEquals(examples.size(), 4);
+ Assertions.assertEquals(examples.size(), 4);
// 200 response example
- Assert.assertEquals(examples.get(0).get("contentType"), "application/json");
- Assert.assertEquals(examples.get(0).get("example"), "\"a successful response example\"");
- Assert.assertEquals(examples.get(0).get("statusCode"), "200");
+ Assertions.assertEquals(examples.get(0).get("contentType"), "application/json");
+ Assertions.assertEquals(examples.get(0).get("example"), "\"a successful response example\"");
+ Assertions.assertEquals(examples.get(0).get("statusCode"), "200");
// 301 response example
- Assert.assertEquals(examples.get(1).get("contentType"), "application/json");
- Assert.assertEquals(examples.get(1).get("example"), "\"a redirect response example\"");
- Assert.assertEquals(examples.get(1).get("statusCode"), "301");
+ Assertions.assertEquals(examples.get(1).get("contentType"), "application/json");
+ Assertions.assertEquals(examples.get(1).get("example"), "\"a redirect response example\"");
+ Assertions.assertEquals(examples.get(1).get("statusCode"), "301");
// 404 response example
- Assert.assertEquals(examples.get(2).get("contentType"), "application/json");
- Assert.assertEquals(examples.get(2).get("example"), "\"a not found response example\"");
- Assert.assertEquals(examples.get(2).get("statusCode"), "404");
+ Assertions.assertEquals(examples.get(2).get("contentType"), "application/json");
+ Assertions.assertEquals(examples.get(2).get("example"), "\"a not found response example\"");
+ Assertions.assertEquals(examples.get(2).get("statusCode"), "404");
// 500 response example
- Assert.assertEquals(examples.get(3).get("contentType"), "application/json");
- Assert.assertEquals(examples.get(3).get("example"), "\"an internal server error response example\"");
- Assert.assertEquals(examples.get(3).get("statusCode"), "500");
+ Assertions.assertEquals(examples.get(3).get("contentType"), "application/json");
+ Assertions.assertEquals(examples.get(3).get("example"), "\"an internal server error response example\"");
+ Assertions.assertEquals(examples.get(3).get("statusCode"), "500");
}
@Test
@@ -1044,8 +1044,8 @@ public void testDiscriminator() {
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Dog", "Dog"));
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Cat", "Cat"));
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("BigCat", "BigCat"));
- Assert.assertEquals(discriminator, test);
- Assert.assertEquals(animalModel.getHasDiscriminatorWithNonEmptyMapping(), true);
+ Assertions.assertEquals(discriminator, test);
+ Assertions.assertTrue(animalModel.getHasDiscriminatorWithNonEmptyMapping());
}
@Test
@@ -1064,7 +1064,7 @@ public void testDiscriminatorWithCustomMapping() {
codegen.setOpenAPI(openAPI);
CodegenModel personModel = codegen.fromModel("Person", person);
verifyPersonDiscriminator(personModel.discriminator);
- Assert.assertEquals(personModel.getHasDiscriminatorWithNonEmptyMapping(), true);
+ Assertions.assertTrue(personModel.getHasDiscriminatorWithNonEmptyMapping());
}
@Test
@@ -1075,8 +1075,8 @@ public void testParentName() {
Schema child = openAPI.getComponents().getSchemas().get("Child");
codegen.setOpenAPI(openAPI);
CodegenModel childModel = codegen.fromModel("Child", child);
- Assert.assertEquals(childModel.parentSchema, "Person");
- Assert.assertEquals(childModel.getHasDiscriminatorWithNonEmptyMapping(), false);
+ Assertions.assertEquals(childModel.parentSchema, "Person");
+ Assertions.assertFalse(childModel.getHasDiscriminatorWithNonEmptyMapping());
}
@Test
@@ -1087,7 +1087,7 @@ public void testAllOfRequired() {
Schema child = openAPI.getComponents().getSchemas().get("clubForCreation");
codegen.setOpenAPI(openAPI);
CodegenModel childModel = codegen.fromModel("clubForCreation", child);
- Assert.assertEquals(getRequiredVars(childModel), Collections.singletonList("name"));
+ Assertions.assertEquals(getRequiredVars(childModel), Collections.singletonList("name"));
}
@Test
@@ -1100,20 +1100,20 @@ public void testAllOfSingleAndDoubleRefWithOwnPropsNoDiscriminator() {
// to test allOf with double refs
Schema supermanSchema = openAPI.getComponents().getSchemas().get("SuperMan");
CodegenModel supermanModel = codegen.fromModel("SuperMan", supermanSchema);
- Assert.assertNull(supermanModel.parent);
- Assert.assertEquals(supermanModel.allParents, null);
+ Assertions.assertNull(supermanModel.parent);
+ Assertions.assertNull(supermanModel.allParents);
// to test allOf with single ref
Schema superboySchema = openAPI.getComponents().getSchemas().get("SuperBoy");
CodegenModel superboyModel = codegen.fromModel("SuperBoy", superboySchema);
- Assert.assertNull(superboyModel.parent);
- Assert.assertEquals(superboyModel.allParents, null);
+ Assertions.assertNull(superboyModel.parent);
+ Assertions.assertNull(superboyModel.allParents);
// to test allOf with single ref and no "type: object" in the (last) inline schema
Schema superbabySchema = openAPI.getComponents().getSchemas().get("SuperBaby");
CodegenModel superbabyModel = codegen.fromModel("SuperBaby", superbabySchema);
- Assert.assertNull(superbabyModel.parent);
- Assert.assertEquals(superbabyModel.allParents, null);
+ Assertions.assertNull(superbabyModel.parent);
+ Assertions.assertNull(superbabyModel.allParents);
}
@Test
@@ -1125,8 +1125,8 @@ public void testAllParents() {
Schema adultSchema = openAPI.getComponents().getSchemas().get("Adult");
CodegenModel adultModel = codegen.fromModel("Adult", adultSchema);
- Assert.assertEquals(adultModel.parent, "Person");
- Assert.assertEquals(adultModel.allParents, Collections.singletonList("Person"));
+ Assertions.assertEquals(adultModel.parent, "Person");
+ Assertions.assertEquals(adultModel.allParents, Collections.singletonList("Person"));
}
@Test
@@ -1149,8 +1149,8 @@ public void testComposedSchemaAllOfDiscriminatorMap() {
for (String leafModelName : leafModelNames) {
Schema leafSc = openAPI.getComponents().getSchemas().get(leafModelName);
CodegenModel leafCm = codegen.fromModel(leafModelName, leafSc);
- Assert.assertEquals(leafCm.discriminator, emptyMapDisc);
- Assert.assertEquals(leafCm.getHasDiscriminatorWithNonEmptyMapping(), false);
+ Assertions.assertEquals(leafCm.discriminator, emptyMapDisc);
+ Assertions.assertFalse(leafCm.getHasDiscriminatorWithNonEmptyMapping());
}
// the Pet discriminator map contains all animals + Reptile (children + grandchildren)
@@ -1166,8 +1166,8 @@ public void testComposedSchemaAllOfDiscriminatorMap() {
modelName = "Pet";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel pet = codegen.fromModel(modelName, sc);
- Assert.assertEquals(pet.getHasDiscriminatorWithNonEmptyMapping(), true);
- Assert.assertEquals(pet.discriminator, petDisc);
+ Assertions.assertTrue(pet.getHasDiscriminatorWithNonEmptyMapping());
+ Assertions.assertEquals(pet.discriminator, petDisc);
// the Reptile discriminator contains both reptiles
List reptileModelNames = Arrays.asList("Lizard", "Snake");
@@ -1182,8 +1182,8 @@ public void testComposedSchemaAllOfDiscriminatorMap() {
modelName = "Reptile";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel reptile = codegen.fromModel(modelName, sc);
- Assert.assertEquals(reptile.getHasDiscriminatorWithNonEmptyMapping(), true);
- Assert.assertEquals(reptile.discriminator, reptileDisc);
+ Assertions.assertTrue(reptile.getHasDiscriminatorWithNonEmptyMapping());
+ Assertions.assertEquals(reptile.discriminator, reptileDisc);
// the MyPets discriminator contains Cat and Lizard
List myPetNames = Arrays.asList("Cat", "Lizard");
@@ -1198,15 +1198,15 @@ public void testComposedSchemaAllOfDiscriminatorMap() {
modelName = "MyPets";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel myPets = codegen.fromModel(modelName, sc);
- Assert.assertEquals(myPets.getHasDiscriminatorWithNonEmptyMapping(), true);
- Assert.assertEquals(myPets.discriminator, myPetDisc);
+ Assertions.assertTrue(myPets.getHasDiscriminatorWithNonEmptyMapping());
+ Assertions.assertEquals(myPets.discriminator, myPetDisc);
// the MyPetsNoDisc discriminator is created because all oneOf classes have the same discriminator
modelName = "MyPetsNoDisc";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel myPetsNoDisc = codegen.fromModel(modelName, sc);
- Assert.assertEquals(myPetsNoDisc.getHasDiscriminatorWithNonEmptyMapping(), true);
- Assert.assertEquals(myPetsNoDisc.discriminator, myPetDisc);
+ Assertions.assertTrue(myPetsNoDisc.getHasDiscriminatorWithNonEmptyMapping());
+ Assertions.assertEquals(myPetsNoDisc.discriminator, myPetDisc);
CodegenModel cm;
@@ -1217,8 +1217,8 @@ public void testComposedSchemaAllOfDiscriminatorMap() {
hs.clear();
hs.add(new CodegenDiscriminator.MappedModel("b", codegen.toModelName("B"), true));
hs.add(new CodegenDiscriminator.MappedModel("C", codegen.toModelName("C")));
- Assert.assertEquals(cm.getHasDiscriminatorWithNonEmptyMapping(), true);
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertTrue(cm.getHasDiscriminatorWithNonEmptyMapping());
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// the mapping in b is in B
modelName = "B";
@@ -1227,8 +1227,8 @@ public void testComposedSchemaAllOfDiscriminatorMap() {
hs.clear();
hs.add(new CodegenDiscriminator.MappedModel("b", codegen.toModelName("B"), true));
hs.add(new CodegenDiscriminator.MappedModel("C", codegen.toModelName("C")));
- Assert.assertEquals(cm.getHasDiscriminatorWithNonEmptyMapping(), true);
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertTrue(cm.getHasDiscriminatorWithNonEmptyMapping());
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// the mapping in b is in C
modelName = "C";
@@ -1236,8 +1236,8 @@ public void testComposedSchemaAllOfDiscriminatorMap() {
cm = codegen.fromModel(modelName, sc);
hs.clear();
hs.add(new CodegenDiscriminator.MappedModel("b", codegen.toModelName("B"), true));
- Assert.assertEquals(cm.getHasDiscriminatorWithNonEmptyMapping(), true);
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertTrue(cm.getHasDiscriminatorWithNonEmptyMapping());
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
}
@Test
@@ -1260,7 +1260,7 @@ public void testComposedSchemaAllOfDiscriminatorMapLegacy() {
for (String leafModelName : leafModelNames) {
Schema leafSc = openAPI.getComponents().getSchemas().get(leafModelName);
CodegenModel leafCm = codegen.fromModel(leafModelName, leafSc);
- Assert.assertNull(leafCm.discriminator);
+ Assertions.assertNull(leafCm.discriminator);
}
// the Pet discriminator map contains all animals + Reptile (children + grandchildren)
@@ -1276,7 +1276,7 @@ public void testComposedSchemaAllOfDiscriminatorMapLegacy() {
modelName = "Pet";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel pet = codegen.fromModel(modelName, sc);
- Assert.assertEquals(pet.discriminator, petDisc);
+ Assertions.assertEquals(pet.discriminator, petDisc);
// the Reptile discriminator contains both reptiles
List reptileModelNames = Arrays.asList("Lizard", "Snake");
@@ -1291,7 +1291,7 @@ public void testComposedSchemaAllOfDiscriminatorMapLegacy() {
modelName = "Reptile";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel reptile = codegen.fromModel(modelName, sc);
- Assert.assertNull(reptile.discriminator);
+ Assertions.assertNull(reptile.discriminator);
// the MyPets discriminator contains Cat and Lizard
CodegenDiscriminator myPetDisc = new CodegenDiscriminator();
@@ -1301,13 +1301,13 @@ public void testComposedSchemaAllOfDiscriminatorMapLegacy() {
modelName = "MyPets";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel myPets = codegen.fromModel(modelName, sc);
- Assert.assertEquals(myPets.discriminator, myPetDisc);
+ Assertions.assertEquals(myPets.discriminator, myPetDisc);
// the MyPetsNoDisc discriminator is created because all oneOf classes have the same discriminator
modelName = "MyPetsNoDisc";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel myPetsNoDisc = codegen.fromModel(modelName, sc);
- Assert.assertNull(myPetsNoDisc.discriminator);
+ Assertions.assertNull(myPetsNoDisc.discriminator);
CodegenModel cm;
@@ -1317,19 +1317,19 @@ public void testComposedSchemaAllOfDiscriminatorMapLegacy() {
cm = codegen.fromModel(modelName, sc);
hs.clear();
hs.add(new CodegenDiscriminator.MappedModel("b", codegen.toModelName("B"), true));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// the mapping in b is in B
modelName = "B";
sc = openAPI.getComponents().getSchemas().get(modelName);
cm = codegen.fromModel(modelName, sc);
- Assert.assertNull(cm.discriminator);
+ Assertions.assertNull(cm.discriminator);
// the mapping in b is in C
modelName = "C";
sc = openAPI.getComponents().getSchemas().get(modelName);
cm = codegen.fromModel(modelName, sc);
- Assert.assertNull(cm.discriminator);
+ Assertions.assertNull(cm.discriminator);
}
@Test
@@ -1359,9 +1359,9 @@ public void testComposedSchemaOneOfDiscriminatorsInvalid() {
// comment out below as we're now showing warnings instead of throwing exceptions
try {
codegen.fromModel(modelName, sc);
- Assert.assertTrue(false, "A RuntimeException should have been thrown when processing "+modelName+ " but it was not");
+ Assertions.assertTrue(false, "A RuntimeException should have been thrown when processing "+modelName+ " but it was not");
} catch (RuntimeException re) {
- Assert.assertEquals(re.getMessage(), errorMessageExpected);
+ Assertions.assertEquals(re.getMessage(), errorMessageExpected);
}
*/
}
@@ -1394,9 +1394,9 @@ public void testComposedSchemaAnyOfDiscriminatorsInvalid() {
// comment out below as we're now showing warnings instead of throwing exceptions
try {
codegen.fromModel(modelName, sc);
- Assert.assertTrue(false, "A RuntimeException should have been thrown when processing "+modelName+ " but it was not");
+ Assertions.assertTrue(false, "A RuntimeException should have been thrown when processing "+modelName+ " but it was not");
} catch (RuntimeException re) {
- Assert.assertEquals(re.getMessage(), errorMessageExpected);
+ Assertions.assertEquals(re.getMessage(), errorMessageExpected);
}
*/
}
@@ -1424,13 +1424,13 @@ public void testComposedSchemaAnyOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, codegen.toModelName(mn)));
mn = "FruitInlineDisc_anyOf_1";
hs.add(new CodegenDiscriminator.MappedModel(mn, codegen.toModelName(mn)));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// inline anyOf with inline anyOf model doesn't work because we have null $refs and we throw an exception
final String fmodelName = "FruitInlineInlineDisc";
final Schema fsc = openAPI.getComponents().getSchemas().get(fmodelName);
// comment out below as we're now showing warnings instead of throwing exceptions
- //Assert.assertThrows(() -> codegen.fromModel(fmodelName, fsc));
+ //Assertions.assertThrows(() -> codegen.fromModel(fmodelName, fsc));
// ref anyOf models with discriminator in properties in those models
modelName = "FruitReqDisc";
@@ -1441,7 +1441,7 @@ public void testComposedSchemaAnyOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaReqDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with discriminator in allOf in those models
modelName = "FruitAllOfDisc";
@@ -1452,7 +1452,7 @@ public void testComposedSchemaAnyOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaAllOfDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with discriminator in anyOf in those models
modelName = "FruitAnyOfDisc";
@@ -1463,7 +1463,7 @@ public void testComposedSchemaAnyOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaAnyOfDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with discriminator in anyOf in those models
modelName = "FruitAnyOfDisc";
@@ -1474,7 +1474,7 @@ public void testComposedSchemaAnyOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaAnyOfDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with discriminator in the grandparent schemas of those anyof models
modelName = "FruitGrandparentDisc";
@@ -1485,7 +1485,7 @@ public void testComposedSchemaAnyOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaGrandparentDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
}
@Test
@@ -1510,13 +1510,13 @@ public void testComposedSchemaOneOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, codegen.toModelName(mn)));
mn = "FruitInlineDisc_oneOf_1";
hs.add(new CodegenDiscriminator.MappedModel(mn, codegen.toModelName(mn)));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// inline oneOf with inline oneOf model doesn't work because we have null $refs and we throw an exception
final String fmodelName = "FruitInlineInlineDisc";
final Schema fsc = openAPI.getComponents().getSchemas().get(fmodelName);
// comment out below as we're now showing warnings instead of throwing exceptions
- //Assert.assertThrows(() -> codegen.fromModel(fmodelName, fsc));
+ //Assertions.assertThrows(() -> codegen.fromModel(fmodelName, fsc));
// ref oneOf models with discriminator in properties in those models
modelName = "FruitReqDisc";
@@ -1527,7 +1527,7 @@ public void testComposedSchemaOneOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaReqDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with discriminator in allOf in those models
modelName = "FruitAllOfDisc";
@@ -1538,7 +1538,7 @@ public void testComposedSchemaOneOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaAllOfDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with discriminator in anyOf in those models
modelName = "FruitAnyOfDisc";
@@ -1549,7 +1549,7 @@ public void testComposedSchemaOneOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaAnyOfDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with discriminator in oneOf in those models
modelName = "FruitOneOfDisc";
@@ -1560,7 +1560,7 @@ public void testComposedSchemaOneOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaOneOfDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
// ref oneOf models with enum property discriminator
modelName = "FruitOneOfEnumMappingDisc";
@@ -1577,7 +1577,7 @@ public void testComposedSchemaOneOfDiscriminatorMap() {
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
mn = "BananaGrandparentDisc";
hs.add(new CodegenDiscriminator.MappedModel(mn, mn));
- Assert.assertEquals(cm.discriminator.getMappedModels(), hs);
+ Assertions.assertEquals(cm.discriminator.getMappedModels(), hs);
}
@Test
@@ -1703,13 +1703,14 @@ public void verifyXDiscriminatorValue() {
List files = new ArrayList<>();
List filteredSchemas = ModelUtils.getSchemasUsedOnlyInFormParam(openAPI);
List allModels = new ArrayList<>();
- generator.generateModels(files, allModels, filteredSchemas);
+ List aliasModels = new ArrayList<>();
+ generator.generateModels(files, allModels, filteredSchemas, aliasModels);
// check that the model's children contain the x-discriminator-values
modelName = "BaseObj";
cm = getModel(allModels, modelName);
- Assert.assertNotNull(cm);
- Assert.assertNotNull(cm.children);
+ Assertions.assertNotNull(cm);
+ Assertions.assertNotNull(cm.children);
List expectedDiscriminatorValues = new ArrayList<>(Arrays.asList("daily", "sub-obj"));
ArrayList xDiscriminatorValues = new ArrayList<>();
for (CodegenModel child : cm.children) {
@@ -1738,9 +1739,9 @@ public void testAllOfSingleRefNoOwnProps() {
Schema schema = openAPI.getComponents().getSchemas().get("NewMessageEventCoreNoOwnProps");
codegen.setOpenAPI(openAPI);
CodegenModel model = codegen.fromModel("NewMessageEventCoreNoOwnProps", schema);
- Assert.assertEquals(getNames(model.getVars()), Arrays.asList("id", "message"));
- Assert.assertNull(model.parent);
- Assert.assertNull(model.allParents);
+ Assertions.assertEquals(getNames(model.getVars()), Arrays.asList("id", "message"));
+ Assertions.assertNull(model.parent);
+ Assertions.assertNull(model.allParents);
}
@Test
@@ -1751,15 +1752,15 @@ public void testAllOfParent() {
Schema person = openAPI.getComponents().getSchemas().get("person");
CodegenModel personModel = codegen.fromModel("person", person);
- Assert.assertEquals(getRequiredVars(personModel), Arrays.asList("firstName", "name", "email", "id"));
+ Assertions.assertEquals(getRequiredVars(personModel), Arrays.asList("firstName", "name", "email", "id"));
Schema personForCreation = openAPI.getComponents().getSchemas().get("personForCreation");
CodegenModel personForCreationModel = codegen.fromModel("personForCreation", personForCreation);
- Assert.assertEquals(getRequiredVars(personForCreationModel), Arrays.asList("firstName", "name", "email"));
+ Assertions.assertEquals(getRequiredVars(personForCreationModel), Arrays.asList("firstName", "name", "email"));
Schema personForUpdate = openAPI.getComponents().getSchemas().get("personForUpdate");
CodegenModel personForUpdateModel = codegen.fromModel("personForUpdate", personForUpdate);
- Assert.assertEquals(getRequiredVars(personForUpdateModel), Collections.emptyList());
+ Assertions.assertEquals(getRequiredVars(personForUpdateModel), Collections.emptyList());
}
private List getRequiredVars(CodegenModel model) {
@@ -1781,40 +1782,40 @@ public void testCallbacks() {
Operation subscriptionOperation = openAPI.getPaths().get("/streams").getPost();
CodegenOperation op = codegen.fromOperation(path, "post", subscriptionOperation, null);
- Assert.assertFalse(op.isCallbackRequest);
- Assert.assertNotNull(op.operationId);
- Assert.assertEquals(op.callbacks.size(), 2);
+ Assertions.assertFalse(op.isCallbackRequest);
+ Assertions.assertNotNull(op.operationId);
+ Assertions.assertEquals(op.callbacks.size(), 2);
CodegenCallback cbB = op.callbacks.get(1);
- Assert.assertEquals(cbB.name, "dummy");
- Assert.assertEquals(cbB.urls.size(), 0);
+ Assertions.assertEquals(cbB.name, "dummy");
+ Assertions.assertEquals(cbB.urls.size(), 0);
CodegenCallback cbA = op.callbacks.get(0);
- Assert.assertEquals(cbA.name, "onData");
+ Assertions.assertEquals(cbA.name, "onData");
- Assert.assertEquals(cbA.urls.size(), 2);
+ Assertions.assertEquals(cbA.urls.size(), 2);
CodegenCallback.Url urlB = cbA.urls.get(1);
- Assert.assertEquals(urlB.expression, "{$request.query.callbackUrl}/test");
- Assert.assertEquals(urlB.requests.size(), 0);
+ Assertions.assertEquals(urlB.expression, "{$request.query.callbackUrl}/test");
+ Assertions.assertEquals(urlB.requests.size(), 0);
CodegenCallback.Url urlA = cbA.urls.get(0);
- Assert.assertEquals(urlA.expression, "{$request.query.callbackUrl}/data");
- Assert.assertEquals(urlA.requests.size(), 2);
+ Assertions.assertEquals(urlA.expression, "{$request.query.callbackUrl}/data");
+ Assertions.assertEquals(urlA.requests.size(), 2);
urlA.requests.forEach(req -> {
- Assert.assertTrue(req.isCallbackRequest);
- Assert.assertNotNull(req.bodyParam);
- Assert.assertEquals(req.responses.size(), 2);
+ Assertions.assertTrue(req.isCallbackRequest);
+ Assertions.assertNotNull(req.bodyParam);
+ Assertions.assertEquals(req.responses.size(), 2);
switch (req.httpMethod.toLowerCase(Locale.getDefault())) {
case "post":
- Assert.assertEquals(req.operationId, "onDataDataPost");
- Assert.assertEquals(req.bodyParam.dataType, "NewNotificationData");
+ Assertions.assertEquals(req.operationId, "onDataDataPost");
+ Assertions.assertEquals(req.bodyParam.dataType, "NewNotificationData");
break;
case "delete":
- Assert.assertEquals(req.operationId, "onDataDataDelete");
- Assert.assertEquals(req.bodyParam.dataType, "DeleteNotificationData");
+ Assertions.assertEquals(req.operationId, "onDataDataDelete");
+ Assertions.assertEquals(req.bodyParam.dataType, "DeleteNotificationData");
break;
default:
Assert.fail(String.format(Locale.getDefault(), "invalid callback request http method '%s'", req.httpMethod));
@@ -1833,9 +1834,9 @@ public void testLeadingSlashIsAddedIfMissing() {
codegen.setOpenAPI(openAPI);
CodegenOperation co1 = codegen.fromOperation("/here", "get", operation2, null);
- Assert.assertEquals(co1.path, "/here");
+ Assertions.assertEquals(co1.path, "/here");
CodegenOperation co2 = codegen.fromOperation("some/path", "get", operation2, null);
- Assert.assertEquals(co2.path, "/some/path");
+ Assertions.assertEquals(co2.path, "/some/path");
}
@Test
@@ -1853,8 +1854,8 @@ public void testDefaultResponseShouldBeLast() {
codegen.setOpenAPI(openAPI);
CodegenOperation co = codegen.fromOperation("/here", "get", myOperation, null);
- Assert.assertEquals(co.responses.get(0).message, "Error");
- Assert.assertEquals(co.responses.get(1).message, "Default");
+ Assertions.assertEquals(co.responses.get(0).message, "Error");
+ Assertions.assertEquals(co.responses.get(1).message, "Default");
}
@Test
@@ -1871,8 +1872,8 @@ public void testResponseWithNoSchemaInHeaders() {
codegen.setOpenAPI(openAPI);
CodegenResponse cr = codegen.fromResponse("2XX", response2XX);
- Assert.assertNotNull(cr);
- Assert.assertTrue(cr.hasHeaders);
+ Assertions.assertNotNull(cr);
+ Assertions.assertTrue(cr.hasHeaders);
}
@Test
@@ -1884,7 +1885,7 @@ public void testNullableProperty() {
CodegenProperty property = codegen.fromProperty("address", (Schema) openAPI.getComponents().getSchemas().get("User").getProperties().get("address"));
- Assert.assertTrue(property.isNullable);
+ Assertions.assertTrue(property.isNullable);
}
@Test
@@ -1895,10 +1896,10 @@ public void testDeprecatedModel() {
codegen.setOpenAPI(openAPI);
CodegenModel codegenPetModel = codegen.fromModel("Pet", openAPI.getComponents().getSchemas().get("Pet"));
- Assert.assertTrue(codegenPetModel.isDeprecated);
+ Assertions.assertTrue(codegenPetModel.isDeprecated);
CodegenModel codegenFoodModel = codegen.fromModel("Food", openAPI.getComponents().getSchemas().get("Food"));
- Assert.assertTrue(codegenFoodModel.isDeprecated);
+ Assertions.assertTrue(codegenFoodModel.isDeprecated);
}
@Test
@@ -1911,10 +1912,10 @@ public void testDeprecatedProperty() {
final Map responseProperties = Collections.unmodifiableMap(openAPI.getComponents().getSchemas().get("Response").getProperties());
final Map requestProperties = Collections.unmodifiableMap(openAPI.getComponents().getSchemas().get("Response").getProperties());
- Assert.assertTrue(codegen.fromProperty("firstName", (Schema) responseProperties.get("firstName")).deprecated);
- Assert.assertFalse(codegen.fromProperty("customerCode", (Schema) responseProperties.get("customerCode")).deprecated);
- Assert.assertTrue(codegen.fromProperty("firstName", (Schema) requestProperties.get("firstName")).deprecated);
- Assert.assertFalse(codegen.fromProperty("customerCode", (Schema) requestProperties.get("customerCode")).deprecated);
+ Assertions.assertTrue(codegen.fromProperty("firstName", (Schema) responseProperties.get("firstName")).deprecated);
+ Assertions.assertFalse(codegen.fromProperty("customerCode", (Schema) responseProperties.get("customerCode")).deprecated);
+ Assertions.assertTrue(codegen.fromProperty("firstName", (Schema) requestProperties.get("firstName")).deprecated);
+ Assertions.assertFalse(codegen.fromProperty("customerCode", (Schema) requestProperties.get("customerCode")).deprecated);
}
@Test
@@ -1926,8 +1927,8 @@ public void testTitleProperty() {
final Map testProperties = Collections.unmodifiableMap(openAPI.getComponents().getSchemas().get("ModelWithTitledProperties").getProperties());
- Assert.assertEquals("Simple-Property-Title", codegen.fromProperty("simpleProperty", (Schema) testProperties.get("simpleProperty")).title);
- Assert.assertEquals("Ref-Property-Title", codegen.fromProperty("refProperty", (Schema) testProperties.get("refProperty")).title);
+ Assertions.assertEquals("Simple-Property-Title", codegen.fromProperty("simpleProperty", (Schema) testProperties.get("simpleProperty")).title);
+ Assertions.assertEquals("Ref-Property-Title", codegen.fromProperty("refProperty", (Schema) testProperties.get("refProperty")).title);
}
@Test
@@ -1939,8 +1940,8 @@ public void testDeprecatedRef() {
final Map requestProperties = Collections.unmodifiableMap(openAPI.getComponents().getSchemas().get("complex").getProperties());
- Assert.assertTrue(codegen.fromProperty("deprecated", (Schema) requestProperties.get("deprecated")).deprecated);
- Assert.assertFalse(codegen.fromProperty("current", (Schema) requestProperties.get("current")).deprecated);
+ Assertions.assertTrue(codegen.fromProperty("deprecated", (Schema) requestProperties.get("deprecated")).deprecated);
+ Assertions.assertFalse(codegen.fromProperty("current", (Schema) requestProperties.get("current")).deprecated);
}
@Test
@@ -1952,27 +1953,27 @@ public void integerSchemaPropertyAndModelTest() {
//Property:
final CodegenProperty cp = codegen.fromProperty("someProperty", schema);
- Assert.assertEquals(cp.baseType, "integer");
- Assert.assertEquals(cp.baseName, "someProperty");
- Assert.assertFalse(cp.isString);
- Assert.assertTrue(cp.isInteger);
- Assert.assertFalse(cp.isLong);
- Assert.assertFalse(cp.isNumber);
- Assert.assertTrue(cp.isNumeric);
- Assert.assertFalse(cp.isFloat);
- Assert.assertFalse(cp.isDouble);
+ Assertions.assertEquals(cp.baseType, "integer");
+ Assertions.assertEquals(cp.baseName, "someProperty");
+ Assertions.assertFalse(cp.isString);
+ Assertions.assertTrue(cp.isInteger);
+ Assertions.assertFalse(cp.isLong);
+ Assertions.assertFalse(cp.isNumber);
+ Assertions.assertTrue(cp.isNumeric);
+ Assertions.assertFalse(cp.isFloat);
+ Assertions.assertFalse(cp.isDouble);
//Model:
final CodegenModel cm = codegen.fromModel("someModel", schema);
- Assert.assertEquals(cm.dataType, "integer");
- Assert.assertEquals(cm.name, "someModel");
- Assert.assertFalse(cm.isString);
- Assert.assertTrue(cm.isInteger);
- Assert.assertFalse(cm.isLong);
- Assert.assertFalse(cm.isNumber);
- Assert.assertTrue(cm.isNumeric);
- Assert.assertFalse(cm.isFloat);
- Assert.assertFalse(cm.isDouble);
+ Assertions.assertEquals(cm.dataType, "integer");
+ Assertions.assertEquals(cm.name, "someModel");
+ Assertions.assertFalse(cm.isString);
+ Assertions.assertTrue(cm.isInteger);
+ Assertions.assertFalse(cm.isLong);
+ Assertions.assertFalse(cm.isNumber);
+ Assertions.assertTrue(cm.isNumeric);
+ Assertions.assertFalse(cm.isFloat);
+ Assertions.assertFalse(cm.isDouble);
}
@Test
@@ -1984,27 +1985,27 @@ public void longSchemaPropertyAndModelTest() {
//Property:
final CodegenProperty cp = codegen.fromProperty("someProperty", schema);
- Assert.assertEquals(cp.baseType, "long");
- Assert.assertEquals(cp.baseName, "someProperty");
- Assert.assertFalse(cp.isString);
- Assert.assertFalse(cp.isInteger);
- Assert.assertTrue(cp.isLong);
- Assert.assertFalse(cp.isNumber);
- Assert.assertTrue(cp.isNumeric);
- Assert.assertFalse(cp.isFloat);
- Assert.assertFalse(cp.isDouble);
+ Assertions.assertEquals(cp.baseType, "long");
+ Assertions.assertEquals(cp.baseName, "someProperty");
+ Assertions.assertFalse(cp.isString);
+ Assertions.assertFalse(cp.isInteger);
+ Assertions.assertTrue(cp.isLong);
+ Assertions.assertFalse(cp.isNumber);
+ Assertions.assertTrue(cp.isNumeric);
+ Assertions.assertFalse(cp.isFloat);
+ Assertions.assertFalse(cp.isDouble);
//Model:
final CodegenModel cm = codegen.fromModel("someModel", schema);
- Assert.assertEquals(cm.dataType, "long");
- Assert.assertEquals(cm.name, "someModel");
- Assert.assertFalse(cm.isString);
- Assert.assertFalse(cm.isInteger);
- Assert.assertTrue(cm.isLong);
- Assert.assertFalse(cm.isNumber);
- Assert.assertTrue(cm.isNumeric);
- Assert.assertFalse(cm.isFloat);
- Assert.assertFalse(cm.isDouble);
+ Assertions.assertEquals(cm.dataType, "long");
+ Assertions.assertEquals(cm.name, "someModel");
+ Assertions.assertFalse(cm.isString);
+ Assertions.assertFalse(cm.isInteger);
+ Assertions.assertTrue(cm.isLong);
+ Assertions.assertFalse(cm.isNumber);
+ Assertions.assertTrue(cm.isNumeric);
+ Assertions.assertFalse(cm.isFloat);
+ Assertions.assertFalse(cm.isDouble);
}
@Test
@@ -2016,27 +2017,27 @@ public void numberSchemaPropertyAndModelTest() {
//Property:
final CodegenProperty cp = codegen.fromProperty("someProperty", schema);
- Assert.assertEquals(cp.baseType, "number");
- Assert.assertEquals(cp.baseName, "someProperty");
- Assert.assertFalse(cp.isString);
- Assert.assertFalse(cp.isInteger);
- Assert.assertFalse(cp.isLong);
- Assert.assertTrue(cp.isNumber);
- Assert.assertTrue(cp.isNumeric);
- Assert.assertFalse(cp.isFloat);
- Assert.assertFalse(cp.isDouble);
+ Assertions.assertEquals(cp.baseType, "number");
+ Assertions.assertEquals(cp.baseName, "someProperty");
+ Assertions.assertFalse(cp.isString);
+ Assertions.assertFalse(cp.isInteger);
+ Assertions.assertFalse(cp.isLong);
+ Assertions.assertTrue(cp.isNumber);
+ Assertions.assertTrue(cp.isNumeric);
+ Assertions.assertFalse(cp.isFloat);
+ Assertions.assertFalse(cp.isDouble);
//Model:
final CodegenModel cm = codegen.fromModel("someModel", schema);
- Assert.assertEquals(cm.dataType, "number");
- Assert.assertEquals(cm.name, "someModel");
- Assert.assertFalse(cm.isString);
- Assert.assertFalse(cm.isInteger);
- Assert.assertFalse(cm.isLong);
- Assert.assertTrue(cm.isNumber);
- Assert.assertTrue(cm.isNumeric);
- Assert.assertFalse(cm.isFloat);
- Assert.assertFalse(cm.isDouble);
+ Assertions.assertEquals(cm.dataType, "number");
+ Assertions.assertEquals(cm.name, "someModel");
+ Assertions.assertFalse(cm.isString);
+ Assertions.assertFalse(cm.isInteger);
+ Assertions.assertFalse(cm.isLong);
+ Assertions.assertTrue(cm.isNumber);
+ Assertions.assertTrue(cm.isNumeric);
+ Assertions.assertFalse(cm.isFloat);
+ Assertions.assertFalse(cm.isDouble);
}
@Test
@@ -2048,27 +2049,27 @@ public void numberFloatSchemaPropertyAndModelTest() {
//Property:
final CodegenProperty cp = codegen.fromProperty("someProperty", schema);
- Assert.assertEquals(cp.baseType, "float");
- Assert.assertEquals(cp.baseName, "someProperty");
- Assert.assertFalse(cp.isString);
- Assert.assertFalse(cp.isInteger);
- Assert.assertFalse(cp.isLong);
- Assert.assertFalse(cp.isNumber);
- Assert.assertTrue(cp.isNumeric);
- Assert.assertTrue(cp.isFloat);
- Assert.assertFalse(cp.isDouble);
+ Assertions.assertEquals(cp.baseType, "float");
+ Assertions.assertEquals(cp.baseName, "someProperty");
+ Assertions.assertFalse(cp.isString);
+ Assertions.assertFalse(cp.isInteger);
+ Assertions.assertFalse(cp.isLong);
+ Assertions.assertFalse(cp.isNumber);
+ Assertions.assertTrue(cp.isNumeric);
+ Assertions.assertTrue(cp.isFloat);
+ Assertions.assertFalse(cp.isDouble);
//Model:
final CodegenModel cm = codegen.fromModel("someModel", schema);
- Assert.assertEquals(cm.dataType, "float");
- Assert.assertEquals(cm.name, "someModel");
- Assert.assertFalse(cm.isString);
- Assert.assertFalse(cm.isInteger);
- Assert.assertFalse(cm.isLong);
- Assert.assertFalse(cm.isNumber);
- Assert.assertTrue(cm.isNumeric);
- Assert.assertTrue(cm.isFloat);
- Assert.assertFalse(cm.isDouble);
+ Assertions.assertEquals(cm.dataType, "float");
+ Assertions.assertEquals(cm.name, "someModel");
+ Assertions.assertFalse(cm.isString);
+ Assertions.assertFalse(cm.isInteger);
+ Assertions.assertFalse(cm.isLong);
+ Assertions.assertFalse(cm.isNumber);
+ Assertions.assertTrue(cm.isNumeric);
+ Assertions.assertTrue(cm.isFloat);
+ Assertions.assertFalse(cm.isDouble);
}
@Test
@@ -2080,27 +2081,27 @@ public void numberDoubleSchemaPropertyAndModelTest() {
//Property:
final CodegenProperty cp = codegen.fromProperty("someProperty", schema);
- Assert.assertEquals(cp.baseType, "double");
- Assert.assertEquals(cp.baseName, "someProperty");
- Assert.assertFalse(cp.isString);
- Assert.assertFalse(cp.isInteger);
- Assert.assertFalse(cp.isLong);
- Assert.assertFalse(cp.isNumber);
- Assert.assertTrue(cp.isNumeric);
- Assert.assertFalse(cp.isFloat);
- Assert.assertTrue(cp.isDouble);
+ Assertions.assertEquals(cp.baseType, "double");
+ Assertions.assertEquals(cp.baseName, "someProperty");
+ Assertions.assertFalse(cp.isString);
+ Assertions.assertFalse(cp.isInteger);
+ Assertions.assertFalse(cp.isLong);
+ Assertions.assertFalse(cp.isNumber);
+ Assertions.assertTrue(cp.isNumeric);
+ Assertions.assertFalse(cp.isFloat);
+ Assertions.assertTrue(cp.isDouble);
//Model:
final CodegenModel cm = codegen.fromModel("someModel", schema);
- Assert.assertEquals(cm.dataType, "double");
- Assert.assertEquals(cm.name, "someModel");
- Assert.assertFalse(cm.isString);
- Assert.assertFalse(cm.isInteger);
- Assert.assertFalse(cm.isLong);
- Assert.assertFalse(cm.isNumber);
- Assert.assertTrue(cm.isNumeric);
- Assert.assertFalse(cm.isFloat);
- Assert.assertTrue(cm.isDouble);
+ Assertions.assertEquals(cm.dataType, "double");
+ Assertions.assertEquals(cm.name, "someModel");
+ Assertions.assertFalse(cm.isString);
+ Assertions.assertFalse(cm.isInteger);
+ Assertions.assertFalse(cm.isLong);
+ Assertions.assertFalse(cm.isNumber);
+ Assertions.assertTrue(cm.isNumeric);
+ Assertions.assertFalse(cm.isFloat);
+ Assertions.assertTrue(cm.isDouble);
}
@Test
@@ -2115,14 +2116,14 @@ public void testAlias() {
"MyParameterTextField",
openAPI.getComponents().getSchemas().get("MyParameterTextField")
);
- Assert.assertTrue(typeAliasModel.isAlias);
- Assert.assertEquals(typeAliasModel.dataType, "string");
+ Assertions.assertTrue(typeAliasModel.isAlias);
+ Assertions.assertEquals(typeAliasModel.dataType, "string");
CodegenModel composedModel = codegen.fromModel(
"ComposedModel",
openAPI.getComponents().getSchemas().get("ComposedModel")
);
- Assert.assertFalse(composedModel.isAlias);
+ Assertions.assertFalse(composedModel.isAlias);
}
private void verifyPersonDiscriminator(CodegenDiscriminator discriminator) {
@@ -2134,7 +2135,7 @@ private void verifyPersonDiscriminator(CodegenDiscriminator discriminator) {
test.getMapping().put("c", "Child");
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("a", "Adult", true));
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("c", "Child", true));
- Assert.assertEquals(discriminator, test);
+ Assertions.assertEquals(discriminator, test);
}
private CodegenProperty codegenPropertyWithArrayOfIntegerValues() {
@@ -2212,13 +2213,13 @@ public void objectQueryParamIdentifyAsObject() {
CodegenParameter parameter = codegen.fromParameter(openAPI.getPaths().get("/pony").getGet().getParameters().get(0), imports);
// TODO: This must be updated to work with flattened inline models
- Assert.assertEquals(parameter.dataType, "ListPageQueryParameter");
- Assert.assertEquals(imports.size(), 1);
- Assert.assertEquals(imports.iterator().next(), "ListPageQueryParameter");
+ Assertions.assertEquals(parameter.dataType, "ListPageQueryParameter");
+ Assertions.assertEquals(imports.size(), 1);
+ Assertions.assertEquals(imports.iterator().next(), "ListPageQueryParameter");
- Assert.assertNotNull(parameter.getSchema());
- Assert.assertEquals(parameter.getSchema().dataType, "Object");
- Assert.assertEquals(parameter.getSchema().baseType, "object");
+ Assertions.assertNotNull(parameter.getSchema());
+ Assertions.assertEquals(parameter.getSchema().dataType, "Object");
+ Assertions.assertEquals(parameter.getSchema().baseType, "object");
}
@Test
@@ -2234,7 +2235,7 @@ public void mapParamImportInnerObject() {
HashSet expected = Sets.newHashSet("InstrumentDefinition", "map");
- Assert.assertEquals(imports, expected);
+ Assertions.assertEquals(imports, expected);
}
@Test
@@ -2247,7 +2248,7 @@ public void modelDoNotContainInheritedVars() {
CodegenModel codegenModel = codegen.fromModel("Dog", openAPI.getComponents().getSchemas().get("Dog"));
- Assert.assertEquals(codegenModel.vars.size(), 1);
+ Assertions.assertEquals(codegenModel.vars.size(), 1);
}
@Test
@@ -2261,8 +2262,8 @@ public void importMapping() {
CodegenModel codegenModel = codegen.fromModel("ParentType", openAPI.getComponents().getSchemas().get("ParentType"));
- Assert.assertEquals(codegenModel.vars.size(), 1);
- Assert.assertEquals(codegenModel.vars.get(0).getBaseType(), "string");
+ Assertions.assertEquals(codegenModel.vars.size(), 1);
+ Assertions.assertEquals(codegenModel.vars.get(0).getBaseType(), "string");
}
@Test
@@ -2276,8 +2277,8 @@ public void schemaMapping() {
CodegenModel codegenModel = codegen.fromModel("ParentType", openAPI.getComponents().getSchemas().get("ParentType"));
- Assert.assertEquals(codegenModel.vars.size(), 1);
- Assert.assertEquals(codegenModel.vars.get(0).getBaseType(), "TypeAlias");
+ Assertions.assertEquals(codegenModel.vars.size(), 1);
+ Assertions.assertEquals(codegenModel.vars.get(0).getBaseType(), "TypeAlias");
}
@Test
@@ -2291,7 +2292,7 @@ public void modelWithPrefixDoNotContainInheritedVars() {
CodegenModel codegenModel = codegen.fromModel("Dog", openAPI.getComponents().getSchemas().get("Dog"));
- Assert.assertEquals(codegenModel.vars.size(), 1);
+ Assertions.assertEquals(codegenModel.vars.size(), 1);
}
@Test
@@ -2305,7 +2306,7 @@ public void modelWithSuffixDoNotContainInheritedVars() {
CodegenModel codegenModel = codegen.fromModel("Dog", openAPI.getComponents().getSchemas().get("Dog"));
- Assert.assertEquals(codegenModel.vars.size(), 1);
+ Assertions.assertEquals(codegenModel.vars.size(), 1);
}
@Test
@@ -2320,9 +2321,9 @@ public void arrayInnerReferencedSchemaMarkedAsModel_20() {
CodegenParameter codegenParameter = codegen.fromRequestBody(body, imports, "");
- Assert.assertTrue(codegenParameter.isContainer);
- Assert.assertTrue(codegenParameter.items.isModel);
- Assert.assertFalse(codegenParameter.items.isContainer);
+ Assertions.assertTrue(codegenParameter.isContainer);
+ Assertions.assertTrue(codegenParameter.items.isModel);
+ Assertions.assertFalse(codegenParameter.items.isContainer);
}
@Test
@@ -2338,9 +2339,9 @@ public void arrayInnerReferencedSchemaMarkedAsModel_30() {
CodegenParameter codegenParameter = codegen.fromRequestBody(body, imports, "");
- Assert.assertTrue(codegenParameter.isContainer);
- Assert.assertTrue(codegenParameter.items.isModel);
- Assert.assertFalse(codegenParameter.items.isContainer);
+ Assertions.assertTrue(codegenParameter.isContainer);
+ Assertions.assertTrue(codegenParameter.items.isModel);
+ Assertions.assertFalse(codegenParameter.items.isContainer);
}
@Test
@@ -2423,11 +2424,11 @@ public void testCircularReferencesDetection() {
codegen.setCircularReferences(models);
// then
- Assert.assertFalse(inboundOut.isCircularReference);
- Assert.assertTrue(roundANext.isCircularReference);
- Assert.assertTrue(roundBNext.isCircularReference);
- Assert.assertTrue(roundCNext.isCircularReference);
- Assert.assertFalse(roundCOut.isCircularReference);
+ Assertions.assertFalse(inboundOut.isCircularReference);
+ Assertions.assertTrue(roundANext.isCircularReference);
+ Assertions.assertTrue(roundBNext.isCircularReference);
+ Assertions.assertTrue(roundCNext.isCircularReference);
+ Assertions.assertFalse(roundCOut.isCircularReference);
}
@Test
@@ -2445,9 +2446,9 @@ public void testUseOneOfInterfaces() {
.getContent()
.get("application/json")
.getSchema());
- Assert.assertEquals(s.getExtensions().get("x-one-of-name"), "CreateStateRequest");
+ Assertions.assertEquals(s.getExtensions().get("x-one-of-name"), "CreateStateRequest");
- Assert.assertEquals(
+ Assertions.assertEquals(
openAPI.getPaths()
.get("/state")
.getGet()
@@ -2459,15 +2460,15 @@ public void testUseOneOfInterfaces() {
"#/components/schemas/getState_200_response"
);
Schema getState200 = openAPI.getComponents().getSchemas().get("getState_200_response");
- //Assert.assertEquals(getState200, "");
- Assert.assertEquals(getState200.getExtensions().get("x-one-of-name"), "GetState200Response");
+ //Assertions.assertEquals(getState200, "");
+ Assertions.assertEquals(getState200.getExtensions().get("x-one-of-name"), "GetState200Response");
// for the array schema, assert that a oneOf interface was added to schema map
Schema items = ((ArraySchema) openAPI.getComponents().getSchemas().get("CustomOneOfArraySchema")).getItems();
- Assert.assertEquals(items.get$ref(), "#/components/schemas/CustomOneOfArraySchema_inner");
- //Assert.assertEquals(items.get$ref(), "#/components/schemas/createState_request");
+ Assertions.assertEquals(items.get$ref(), "#/components/schemas/CustomOneOfArraySchema_inner");
+ //Assertions.assertEquals(items.get$ref(), "#/components/schemas/createState_request");
Schema innerItem = ModelUtils.getReferencedSchema(openAPI, openAPI.getComponents().getSchemas().get("CustomOneOfArraySchema_inner"));
- Assert.assertEquals(innerItem.getExtensions().get("x-one-of-name"), "CustomOneOfArraySchemaInner");
+ Assertions.assertEquals(innerItem.getExtensions().get("x-one-of-name"), "CustomOneOfArraySchemaInner");
}
@Test
@@ -2528,7 +2529,7 @@ public void testFormComposedSchema() {
"post",
path.getPost(),
path.getServers());
- Assert.assertEquals(operation.formParams.size(), 3,
+ Assertions.assertEquals(operation.formParams.size(), 3,
"The list of parameters should include inherited type");
final List names = operation.formParams.stream()
@@ -4325,21 +4326,21 @@ public void testUnalias() {
Schema requestBodySchema = ModelUtils.getSchemaFromRequestBody(
openAPI.getPaths().get("/thingy/{date}").getPost().getRequestBody());
- Assert.assertEquals(requestBodySchema.get$ref(), "#/components/schemas/updatePetWithForm_request");
- Assert.assertEquals(ModelUtils.getSimpleRef(requestBodySchema.get$ref()), "updatePetWithForm_request");
- Assert.assertNotNull(openAPI.getComponents().getSchemas().get(ModelUtils.getSimpleRef(requestBodySchema.get$ref())));
+ Assertions.assertEquals(requestBodySchema.get$ref(), "#/components/schemas/updatePetWithForm_request");
+ Assertions.assertEquals(ModelUtils.getSimpleRef(requestBodySchema.get$ref()), "updatePetWithForm_request");
+ Assertions.assertNotNull(openAPI.getComponents().getSchemas().get(ModelUtils.getSimpleRef(requestBodySchema.get$ref())));
Schema requestBodySchema2 = ModelUtils.unaliasSchema(openAPI, requestBodySchema);
// get$ref is not null as unaliasSchema returns the schema with the last $ref to the actual schema
- Assert.assertNotNull(requestBodySchema2.get$ref());
- Assert.assertEquals(requestBodySchema2.get$ref(), "#/components/schemas/updatePetWithForm_request");
+ Assertions.assertNotNull(requestBodySchema2.get$ref());
+ Assertions.assertEquals(requestBodySchema2.get$ref(), "#/components/schemas/updatePetWithForm_request");
Schema requestBodySchema3 = ModelUtils.getReferencedSchema(openAPI, requestBodySchema);
CodegenParameter codegenParameter = codegen.fromFormProperty("visitDate",
(Schema) requestBodySchema3.getProperties().get("visitDate"), new HashSet<>());
- Assert.assertEquals(codegenParameter.defaultValue, "1971-12-19T03:39:57-08:00");
- Assert.assertEquals(codegenParameter.getSchema(), null);
+ Assertions.assertEquals(codegenParameter.defaultValue, "1971-12-19T03:39:57-08:00");
+ Assertions.assertEquals(codegenParameter.getSchema(), null);
}
@Test
@@ -4415,7 +4416,7 @@ public void testObjectSchemaWithIneffectiveConstraints() {
.collect(Collectors.toList());
// JUnit assertions
- assertEquals("Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()), 9, logsList.size());
+ assertEquals(9, logsList.size(), "Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()));
assertEquals("Validation 'minItems' has no effect on schema 'object'. Ignoring!", logsList.get(0)
.getMessage());
assertEquals("Validation 'maxItems' has no effect on schema 'object'. Ignoring!", logsList.get(1)
@@ -4464,7 +4465,7 @@ public void testStringSchemaWithIneffectiveConstraints() {
.collect(Collectors.toList());
// JUnit assertions
- assertEquals("Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()), 8, logsList.size());
+ assertEquals(8, logsList.size(), "Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()));
assertEquals("Validation 'minItems' has no effect on schema 'string'. Ignoring!", logsList.get(0)
.getMessage());
assertEquals("Validation 'maxItems' has no effect on schema 'string'. Ignoring!", logsList.get(1)
@@ -4511,7 +4512,7 @@ public void testIntegerSchemaWithIneffectiveConstraints() {
.collect(Collectors.toList());
// JUnit assertions
- assertEquals("Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()), 8, logsList.size());
+ assertEquals(8, logsList.size(), "Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()));
assertEquals("Validation 'minItems' has no effect on schema 'integer'. Ignoring!", logsList.get(0)
.getMessage());
assertEquals("Validation 'maxItems' has no effect on schema 'integer'. Ignoring!", logsList.get(1)
@@ -4558,7 +4559,7 @@ public void testAnySchemaWithIneffectiveConstraints() {
.collect(Collectors.toList());
// JUnit assertions
- assertEquals("Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()), 0, logsList.size());
+ assertEquals(0, logsList.size(), "Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()));
}
@Test
@@ -4586,7 +4587,7 @@ public void testBooleanSchemaWithIneffectiveConstraints() {
.collect(Collectors.toList());
// JUnit assertions
- assertEquals("Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()), 11, logsList.size());
+ assertEquals(11, logsList.size(), "Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()));
assertEquals("Validation 'minItems' has no effect on schema 'boolean'. Ignoring!", logsList.get(0)
.getMessage());
assertEquals("Validation 'maxItems' has no effect on schema 'boolean'. Ignoring!", logsList.get(1)
@@ -4639,7 +4640,7 @@ public void testNullSchemaWithIneffectiveConstraints() {
.collect(Collectors.toList());
// JUnit assertions
- assertEquals("Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()), 0, logsList.size());
+ assertEquals(0, logsList.size(), "Messages: " + logsList.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()));
}
public static class FromParameter {
@@ -4679,7 +4680,7 @@ public void testConvertPropertyToBooleanAndWriteBack_Boolean_true() {
Map additionalProperties = codegen.additionalProperties();
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, true);
boolean result = codegen.convertPropertyToBooleanAndWriteBack(CodegenConstants.SERIALIZABLE_MODEL);
- Assert.assertTrue(result);
+ Assertions.assertTrue(result);
}
@Test
@@ -4688,7 +4689,7 @@ public void testConvertPropertyToBooleanAndWriteBack_Boolean_false() {
Map additionalProperties = codegen.additionalProperties();
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, false);
boolean result = codegen.convertPropertyToBooleanAndWriteBack(CodegenConstants.SERIALIZABLE_MODEL);
- Assert.assertFalse(result);
+ Assertions.assertFalse(result);
}
@Test
@@ -4697,7 +4698,7 @@ public void testConvertPropertyToBooleanAndWriteBack_String_true() {
Map additionalProperties = codegen.additionalProperties();
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, "true");
boolean result = codegen.convertPropertyToBooleanAndWriteBack(CodegenConstants.SERIALIZABLE_MODEL);
- Assert.assertTrue(result);
+ Assertions.assertTrue(result);
}
@Test
@@ -4706,7 +4707,7 @@ public void testConvertPropertyToBooleanAndWriteBack_String_false() {
Map additionalProperties = codegen.additionalProperties();
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, "false");
boolean result = codegen.convertPropertyToBooleanAndWriteBack(CodegenConstants.SERIALIZABLE_MODEL);
- Assert.assertFalse(result);
+ Assertions.assertFalse(result);
}
@Test
@@ -4715,7 +4716,7 @@ public void testConvertPropertyToBooleanAndWriteBack_String_blibb() {
Map additionalProperties = codegen.additionalProperties();
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, "blibb");
boolean result = codegen.convertPropertyToBooleanAndWriteBack(CodegenConstants.SERIALIZABLE_MODEL);
- Assert.assertFalse(result);
+ Assertions.assertFalse(result);
}
}
@@ -4740,16 +4741,16 @@ public void testFromPropertyRequiredAndOptional() {
modelName = "FooOptional";
sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel fooOptional = codegen.fromModel(modelName, sc);
- Assert.assertTrue(fooRequired.vars.get(0).required);
- Assert.assertEquals(fooRequired.vars.get(0).name, "foo");
+ Assertions.assertTrue(fooRequired.vars.get(0).required);
+ Assertions.assertEquals(fooRequired.vars.get(0).name, "foo");
- Assert.assertEquals(fooRequired.requiredVars.size(), 1);
- Assert.assertEquals(fooRequired.requiredVars.get(0).name, "foo");
- Assert.assertTrue(fooRequired.requiredVars.get(0).required);
+ Assertions.assertEquals(fooRequired.requiredVars.size(), 1);
+ Assertions.assertEquals(fooRequired.requiredVars.get(0).name, "foo");
+ Assertions.assertTrue(fooRequired.requiredVars.get(0).required);
- Assert.assertFalse(fooOptional.vars.get(0).required);
- Assert.assertEquals(fooOptional.vars.get(0).name, "foo");
- Assert.assertEquals(fooOptional.requiredVars.size(), 0);
+ Assertions.assertFalse(fooOptional.vars.get(0).required);
+ Assertions.assertEquals(fooOptional.vars.get(0).name, "foo");
+ Assertions.assertEquals(fooOptional.requiredVars.size(), 0);
}
@Test
@@ -4771,16 +4772,16 @@ public void testReferencedEnumType() {
CodegenModel modelWithReferencedSchema = codegen.fromModel(modelName, schemaWithReferencedEnum);
CodegenProperty referencedEnumSchemaProperty = modelWithReferencedSchema.vars.get(1);
- Assert.assertNotNull(schemaWithReferencedEnum);
- Assert.assertTrue(modelWithReferencedSchema.hasEnums);
- Assert.assertEquals(referencedEnumSchemaProperty.getName(), "enumType");
- Assert.assertFalse(referencedEnumSchemaProperty.isEnum);
- Assert.assertTrue(referencedEnumSchemaProperty.getIsEnumOrRef());
- Assert.assertTrue(referencedEnumSchemaProperty.isEnumRef);
- Assert.assertFalse(referencedEnumSchemaProperty.isInnerEnum);
- Assert.assertFalse(referencedEnumSchemaProperty.isString);
- Assert.assertFalse(referencedEnumSchemaProperty.isContainer);
- Assert.assertFalse(referencedEnumSchemaProperty.isPrimitiveType);
+ Assertions.assertNotNull(schemaWithReferencedEnum);
+ Assertions.assertTrue(modelWithReferencedSchema.hasEnums);
+ Assertions.assertEquals(referencedEnumSchemaProperty.getName(), "enumType");
+ Assertions.assertFalse(referencedEnumSchemaProperty.isEnum);
+ Assertions.assertTrue(referencedEnumSchemaProperty.getIsEnumOrRef());
+ Assertions.assertTrue(referencedEnumSchemaProperty.isEnumRef);
+ Assertions.assertFalse(referencedEnumSchemaProperty.isInnerEnum);
+ Assertions.assertFalse(referencedEnumSchemaProperty.isString);
+ Assertions.assertFalse(referencedEnumSchemaProperty.isContainer);
+ Assertions.assertFalse(referencedEnumSchemaProperty.isPrimitiveType);
}
@Test
@@ -4795,30 +4796,30 @@ public void testAllOfDefaultEnumType() {
CodegenModel modelWithReferencedSchema = codegen.fromModel(modelName, schemaWithReferencedEnum);
CodegenProperty defaultEnumSchemaProperty = modelWithReferencedSchema.vars.get(4);
- Assert.assertNotNull(schemaWithReferencedEnum);
- Assert.assertTrue(modelWithReferencedSchema.hasEnums);
- Assert.assertEquals(defaultEnumSchemaProperty.getName(), "defaultMinusnumberMinusenum");
- Assert.assertFalse(defaultEnumSchemaProperty.isEnum);
- Assert.assertTrue(defaultEnumSchemaProperty.getIsEnumOrRef());
- Assert.assertTrue(defaultEnumSchemaProperty.isEnumRef);
- Assert.assertFalse(defaultEnumSchemaProperty.isInnerEnum);
- Assert.assertFalse(defaultEnumSchemaProperty.isString);
- Assert.assertFalse(defaultEnumSchemaProperty.isContainer);
- Assert.assertFalse(defaultEnumSchemaProperty.isPrimitiveType);
- Assert.assertEquals(defaultEnumSchemaProperty.defaultValue, "2");
+ Assertions.assertNotNull(schemaWithReferencedEnum);
+ Assertions.assertTrue(modelWithReferencedSchema.hasEnums);
+ Assertions.assertEquals(defaultEnumSchemaProperty.getName(), "defaultMinusnumberMinusenum");
+ Assertions.assertFalse(defaultEnumSchemaProperty.isEnum);
+ Assertions.assertTrue(defaultEnumSchemaProperty.getIsEnumOrRef());
+ Assertions.assertTrue(defaultEnumSchemaProperty.isEnumRef);
+ Assertions.assertFalse(defaultEnumSchemaProperty.isInnerEnum);
+ Assertions.assertFalse(defaultEnumSchemaProperty.isString);
+ Assertions.assertFalse(defaultEnumSchemaProperty.isContainer);
+ Assertions.assertFalse(defaultEnumSchemaProperty.isPrimitiveType);
+ Assertions.assertEquals(defaultEnumSchemaProperty.defaultValue, "2");
// test allOf with a single sub-schema and no default value set in the top level
CodegenProperty allOfEnumSchemaProperty = modelWithReferencedSchema.vars.get(5);
- Assert.assertEquals(allOfEnumSchemaProperty.getName(), "allofMinusnumberMinusenum");
- Assert.assertFalse(allOfEnumSchemaProperty.isEnum);
- Assert.assertTrue(allOfEnumSchemaProperty.getIsEnumOrRef());
- Assert.assertTrue(allOfEnumSchemaProperty.isEnumRef);
- Assert.assertFalse(allOfEnumSchemaProperty.isInnerEnum);
- Assert.assertFalse(allOfEnumSchemaProperty.isString);
- Assert.assertFalse(allOfEnumSchemaProperty.isContainer);
- Assert.assertFalse(allOfEnumSchemaProperty.isPrimitiveType);
- Assert.assertTrue(allOfEnumSchemaProperty.deprecated);
- Assert.assertEquals(allOfEnumSchemaProperty.defaultValue, "null");
+ Assertions.assertEquals(allOfEnumSchemaProperty.getName(), "allofMinusnumberMinusenum");
+ Assertions.assertFalse(allOfEnumSchemaProperty.isEnum);
+ Assertions.assertTrue(allOfEnumSchemaProperty.getIsEnumOrRef());
+ Assertions.assertTrue(allOfEnumSchemaProperty.isEnumRef);
+ Assertions.assertFalse(allOfEnumSchemaProperty.isInnerEnum);
+ Assertions.assertFalse(allOfEnumSchemaProperty.isString);
+ Assertions.assertFalse(allOfEnumSchemaProperty.isContainer);
+ Assertions.assertFalse(allOfEnumSchemaProperty.isPrimitiveType);
+ Assertions.assertTrue(allOfEnumSchemaProperty.deprecated);
+ Assertions.assertEquals(allOfEnumSchemaProperty.defaultValue, "null");
}
@Test
@@ -4832,16 +4833,16 @@ public void testInlineEnumType() {
CodegenModel modelWithReferencedSchema = codegen.fromModel(modelName, schemaWithReferencedEnum);
CodegenProperty inlineEnumSchemaProperty = modelWithReferencedSchema.vars.get(1);
- Assert.assertNotNull(schemaWithReferencedEnum);
- Assert.assertTrue(modelWithReferencedSchema.hasEnums);
- Assert.assertEquals(inlineEnumSchemaProperty.getName(), "enumType");
- Assert.assertTrue(inlineEnumSchemaProperty.isEnum);
- Assert.assertTrue(inlineEnumSchemaProperty.isInnerEnum);
- Assert.assertFalse(inlineEnumSchemaProperty.isEnumRef);
- Assert.assertTrue(inlineEnumSchemaProperty.getIsEnumOrRef());
- Assert.assertTrue(inlineEnumSchemaProperty.isString);
- Assert.assertFalse(inlineEnumSchemaProperty.isContainer);
- Assert.assertFalse(inlineEnumSchemaProperty.isPrimitiveType);
+ Assertions.assertNotNull(schemaWithReferencedEnum);
+ Assertions.assertTrue(modelWithReferencedSchema.hasEnums);
+ Assertions.assertEquals(inlineEnumSchemaProperty.getName(), "enumType");
+ Assertions.assertTrue(inlineEnumSchemaProperty.isEnum);
+ Assertions.assertTrue(inlineEnumSchemaProperty.isInnerEnum);
+ Assertions.assertFalse(inlineEnumSchemaProperty.isEnumRef);
+ Assertions.assertTrue(inlineEnumSchemaProperty.getIsEnumOrRef());
+ Assertions.assertTrue(inlineEnumSchemaProperty.isString);
+ Assertions.assertFalse(inlineEnumSchemaProperty.isContainer);
+ Assertions.assertFalse(inlineEnumSchemaProperty.isPrimitiveType);
}
@Test
@@ -4853,7 +4854,7 @@ public void testAddOption() {
expected.setDefault("defaultValue");
expected.setEnum(Map.of("defaultValue", "defaultDesc"));
- Assert.assertTrue(codegen.cliOptions.contains(expected));
+ Assertions.assertTrue(codegen.cliOptions.contains(expected));
}
@Test
@@ -4863,7 +4864,7 @@ public void testAddOptionDefaultNull() {
CliOption expected = new CliOption("optionKey", "optionDesc");
- Assert.assertTrue(codegen.cliOptions.contains(expected));
+ Assertions.assertTrue(codegen.cliOptions.contains(expected));
}
@Test
@@ -4874,7 +4875,7 @@ public void testAddOptionEnumValuesNull() {
CliOption expected = new CliOption("optionKey", "optionDesc");
expected.setDefault("defaultValue");
- Assert.assertTrue(codegen.cliOptions.contains(expected));
+ Assertions.assertTrue(codegen.cliOptions.contains(expected));
}
@Test
@@ -4897,8 +4898,8 @@ public void testRequestInlineSingleExample() {
@Test
void testIsXML() {
final DefaultCodegen codegen = new DefaultCodegen();
- Assert.assertTrue(codegen.isXmlMimeType("application/xml"));
- Assert.assertTrue(codegen.isXmlMimeType("application/rss+xml"));
+ Assertions.assertTrue(codegen.isXmlMimeType("application/xml"));
+ Assertions.assertTrue(codegen.isXmlMimeType("application/rss+xml"));
}
@Test
@@ -4910,39 +4911,28 @@ public void testWebhooks() throws IOException {
Operation operation = openAPI.getWebhooks().get("newPet").getPost();
CodegenOperation co = codegen.fromOperation("newPet", "get", operation, null);
- Assert.assertEquals(co.path, "/newPet");
- Assert.assertEquals(co.operationId, "newPetGet");
+ Assertions.assertEquals(co.path, "/newPet");
+ Assertions.assertEquals(co.operationId, "newPetGet");
}
@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/DefaultGeneratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java
index d3082a891f067..0a7cd881b14c1 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java
@@ -660,11 +660,12 @@ public void testHandlesTrailingSlashInServers() {
List files = new ArrayList<>();
List filteredSchemas = ModelUtils.getSchemasUsedOnlyInFormParam(openAPI);
List allModels = new ArrayList<>();
- generator.generateModels(files, allModels, filteredSchemas);
+ List aliasModels = new ArrayList<>();
+ generator.generateModels(files, allModels, filteredSchemas, aliasModels);
List allOperations = new ArrayList<>();
generator.generateApis(files, allOperations, allModels);
- Map bundle = generator.buildSupportFileBundle(allOperations, allModels);
+ Map bundle = generator.buildSupportFileBundle(allOperations, allModels, aliasModels);
LinkedList servers = (LinkedList) bundle.get("servers");
Assert.assertEquals(servers.get(0).url, "");
Assert.assertEquals(servers.get(1).url, "http://trailingshlash.io:80/v1");
@@ -686,11 +687,12 @@ public void testHandlesRelativeUrlsInServers() {
List files = new ArrayList<>();
List filteredSchemas = ModelUtils.getSchemasUsedOnlyInFormParam(openAPI);
List allModels = new ArrayList<>();
- generator.generateModels(files, allModels, filteredSchemas);
+ List aliasModels = new ArrayList<>();
+ generator.generateModels(files, allModels, filteredSchemas, aliasModels);
List allOperations = new ArrayList<>();
generator.generateApis(files, allOperations, allModels);
- Map bundle = generator.buildSupportFileBundle(allOperations, allModels);
+ Map bundle = generator.buildSupportFileBundle(allOperations, allModels, aliasModels);
LinkedList servers = (LinkedList) bundle.get("servers");
Assert.assertEquals(servers.get(0).url, "/relative/url");
}
@@ -768,8 +770,9 @@ public void testRecursionBug4650() {
List files = new ArrayList<>();
List filteredSchemas = ModelUtils.getSchemasUsedOnlyInFormParam(openAPI);
List allModels = new ArrayList<>();
+ List aliasModels = new ArrayList<>();
// The bug causes a StackOverflowError when calling generateModels
- generator.generateModels(files, allModels, filteredSchemas);
+ generator.generateModels(files, allModels, filteredSchemas, aliasModels);
// all fine, we have passed
}
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java
index 9fe394f32949e..8ee09093d5afc 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java
@@ -16,9 +16,8 @@
package org.openapitools.codegen.csharpnetcore;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.openapitools.codegen.TestUtils.assertFileContains;
-import static org.openapitools.codegen.TestUtils.assertFileExists;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.Schema;
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientDeepObjectTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientDeepObjectTest.java
index bfacb03a4729e..06ad440844f4a 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientDeepObjectTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientDeepObjectTest.java
@@ -32,7 +32,7 @@
import java.nio.file.Files;
import java.nio.file.Paths;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.openapitools.codegen.TestUtils.assertFileContains;
public class CSharpClientDeepObjectTest {
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java
index 5edeb7c97c534..dbca31cda544c 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/AbstractJavaCodegenTest.java
@@ -930,6 +930,10 @@ public void ignoreBeanValidationAnnotationsTest() {
schema = new Schema<>().type("string").format("binary").pattern("^[a-z]$").maxLength(36);
defaultValue = codegen.getTypeDeclaration(schema);
Assert.assertEquals(defaultValue, "File");
+
+ schema = new Schema<>().type("string")._enum(List.of("A","B")).pattern("^[a-z]$").maxLength(36);
+ defaultValue = codegen.getTypeDeclaration(schema);
+ Assert.assertEquals(defaultValue, "String");
}
@Test
@@ -952,6 +956,10 @@ public void ignoreBeanValidationAnnotationsContainerTest() {
schema = new ArraySchema().items(new Schema<>().type("string").format("binary").pattern("^[a-z]$").maxLength(36));
defaultValue = codegen.getTypeDeclaration(schema);
Assert.assertEquals(defaultValue, "List");
+
+ schema = new ArraySchema().items(new Schema<>().type("string")._enum(List.of("A","B")).pattern("^[a-z]$").maxLength(36));
+ defaultValue = codegen.getTypeDeclaration(schema);
+ Assert.assertEquals(defaultValue, "List");
}
@Test
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 5d10b33e2c6d9..dcb6aa56ea180 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
@@ -17,7 +17,7 @@
package org.openapitools.codegen.java;
-import static org.junit.Assert.assertNotNull;
+import org.junit.jupiter.api.Assertions;
import static org.openapitools.codegen.TestUtils.assertFileContains;
import static org.openapitools.codegen.TestUtils.assertFileNotContains;
import static org.openapitools.codegen.TestUtils.validateJavaSourceFiles;
@@ -109,9 +109,9 @@ public void arraysInRequestBody() {
"application/json",
new MediaType().schema(new ArraySchema().items(new StringSchema()))));
CodegenParameter codegenParameter1 = codegen.fromRequestBody(body1, new HashSet(), null);
- Assert.assertEquals(codegenParameter1.description, "A list of ids");
- Assert.assertEquals(codegenParameter1.dataType, "List");
- Assert.assertEquals(codegenParameter1.baseType, "String");
+ Assertions.assertEquals(codegenParameter1.description, "A list of ids");
+ Assertions.assertEquals(codegenParameter1.dataType, "List");
+ Assertions.assertEquals(codegenParameter1.baseType, "String");
RequestBody body2 = new RequestBody();
body2.setDescription("A list of list of values");
@@ -123,9 +123,9 @@ public void arraysInRequestBody() {
.schema(
new ArraySchema().items(new ArraySchema().items(new IntegerSchema())))));
CodegenParameter codegenParameter2 = codegen.fromRequestBody(body2, new HashSet(), null);
- Assert.assertEquals(codegenParameter2.description, "A list of list of values");
- Assert.assertEquals(codegenParameter2.dataType, "List>");
- Assert.assertEquals(codegenParameter2.baseType, "List");
+ Assertions.assertEquals(codegenParameter2.description, "A list of list of values");
+ Assertions.assertEquals(codegenParameter2.dataType, "List>");
+ Assertions.assertEquals(codegenParameter2.baseType, "List");
RequestBody body3 = new RequestBody();
body3.setDescription("A list of points");
@@ -142,9 +142,9 @@ public void arraysInRequestBody() {
point.addProperty("x", new IntegerSchema().format(SchemaTypeUtil.INTEGER32_FORMAT));
point.addProperty("y", new IntegerSchema().format(SchemaTypeUtil.INTEGER32_FORMAT));
CodegenParameter codegenParameter3 = codegen.fromRequestBody(body3, new HashSet(), null);
- Assert.assertEquals(codegenParameter3.description, "A list of points");
- Assert.assertEquals(codegenParameter3.dataType, "List");
- Assert.assertEquals(codegenParameter3.baseType, "Point");
+ Assertions.assertEquals(codegenParameter3.description, "A list of points");
+ Assertions.assertEquals(codegenParameter3.dataType, "List");
+ Assertions.assertEquals(codegenParameter3.baseType, "Point");
}
@Test
@@ -153,7 +153,7 @@ public void nullValuesInComposedSchema() {
ComposedSchema schema = new ComposedSchema();
CodegenModel result = codegen.fromModel("CompSche",
schema);
- Assert.assertEquals(result.name, "CompSche");
+ Assertions.assertEquals(result.name, "CompSche");
}
@Test
@@ -177,7 +177,7 @@ public void testParametersAreCorrectlyOrderedWhenUsingRetrofit() {
javaClientCodegen.postProcessOperationsWithModels(objs, Collections.emptyList());
- Assert.assertEquals(Arrays.asList(pathParam1, pathParam2, queryParamRequired, queryParamOptional), codegenOperation.allParams);
+ Assertions.assertEquals(Arrays.asList(pathParam1, pathParam2, queryParamRequired, queryParamOptional), codegenOperation.allParams);
}
@Test
@@ -185,22 +185,22 @@ public void testInitialConfigValues() throws Exception {
final JavaClientCodegen codegen = new JavaClientCodegen();
codegen.processOpts();
- Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
- Assert.assertFalse(codegen.isHideGenerationTimestamp());
+ Assertions.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
+ Assertions.assertFalse(codegen.isHideGenerationTimestamp());
- Assert.assertEquals(codegen.modelPackage(), "org.openapitools.client.model");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.modelPackage(), "org.openapitools.client.model");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE),
"org.openapitools.client.model");
- Assert.assertEquals(codegen.apiPackage(), "org.openapitools.client.api");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.apiPackage(), "org.openapitools.client.api");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.API_PACKAGE),
"org.openapitools.client.api");
- Assert.assertEquals(codegen.getInvokerPackage(), "org.openapitools.client");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.getInvokerPackage(), "org.openapitools.client");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE),
"org.openapitools.client");
- Assert.assertEquals(codegen.getSerializationLibrary(), JavaClientCodegen.SERIALIZATION_LIBRARY_GSON);
+ Assertions.assertEquals(codegen.getSerializationLibrary(), JavaClientCodegen.SERIALIZATION_LIBRARY_GSON);
}
@Test
@@ -213,20 +213,20 @@ public void testSettersForConfigValues() throws Exception {
codegen.setSerializationLibrary("JACKSON");
codegen.processOpts();
- Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
- Assert.assertTrue(codegen.isHideGenerationTimestamp());
- Assert.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.model");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
+ Assertions.assertTrue(codegen.isHideGenerationTimestamp());
+ Assertions.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.model");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE),
"xyz.yyyyy.zzzzzzz.model");
- Assert.assertEquals(codegen.apiPackage(), "xyz.yyyyy.zzzzzzz.api");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.apiPackage(), "xyz.yyyyy.zzzzzzz.api");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.API_PACKAGE), "xyz.yyyyy.zzzzzzz.api");
- Assert.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.invoker");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.invoker");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE),
"xyz.yyyyy.zzzzzzz.invoker");
- Assert.assertEquals(codegen.getSerializationLibrary(), JavaClientCodegen.SERIALIZATION_LIBRARY_GSON); // the library JavaClientCodegen.OKHTTP_GSON only supports GSON
+ Assertions.assertEquals(codegen.getSerializationLibrary(), JavaClientCodegen.SERIALIZATION_LIBRARY_GSON); // the library JavaClientCodegen.OKHTTP_GSON only supports GSON
}
@Test
@@ -244,21 +244,21 @@ public void testAdditionalPropertiesPutForConfigValues() throws Exception {
codegen.additionalProperties().put(CodegenConstants.LIBRARY, JavaClientCodegen.JERSEY2);
codegen.processOpts();
- Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
- Assert.assertTrue(codegen.isHideGenerationTimestamp());
- Assert.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.mmmmm.model");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
+ Assertions.assertTrue(codegen.isHideGenerationTimestamp());
+ Assertions.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.mmmmm.model");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE),
"xyz.yyyyy.zzzzzzz.mmmmm.model");
- Assert.assertEquals(codegen.apiPackage(), "xyz.yyyyy.zzzzzzz.aaaaa.api");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.apiPackage(), "xyz.yyyyy.zzzzzzz.aaaaa.api");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.API_PACKAGE),
"xyz.yyyyy.zzzzzzz.aaaaa.api");
- Assert.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.iiii.invoker");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.iiii.invoker");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE),
"xyz.yyyyy.zzzzzzz.iiii.invoker");
- Assert.assertEquals(codegen.getSerializationLibrary(), JavaClientCodegen.SERIALIZATION_LIBRARY_JACKSON);
+ Assertions.assertEquals(codegen.getSerializationLibrary(), JavaClientCodegen.SERIALIZATION_LIBRARY_JACKSON);
}
@Test
@@ -321,7 +321,7 @@ public void testSupportedSecuritySchemesJersey() throws Exception {
codegen.additionalProperties().put(CodegenConstants.LIBRARY, JavaClientCodegen.JERSEY3);
codegen.processOpts();
- Assert.assertTrue(codegen.getFeatureSet().getSecurityFeatures().contains(SecurityFeature.SignatureAuth));
+ Assertions.assertTrue(codegen.getFeatureSet().getSecurityFeatures().contains(SecurityFeature.SignatureAuth));
}
@Test
@@ -333,16 +333,16 @@ public void testPackageNamesSetInvokerDerivedFromApi() {
codegen.additionalProperties().put(CodegenConstants.API_PACKAGE, "xyz.yyyyy.zzzzzzz.aaaaa.api");
codegen.processOpts();
- Assert.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.mmmmm.model");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.mmmmm.model");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE),
"xyz.yyyyy.zzzzzzz.mmmmm.model");
- Assert.assertEquals(codegen.apiPackage(), "xyz.yyyyy.zzzzzzz.aaaaa.api");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.apiPackage(), "xyz.yyyyy.zzzzzzz.aaaaa.api");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.API_PACKAGE),
"xyz.yyyyy.zzzzzzz.aaaaa.api");
- Assert.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.aaaaa");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.aaaaa");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE),
"xyz.yyyyy.zzzzzzz.aaaaa");
}
@@ -355,16 +355,16 @@ public void testPackageNamesSetInvokerDerivedFromModel() {
.put(CodegenConstants.MODEL_PACKAGE, "xyz.yyyyy.zzzzzzz.mmmmm.model");
codegen.processOpts();
- Assert.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.mmmmm.model");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.mmmmm.model");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE),
"xyz.yyyyy.zzzzzzz.mmmmm.model");
- Assert.assertEquals(codegen.apiPackage(), "org.openapitools.client.api");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.apiPackage(), "org.openapitools.client.api");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.API_PACKAGE),
"org.openapitools.client.api");
- Assert.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.mmmmm");
- Assert.assertEquals(
+ Assertions.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.mmmmm");
+ Assertions.assertEquals(
codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE),
"xyz.yyyyy.zzzzzzz.mmmmm");
}
@@ -377,8 +377,8 @@ public void testGetSchemaTypeWithComposedSchemaWithAllOf() {
Operation operation = openAPI.getPaths().get("/ping").getPost();
CodegenOperation co = codegen.fromOperation("/ping", "POST", operation, null);
- Assert.assertEquals(co.allParams.size(), 1);
- Assert.assertEquals(co.allParams.get(0).baseType, "MessageEventCoreWithTimeListEntries");
+ Assertions.assertEquals(co.allParams.size(), 1);
+ Assertions.assertEquals(co.allParams.get(0).baseType, "MessageEventCoreWithTimeListEntries");
}
@Test
@@ -390,11 +390,11 @@ public void updateCodegenPropertyEnum() {
List> enumVars =
(List>) array.getItems().getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars);
Map testedEnumVar = enumVars.get(0);
- Assert.assertNotNull(testedEnumVar);
- Assert.assertEquals(testedEnumVar.getOrDefault("name", ""), "NUMBER_1");
- Assert.assertEquals(testedEnumVar.getOrDefault("value", ""), "1");
+ Assertions.assertNotNull(testedEnumVar);
+ Assertions.assertEquals(testedEnumVar.getOrDefault("name", ""), "NUMBER_1");
+ Assertions.assertEquals(testedEnumVar.getOrDefault("value", ""), "1");
}
@Test
@@ -410,11 +410,11 @@ public void updateCodegenPropertyEnumWithCustomNames() {
List> enumVars =
(List>) array.getItems().getAllowableValues().get("enumVars");
- Assert.assertNotNull(enumVars);
+ Assertions.assertNotNull(enumVars);
Map testedEnumVar = enumVars.get(0);
- Assert.assertNotNull(testedEnumVar);
- Assert.assertEquals(testedEnumVar.getOrDefault("name", ""), "ONE");
- Assert.assertEquals(testedEnumVar.getOrDefault("value", ""), "1");
+ Assertions.assertNotNull(testedEnumVar);
+ Assertions.assertEquals(testedEnumVar.getOrDefault("name", ""), "ONE");
+ Assertions.assertEquals(testedEnumVar.getOrDefault("value", ""), "1");
}
@Test
@@ -435,7 +435,7 @@ public void testGeneratePing() throws Exception {
DefaultGenerator generator = new DefaultGenerator();
List files = generator.opts(clientOptInput).generate();
- Assert.assertEquals(files.size(), 40);
+ Assertions.assertEquals(files.size(), 40);
TestUtils.ensureContainsFile(files, output, ".gitignore");
TestUtils.ensureContainsFile(files, output, ".openapi-generator-ignore");
TestUtils.ensureContainsFile(files, output, ".openapi-generator/FILES");
@@ -511,7 +511,7 @@ public void testGeneratePingSomeObj() throws Exception {
DefaultGenerator generator = new DefaultGenerator();
List files = generator.opts(clientOptInput).generate();
- Assert.assertEquals(files.size(), 43);
+ Assertions.assertEquals(files.size(), 43);
TestUtils.ensureContainsFile(files, output, ".gitignore");
TestUtils.ensureContainsFile(files, output, ".openapi-generator-ignore");
TestUtils.ensureContainsFile(files, output, ".openapi-generator/FILES");
@@ -599,7 +599,7 @@ public void testJdkHttpClient() throws Exception {
DefaultGenerator generator = new DefaultGenerator();
List files = generator.opts(clientOptInput).generate();
- Assert.assertEquals(files.size(), 32);
+ Assertions.assertEquals(files.size(), 32);
validateJavaSourceFiles(files);
TestUtils.assertFileContains(
@@ -668,7 +668,7 @@ public void testJdkHttpClientWithAndWithoutDiscriminator() throws Exception {
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
List files = generator.opts(clientOptInput).generate();
- Assert.assertEquals(files.size(), 153);
+ Assertions.assertEquals(files.size(), 153);
validateJavaSourceFiles(files);
TestUtils.assertFileContains(Paths.get(output + "/src/main/java/xyz/abcdef/model/Dog.java"),
@@ -695,7 +695,7 @@ public void testJdkHttpAsyncClient() throws Exception {
DefaultGenerator generator = new DefaultGenerator();
List files = generator.opts(clientOptInput).generate();
- Assert.assertEquals(files.size(), 35);
+ Assertions.assertEquals(files.size(), 35);
validateJavaSourceFiles(files);
Path defaultApi = Paths.get(output + "/src/main/java/xyz/abcdef/api/PingApi.java");
@@ -722,10 +722,10 @@ public void testReferencedHeader() {
ApiResponse ok_200 = openAPI.getComponents().getResponses().get("OK_200");
CodegenResponse response = codegen.fromResponse("200", ok_200);
- Assert.assertEquals(response.headers.size(), 1);
+ Assertions.assertEquals(response.headers.size(), 1);
CodegenProperty header = response.headers.get(0);
- Assert.assertEquals(header.dataType, "UUID");
- Assert.assertEquals(header.baseName, "Request");
+ Assertions.assertEquals(header.dataType, "UUID");
+ Assertions.assertEquals(header.baseName, "Request");
}
@Test
@@ -791,7 +791,7 @@ public void testAuthorizationScopeValues_Issue6733() throws IOException {
validateJavaSourceFiles(files);
- Assert.assertEquals(files.size(), 1);
+ Assertions.assertEquals(files.size(), 1);
files.forEach(File::deleteOnExit);
}
@@ -820,7 +820,7 @@ public void testTypedAndNonTypedComposedSchemaGeneration_3_1() throws IOExceptio
validateJavaSourceFiles(files);
- Assert.assertEquals(files.size(), 9);
+ Assertions.assertEquals(files.size(), 9);
files.forEach(File::deleteOnExit);
}
@@ -899,29 +899,29 @@ public void testFreeFormObjects() {
Schema test1 = openAPI.getComponents().getSchemas().get("MapTest1");
codegen.setOpenAPI(openAPI);
CodegenModel cm1 = codegen.fromModel("MapTest1", test1);
- Assert.assertEquals(cm1.getDataType(), "Map");
- Assert.assertEquals(cm1.getParent(), "HashMap");
- Assert.assertEquals(cm1.getClassname(), "MapTest1");
+ Assertions.assertEquals(cm1.getDataType(), "Map");
+ Assertions.assertEquals(cm1.getParent(), "HashMap");
+ Assertions.assertEquals(cm1.getClassname(), "MapTest1");
Schema test2 = openAPI.getComponents().getSchemas().get("MapTest2");
codegen.setOpenAPI(openAPI);
CodegenModel cm2 = codegen.fromModel("MapTest2", test2);
- Assert.assertEquals(cm2.getDataType(), "Map");
- Assert.assertEquals(cm2.getParent(), "HashMap");
- Assert.assertEquals(cm2.getClassname(), "MapTest2");
+ Assertions.assertEquals(cm2.getDataType(), "Map");
+ Assertions.assertEquals(cm2.getParent(), "HashMap");
+ Assertions.assertEquals(cm2.getClassname(), "MapTest2");
Schema test3 = openAPI.getComponents().getSchemas().get("MapTest3");
codegen.setOpenAPI(openAPI);
CodegenModel cm3 = codegen.fromModel("MapTest3", test3);
- Assert.assertEquals(cm3.getDataType(), "Map");
- Assert.assertEquals(cm3.getParent(), "HashMap");
- Assert.assertEquals(cm3.getClassname(), "MapTest3");
+ Assertions.assertEquals(cm3.getDataType(), "Map");
+ Assertions.assertEquals(cm3.getParent(), "HashMap");
+ Assertions.assertEquals(cm3.getClassname(), "MapTest3");
Schema other = openAPI.getComponents().getSchemas().get("OtherObj");
codegen.setOpenAPI(openAPI);
CodegenModel cm = codegen.fromModel("OtherObj", other);
- Assert.assertEquals(cm.getDataType(), "Object");
- Assert.assertEquals(cm.getClassname(), "OtherObj");
+ Assertions.assertEquals(cm.getDataType(), "Object");
+ Assertions.assertEquals(cm.getClassname(), "OtherObj");
}
/**
@@ -949,7 +949,7 @@ public void testSchemaMapping() throws IOException {
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
final ClientOptInput clientOptInput = configurator.toClientOptInput();
- Assert.assertEquals(
+ Assertions.assertEquals(
clientOptInput.getConfig().schemaMapping().get("TypeAlias"), "foo.bar.TypeAlias");
DefaultGenerator generator = new DefaultGenerator();
@@ -964,7 +964,7 @@ public void testSchemaMapping() throws IOException {
validateJavaSourceFiles(files);
- Assert.assertEquals(files.size(), 1);
+ Assertions.assertEquals(files.size(), 1);
TestUtils.ensureContainsFile(
files, output, "src/main/java/org/openapitools/client/model/ParentType.java");
@@ -979,11 +979,11 @@ public void testSchemaMapping() throws IOException {
final Pattern FIELD_PATTERN = Pattern.compile(".* private (.*?) typeAlias;.*", Pattern.DOTALL);
Matcher fieldMatcher = FIELD_PATTERN.matcher(parentTypeContents);
- Assert.assertTrue(fieldMatcher.matches());
+ Assertions.assertTrue(fieldMatcher.matches());
// this is the type of the field 'typeAlias'. With a working schemaMapping it should
// be 'foo.bar.TypeAlias' or just 'TypeAlias'
- Assert.assertEquals(fieldMatcher.group(1), "foo.bar.TypeAlias");
+ Assertions.assertEquals(fieldMatcher.group(1), "foo.bar.TypeAlias");
}
@Test
@@ -993,10 +993,43 @@ public void testBearerAuth() {
JavaClientCodegen codegen = new JavaClientCodegen();
List security = codegen.fromSecurity(openAPI.getComponents().getSecuritySchemes());
- Assert.assertEquals(security.size(), 1);
- Assert.assertEquals(security.get(0).isBasic, Boolean.TRUE);
- Assert.assertEquals(security.get(0).isBasicBasic, Boolean.FALSE);
- Assert.assertEquals(security.get(0).isBasicBearer, Boolean.TRUE);
+ Assertions.assertEquals(security.size(), 1);
+ Assertions.assertEquals(security.get(0).isBasic, Boolean.TRUE);
+ Assertions.assertEquals(security.get(0).isBasicBasic, Boolean.FALSE);
+ Assertions.assertEquals(security.get(0).isBasicBearer, Boolean.TRUE);
+ }
+
+ @Test
+ public void testVertXAuthInfoWithHyphenSeparatedSecurityScheme() throws Exception {
+ Map properties = new HashMap<>();
+ properties.put(CodegenConstants.API_PACKAGE, "xyz.abcdef.api");
+
+ File output = Files.createTempDirectory("test").toFile();
+ output.deleteOnExit();
+
+ final CodegenConfigurator configurator = new CodegenConfigurator()
+ .setGeneratorName("java")
+ .setLibrary(JavaClientCodegen.VERTX)
+ .setAdditionalProperties(properties)
+ .setInputSpec("src/test/resources/3_0/ping-with-hyphen-separated-security-scheme.yaml")
+ .setOutputDir(output.getAbsolutePath().replace("\\", "/"));
+
+ final ClientOptInput clientOptInput = configurator.toClientOptInput();
+ DefaultGenerator generator = new DefaultGenerator();
+ List files = generator.opts(clientOptInput).generate();
+
+ // Test that hyphen-separated security scheme names does not
+ // break the Java VertX client code generation
+ validateJavaSourceFiles(files);
+
+ // Test that the name was correctly transformed to camelCase
+ // starting with an uppercase letter
+ TestUtils.assertFileContains(
+ Paths.get(output + "/src/main/java/xyz/abcdef/ApiClient.java"),
+ "public static class AuthInfo {",
+ "public void addHyphenatedNameTestAuthentication(String bearerToken) {",
+ "public static AuthInfo forHyphenatedNameTestAuthentication(String bearerToken) {"
+ );
}
private CodegenProperty codegenPropertyWithArrayOfIntegerValues() {
@@ -1049,135 +1082,135 @@ public void testAnyType() {
Schema test1 = openAPI.getComponents().getSchemas().get("AnyValueModel");
codegen.setOpenAPI(openAPI);
CodegenModel cm1 = codegen.fromModel("AnyValueModel", test1);
- Assert.assertEquals(cm1.getClassname(), "AnyValueModel");
+ Assertions.assertEquals(cm1.getClassname(), "AnyValueModel");
final CodegenProperty property1 = cm1.allVars.get(0);
- Assert.assertEquals(property1.baseName, "any_value");
- Assert.assertEquals(property1.dataType, "Object");
- Assert.assertTrue(property1.isPrimitiveType);
- Assert.assertFalse(property1.isContainer);
- Assert.assertFalse(property1.isFreeFormObject);
- Assert.assertTrue(property1.isAnyType);
+ Assertions.assertEquals(property1.baseName, "any_value");
+ Assertions.assertEquals(property1.dataType, "Object");
+ Assertions.assertTrue(property1.isPrimitiveType);
+ Assertions.assertFalse(property1.isContainer);
+ Assertions.assertFalse(property1.isFreeFormObject);
+ Assertions.assertTrue(property1.isAnyType);
final CodegenProperty property2 = cm1.allVars.get(1);
- Assert.assertEquals(property2.baseName, "any_value_with_desc");
- Assert.assertEquals(property2.dataType, "Object");
- Assert.assertFalse(property2.required);
- Assert.assertTrue(property2.isPrimitiveType);
- Assert.assertFalse(property2.isContainer);
- Assert.assertFalse(property2.isFreeFormObject);
- Assert.assertTrue(property2.isAnyType);
+ Assertions.assertEquals(property2.baseName, "any_value_with_desc");
+ Assertions.assertEquals(property2.dataType, "Object");
+ Assertions.assertFalse(property2.required);
+ Assertions.assertTrue(property2.isPrimitiveType);
+ Assertions.assertFalse(property2.isContainer);
+ Assertions.assertFalse(property2.isFreeFormObject);
+ Assertions.assertTrue(property2.isAnyType);
final CodegenProperty property3 = cm1.allVars.get(2);
- Assert.assertEquals(property3.baseName, "any_value_nullable");
- Assert.assertEquals(property3.dataType, "Object");
- Assert.assertFalse(property3.required);
- Assert.assertTrue(property3.isPrimitiveType);
- Assert.assertFalse(property3.isContainer);
- Assert.assertFalse(property3.isFreeFormObject);
- Assert.assertTrue(property3.isAnyType);
+ Assertions.assertEquals(property3.baseName, "any_value_nullable");
+ Assertions.assertEquals(property3.dataType, "Object");
+ Assertions.assertFalse(property3.required);
+ Assertions.assertTrue(property3.isPrimitiveType);
+ Assertions.assertFalse(property3.isContainer);
+ Assertions.assertFalse(property3.isFreeFormObject);
+ Assertions.assertTrue(property3.isAnyType);
Schema test2 = openAPI.getComponents().getSchemas().get("AnyValueModelInline");
codegen.setOpenAPI(openAPI);
CodegenModel cm2 = codegen.fromModel("AnyValueModelInline", test2);
- Assert.assertEquals(cm2.getClassname(), "AnyValueModelInline");
+ Assertions.assertEquals(cm2.getClassname(), "AnyValueModelInline");
final CodegenProperty cp1 = cm2.vars.get(0);
- Assert.assertEquals(cp1.baseName, "any_value");
- Assert.assertEquals(cp1.dataType, "Object");
- Assert.assertFalse(cp1.required);
- Assert.assertTrue(cp1.isPrimitiveType);
- Assert.assertFalse(cp1.isContainer);
- Assert.assertFalse(cp1.isFreeFormObject);
- Assert.assertTrue(cp1.isAnyType);
+ Assertions.assertEquals(cp1.baseName, "any_value");
+ Assertions.assertEquals(cp1.dataType, "Object");
+ Assertions.assertFalse(cp1.required);
+ Assertions.assertTrue(cp1.isPrimitiveType);
+ Assertions.assertFalse(cp1.isContainer);
+ Assertions.assertFalse(cp1.isFreeFormObject);
+ Assertions.assertTrue(cp1.isAnyType);
final CodegenProperty cp2 = cm2.vars.get(1);
- Assert.assertEquals(cp2.baseName, "any_value_with_desc");
- Assert.assertEquals(cp2.dataType, "Object");
- Assert.assertFalse(cp2.required);
- Assert.assertTrue(cp2.isPrimitiveType);
- Assert.assertFalse(cp2.isContainer);
- Assert.assertFalse(cp2.isFreeFormObject);
- Assert.assertTrue(cp2.isAnyType);
+ Assertions.assertEquals(cp2.baseName, "any_value_with_desc");
+ Assertions.assertEquals(cp2.dataType, "Object");
+ Assertions.assertFalse(cp2.required);
+ Assertions.assertTrue(cp2.isPrimitiveType);
+ Assertions.assertFalse(cp2.isContainer);
+ Assertions.assertFalse(cp2.isFreeFormObject);
+ Assertions.assertTrue(cp2.isAnyType);
final CodegenProperty cp3 = cm2.vars.get(2);
- Assert.assertEquals(cp3.baseName, "any_value_nullable");
- Assert.assertEquals(cp3.dataType, "Object");
- Assert.assertFalse(cp3.required);
- Assert.assertTrue(cp3.isPrimitiveType);
- Assert.assertFalse(cp3.isContainer);
- Assert.assertFalse(cp3.isFreeFormObject);
- Assert.assertTrue(cp3.isAnyType);
+ Assertions.assertEquals(cp3.baseName, "any_value_nullable");
+ Assertions.assertEquals(cp3.dataType, "Object");
+ Assertions.assertFalse(cp3.required);
+ Assertions.assertTrue(cp3.isPrimitiveType);
+ Assertions.assertFalse(cp3.isContainer);
+ Assertions.assertFalse(cp3.isFreeFormObject);
+ Assertions.assertTrue(cp3.isAnyType);
// map
// Should allow in any type including map, https://github.com/swagger-api/swagger-parser/issues/1603
final CodegenProperty cp4 = cm2.vars.get(3);
- Assert.assertEquals(cp4.baseName, "map_free_form_object");
- Assert.assertEquals(cp4.dataType, "Map");
- Assert.assertFalse(cp4.required);
- Assert.assertTrue(cp4.isPrimitiveType);
- Assert.assertTrue(cp4.isContainer);
- Assert.assertTrue(cp4.isMap);
- Assert.assertTrue(cp4.isFreeFormObject);
- Assert.assertFalse(cp4.isAnyType);
- Assert.assertFalse(cp4.isModel);
+ Assertions.assertEquals(cp4.baseName, "map_free_form_object");
+ Assertions.assertEquals(cp4.dataType, "Map");
+ Assertions.assertFalse(cp4.required);
+ Assertions.assertTrue(cp4.isPrimitiveType);
+ Assertions.assertTrue(cp4.isContainer);
+ Assertions.assertTrue(cp4.isMap);
+ Assertions.assertTrue(cp4.isFreeFormObject);
+ Assertions.assertFalse(cp4.isAnyType);
+ Assertions.assertFalse(cp4.isModel);
// Should allow in any type including map, https://github.com/swagger-api/swagger-parser/issues/1603
final CodegenProperty cp5 = cm2.vars.get(4);
- Assert.assertEquals(cp5.baseName, "map_any_value_with_desc");
- Assert.assertEquals(cp5.dataType, "Map");
- Assert.assertFalse(cp5.required);
- Assert.assertTrue(cp5.isPrimitiveType);
- Assert.assertTrue(cp5.isContainer);
- Assert.assertTrue(cp5.isMap);
- Assert.assertTrue(cp5.isFreeFormObject);
- Assert.assertFalse(cp5.isAnyType);
- Assert.assertFalse(cp5.isModel);
+ Assertions.assertEquals(cp5.baseName, "map_any_value_with_desc");
+ Assertions.assertEquals(cp5.dataType, "Map");
+ Assertions.assertFalse(cp5.required);
+ Assertions.assertTrue(cp5.isPrimitiveType);
+ Assertions.assertTrue(cp5.isContainer);
+ Assertions.assertTrue(cp5.isMap);
+ Assertions.assertTrue(cp5.isFreeFormObject);
+ Assertions.assertFalse(cp5.isAnyType);
+ Assertions.assertFalse(cp5.isModel);
// Should allow in any type including map, https://github.com/swagger-api/swagger-parser/issues/1603
final CodegenProperty cp6 = cm2.vars.get(5);
- Assert.assertEquals(cp6.baseName, "map_any_value_nullable");
- Assert.assertEquals(cp6.dataType, "Map");
- Assert.assertFalse(cp6.required);
- Assert.assertTrue(cp6.isPrimitiveType);
- Assert.assertTrue(cp6.isContainer);
- Assert.assertTrue(cp6.isMap);
- Assert.assertTrue(cp6.isFreeFormObject);
- Assert.assertFalse(cp6.isAnyType);
+ Assertions.assertEquals(cp6.baseName, "map_any_value_nullable");
+ Assertions.assertEquals(cp6.dataType, "Map");
+ Assertions.assertFalse(cp6.required);
+ Assertions.assertTrue(cp6.isPrimitiveType);
+ Assertions.assertTrue(cp6.isContainer);
+ Assertions.assertTrue(cp6.isMap);
+ Assertions.assertTrue(cp6.isFreeFormObject);
+ Assertions.assertFalse(cp6.isAnyType);
// array
// Should allow in any type including array, https://github.com/swagger-api/swagger-parser/issues/1603
final CodegenProperty cp7 = cm2.vars.get(6);
- Assert.assertEquals(cp7.baseName, "array_any_value");
- Assert.assertEquals(cp7.dataType, "List
@@ -1183,8 +1186,8 @@
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api${junit.version}test
@@ -1214,7 +1217,7 @@
1111
- 0.23.1
+ 1.3.03.1.01.5.02.11.0
@@ -1227,11 +1230,11 @@
32.1.3-jre4.3.12.15.2
- 2.15.3
- 2.15.3
+ 2.16.2
+ 2.16.20.8.101.15
- 4.13.2
+ 5.10.21.6.211.6.211.18.30
@@ -1242,18 +1245,19 @@
3.0.02.5.34.0.0-M8
- 3.0.0
+ 3.2.54.10.08.8.33.12.00.10.2
+ 1.9.181.44.6.11.7.363.1.12.2io.swagger.parser.v3
- 2.1.19
- 7.5
+ 2.1.22
+ 7.10.21.343.4.31.12
diff --git a/samples/client/echo_api/java/apache-httpclient/pom.xml b/samples/client/echo_api/java/apache-httpclient/pom.xml
index 47a3274035b6c..f5c5b09208dd6 100644
--- a/samples/client/echo_api/java/apache-httpclient/pom.xml
+++ b/samples/client/echo_api/java/apache-httpclient/pom.xml
@@ -73,7 +73,7 @@
org.apache.maven.pluginsmaven-surefire-plugin
- 3.0.0-M7
+ 3.2.5
@@ -84,7 +84,6 @@
-Xms512m -Xmx1500mmethods10
- pertest
@@ -262,8 +261,8 @@
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api${junit-version}test
@@ -275,6 +274,6 @@
2.15.20.2.61.3.5
- 4.13.2
+ 5.10.2
diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java
index 872244b89008c..da2b5ab2c75ef 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java
@@ -16,7 +16,6 @@
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import java.time.OffsetDateTime;
-import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JavaType;
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/CustomTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/CustomTest.java
index 7e0076c7e6a38..405db1ed671d7 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/CustomTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/CustomTest.java
@@ -17,8 +17,8 @@
import java.util.Arrays;
import java.util.Collections;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import org.openapitools.client.api.BodyApi;
import org.openapitools.client.api.QueryApi;
import org.openapitools.client.model.Category;
@@ -52,13 +52,13 @@ public void testEchoBodyPet() throws ApiException {
photoUrls( Arrays.asList( new String[] { "http://a.com", "http://b.com" } ) ).category( new Category().id( 987L ).name( "new category" ) );
final Pet p = bodyApi.testEchoBodyPet( queryObject );
- Assert.assertNotNull( p );
- Assert.assertEquals( "Hello World", p.getName() );
- Assert.assertEquals( Long.valueOf( 12345L ), p.getId() );
+ Assertions.assertNotNull( p );
+ Assertions.assertEquals( "Hello World", p.getName() );
+ Assertions.assertEquals( Long.valueOf( 12345L ), p.getId() );
// response is empty body
final Pet p2 = bodyApi.testEchoBodyPet( null );
- Assert.assertNull( p2 );
+ Assertions.assertNull( p2 );
}
/**
@@ -72,7 +72,7 @@ public void testEchoBodyPet() throws ApiException {
public void testEchoBodyPetResponseString() throws ApiException {
// response is empty body
final String p2 = bodyApi.testEchoBodyPetResponseString( null );
- Assert.assertNull( p2 );
+ Assertions.assertNull( p2 );
}
/**
@@ -89,7 +89,7 @@ public void testQueryStyleFormExplodeTrueObjectTest() throws ApiException {
final String response = api.testQueryStyleFormExplodeTrueObject( queryObject );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals(
+ Assertions.assertEquals(
"/query/style_form/explode_true/object?id=12345&name=Hello%20World&category=class%20Category%20%7B%0A%20%20%20%20id%3A%20987%0A%20%20%20%20name%3A%20new%20category%0A%7D&photoUrls=http%3A%2F%2Fa.com&photoUrls=http%3A%2F%2Fb.com",
p.path );
}
@@ -106,13 +106,13 @@ public void testQueryStyleDeepObjectExplodeTrueObject() throws ApiException {
final Pet queryObject = new Pet().id( 12345L ).name( "Hello World" ).
photoUrls( Arrays.asList( new String[] { "http://a.com", "http://b.com" } ) ).category( new Category().id( 987L ).name( "new category" ) );
- Assert.assertEquals(
+ Assertions.assertEquals(
"query_object[id]=12345&query_object[name]=Hello%20World&query_object[category][id]=987&query_object[category][name]=new%20category&query_object[photoUrls][0]=http%3A%2F%2Fa.com&query_object[photoUrls][1]=http%3A%2F%2Fb.com",
queryObject.toUrlQueryString( "query_object" ) );
final String response = api.testQueryStyleDeepObjectExplodeTrueObject( queryObject );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals(
+ Assertions.assertEquals(
"/query/style_deepObject/explode_true/object?query_object[id]=12345&query_object[name]=Hello%20World&query_object[category][id]=987&query_object[category][name]=new%20category&query_object[photoUrls][0]=http%3A%2F%2Fa.com&query_object[photoUrls][1]=http%3A%2F%2Fb.com",
p.path );
}
@@ -132,7 +132,7 @@ public void testQueryStyleFormExplodeTrueObjectAllOfTest() throws ApiException {
final String response = api.testQueryStyleFormExplodeTrueObjectAllOf( queryObject );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals( "/query/style_form/explode_true/object/allOf?id=3487&outcomes=SKIPPED&outcomes=FAILURE&text=Hello%20World", p.path );
+ Assertions.assertEquals( "/query/style_form/explode_true/object/allOf?id=3487&outcomes=SKIPPED&outcomes=FAILURE&text=Hello%20World", p.path );
}
/**
@@ -149,7 +149,7 @@ public void testQueryStyleFormExplodeTrueArrayString() throws ApiException {
final String response = api.testQueryStyleFormExplodeTrueArrayString( q );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals( "/query/style_form/explode_true/array_string?values=hello%20world%201&values=hello%20world%202", p.path );
+ Assertions.assertEquals( "/query/style_form/explode_true/array_string?values=hello%20world%201&values=hello%20world%202", p.path );
}
/**
@@ -163,44 +163,44 @@ public void testQueryStyleFormExplodeTrueArrayString() throws ApiException {
public void testQueryIntegerBooleanString() throws ApiException {
final String response = api.testQueryIntegerBooleanString( 1, true, "Hello World" );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals( "/query/integer/boolean/string?integer_query=1&boolean_query=true&string_query=Hello%20World", p.path );
+ Assertions.assertEquals( "/query/integer/boolean/string?integer_query=1&boolean_query=true&string_query=Hello%20World", p.path );
}
@Test
public void testArrayDefaultValues() {
// test array default values
final DefaultValue d = new DefaultValue();
- Assert.assertEquals( d.getArrayStringEnumRefDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.SUCCESS );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().get( 1 ), StringEnumRef.FAILURE );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.SUCCESS );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().get( 1 ), StringEnumRef.FAILURE );
- Assert.assertEquals( d.getArrayStringEnumDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.SUCCESS );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 1 ), DefaultValue.ArrayStringEnumDefaultEnum.FAILURE );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.SUCCESS );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 1 ), DefaultValue.ArrayStringEnumDefaultEnum.FAILURE );
- Assert.assertEquals( d.getArrayStringDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
- Assert.assertEquals( d.getArrayStringDefault().get( 1 ), "skipped" );
+ Assertions.assertEquals( d.getArrayStringDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 1 ), "skipped" );
- Assert.assertEquals( d.getArrayIntegerDefault().size(), 2 );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
- Assert.assertNull( d.getArrayStringNullable() );
- Assert.assertEquals( d.getArrayString(), Collections.emptyList() );
+ Assertions.assertNull( d.getArrayStringNullable() );
+ Assertions.assertEquals( d.getArrayString(), Collections.emptyList() );
// test addItem
d.addArrayStringEnumDefaultItem( DefaultValue.ArrayStringEnumDefaultEnum.UNCLASSIFIED );
- Assert.assertEquals( d.getArrayStringEnumDefault().size(), 3 );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 2 ), DefaultValue.ArrayStringEnumDefaultEnum.UNCLASSIFIED );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().size(), 3 );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 2 ), DefaultValue.ArrayStringEnumDefaultEnum.UNCLASSIFIED );
d.addArrayStringDefaultItem( "new item" );
- Assert.assertEquals( d.getArrayStringDefault().size(), 3 );
- Assert.assertEquals( d.getArrayStringDefault().get( 2 ), "new item" );
+ Assertions.assertEquals( d.getArrayStringDefault().size(), 3 );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 2 ), "new item" );
d.addArrayIntegerDefaultItem( 5 );
- Assert.assertEquals( d.getArrayIntegerDefault().size(), 3 );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 2 ), Integer.valueOf( 5 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().size(), 3 );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 2 ), Integer.valueOf( 5 ) );
}
@@ -213,26 +213,26 @@ public void testDefaultValuesSerializationWithEmptyPayload() throws IOException
final DefaultValue d = apiClient.getObjectMapper().readValue( str, new TypeReference() {
} );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.SUCCESS );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().get( 1 ), StringEnumRef.FAILURE );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.SUCCESS );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().get( 1 ), StringEnumRef.FAILURE );
- Assert.assertEquals( d.getArrayStringEnumDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.SUCCESS );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 1 ), DefaultValue.ArrayStringEnumDefaultEnum.FAILURE );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.SUCCESS );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 1 ), DefaultValue.ArrayStringEnumDefaultEnum.FAILURE );
- Assert.assertEquals( d.getArrayStringDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
- Assert.assertEquals( d.getArrayStringDefault().get( 1 ), "skipped" );
+ Assertions.assertEquals( d.getArrayStringDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 1 ), "skipped" );
- Assert.assertEquals( d.getArrayIntegerDefault().size(), 2 );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
- Assert.assertNull( d.getArrayStringNullable() );
- Assert.assertEquals( d.getArrayString(), Collections.emptyList() );
+ Assertions.assertNull( d.getArrayStringNullable() );
+ Assertions.assertEquals( d.getArrayString(), Collections.emptyList() );
- Assert.assertEquals( apiClient.getObjectMapper().writeValueAsString( d ),
+ Assertions.assertEquals( apiClient.getObjectMapper().writeValueAsString( d ),
"{\"array_string_enum_ref_default\":[\"success\",\"failure\"],\"array_string_enum_default\":[\"success\",\"failure\"],\"array_string_default\":[\"failure\",\"skipped\"],\"array_integer_default\":[1,3],\"array_string\":[]}" );
}
@@ -245,23 +245,23 @@ public void testDefaultValuesSerializationWithJSONString() throws IOException {
final DefaultValue d = apiClient.getObjectMapper().readValue( str, new TypeReference() {
} );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().size(), 1 );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.UNCLASSIFIED );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().size(), 1 );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.UNCLASSIFIED );
- Assert.assertEquals( d.getArrayStringEnumDefault().size(), 1 );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.UNCLASSIFIED );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().size(), 1 );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.UNCLASSIFIED );
- Assert.assertEquals( d.getArrayStringDefault().size(), 1 );
- Assert.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
+ Assertions.assertEquals( d.getArrayStringDefault().size(), 1 );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
- Assert.assertEquals( d.getArrayIntegerDefault().size(), 2 );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
- Assert.assertNull( d.getArrayStringNullable() );
- Assert.assertEquals( d.getArrayString(), Collections.emptyList() );
+ Assertions.assertNull( d.getArrayStringNullable() );
+ Assertions.assertEquals( d.getArrayString(), Collections.emptyList() );
- Assert.assertEquals( apiClient.getObjectMapper().writeValueAsString( d ),
+ Assertions.assertEquals( apiClient.getObjectMapper().writeValueAsString( d ),
"{\"array_string_enum_ref_default\":[\"unclassified\"],\"array_string_enum_default\":[\"unclassified\"],\"array_string_default\":[\"failure\"],\"array_integer_default\":[1,3],\"array_string\":[]}" );
}
@@ -274,9 +274,9 @@ public void testDefaultValuesSerializationWithIncorrectDefaultValues() throws IO
try {
final DefaultValue d = apiClient.getObjectMapper().readValue( str, new TypeReference() {
} );
- Assert.assertTrue( false ); // the test should not reach this line
+ Assertions.assertTrue( false ); // the test should not reach this line
} catch ( final com.fasterxml.jackson.databind.exc.ValueInstantiationException e ) {
- Assert.assertEquals( e.getMessage(),
+ Assertions.assertEquals( e.getMessage(),
"Cannot construct instance of `org.openapitools.client.model.DefaultValue$ArrayStringEnumDefaultEnum`, problem: Unexpected value 'invalid'\n" +
" at [Source: (String)\"{ \"array_string_enum_default\": [\"invalid\"] }\"; line: 1, column: 33] (through reference chain: org.openapitools.client.model.DefaultValue[\"array_string_enum_default\"]->java.util.ArrayList[0])" );
}
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/AuthApiTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/AuthApiTest.java
index 7fc2956fce239..81b483fa70699 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/AuthApiTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/AuthApiTest.java
@@ -14,9 +14,9 @@
package org.openapitools.client.api;
import org.openapitools.client.ApiException;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@@ -59,10 +59,10 @@ public void testAuthHttpBearerTest() throws ApiException {
String response;
api.getApiClient().setBearerToken("fixed token");
response = api.testAuthHttpBearer();
- Assert.assertTrue(response.contains("Authorization: Bearer fixed token"));
+ Assertions.assertTrue(response.contains("Authorization: Bearer fixed token"));
api.getApiClient().setBearerToken(() -> "dynamic token");
response = api.testAuthHttpBearer();
- Assert.assertTrue(response.contains("Authorization: Bearer dynamic token"));
+ Assertions.assertTrue(response.contains("Authorization: Bearer dynamic token"));
}
}
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/BodyApiTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/BodyApiTest.java
index 352e8e2e19bda..ef13f819e6349 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/BodyApiTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/BodyApiTest.java
@@ -15,9 +15,9 @@
import org.openapitools.client.ApiException;
import org.openapitools.client.model.Pet;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@@ -29,7 +29,7 @@
/**
* API tests for BodyApi
*/
-@Ignore
+@Disabled
public class BodyApiTest {
private final BodyApi api = new BodyApi();
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/FormApiTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/FormApiTest.java
index 1487429390a2f..a308e36d2c3ea 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/FormApiTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/FormApiTest.java
@@ -14,9 +14,9 @@
package org.openapitools.client.api;
import org.openapitools.client.ApiException;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@@ -28,7 +28,7 @@
/**
* API tests for FormApi
*/
-@Ignore
+@Disabled
public class FormApiTest {
private final FormApi api = new FormApi();
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/HeaderApiTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/HeaderApiTest.java
index 989c687cb7f09..3f0ec9214bf38 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/HeaderApiTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/HeaderApiTest.java
@@ -15,9 +15,9 @@
import org.openapitools.client.ApiException;
import org.openapitools.client.model.StringEnumRef;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@@ -29,7 +29,7 @@
/**
* API tests for HeaderApi
*/
-@Ignore
+@Disabled
public class HeaderApiTest {
private final HeaderApi api = new HeaderApi();
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/PathApiTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/PathApiTest.java
index 5968d6614bd7b..3759bdee97a6f 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/PathApiTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/PathApiTest.java
@@ -15,9 +15,9 @@
import org.openapitools.client.ApiException;
import org.openapitools.client.model.StringEnumRef;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@@ -29,7 +29,7 @@
/**
* API tests for PathApi
*/
-@Ignore
+@Disabled
public class PathApiTest {
private final PathApi api = new PathApi();
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/QueryApiTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/QueryApiTest.java
index 69ae8a22161c0..069bf4bd3267f 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/QueryApiTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/api/QueryApiTest.java
@@ -16,9 +16,9 @@
import org.openapitools.client.ApiException;
import org.openapitools.client.model.Pet;
import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@@ -30,7 +30,7 @@
/**
* API tests for QueryApi
*/
-@Ignore
+@Disabled
public class QueryApiTest {
private final QueryApi api = new QueryApi();
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdAndCategoryTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdAndCategoryTest.java
index b96bf46b10538..05ea72116b86c 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdAndCategoryTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdAndCategoryTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdTest.java
index ac9a253bb6fbf..31323a96d3d36 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/BirdTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/CategoryTest.java
index 51804e0c14cf9..e32182d690f6c 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/CategoryTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/CategoryTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DataQueryTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DataQueryTest.java
index 9b71c406586c1..7916c47947c7e 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DataQueryTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DataQueryTest.java
@@ -22,9 +22,9 @@
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.Query;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DefaultValueTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DefaultValueTest.java
index 8adf113d6ea2d..4de417ac03243 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DefaultValueTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/DefaultValueTest.java
@@ -24,9 +24,9 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java
index 2d9c5b371fe30..ccc2e77abc45b 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java
@@ -19,9 +19,9 @@
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/PetTest.java
index 2002d08bf8a79..1d5a7048a5606 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/PetTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/PetTest.java
@@ -22,9 +22,9 @@
import java.util.List;
import org.openapitools.client.model.Category;
import org.openapitools.client.model.Tag;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/QueryTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/QueryTest.java
index 266a3cb67399e..48e1fbe6af988 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/QueryTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/QueryTest.java
@@ -20,9 +20,9 @@
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.List;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/StringEnumRefTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/StringEnumRefTest.java
index 81d7f918ea01b..767df43f315fd 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/StringEnumRefTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/StringEnumRefTest.java
@@ -13,9 +13,9 @@
package org.openapitools.client.model;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TagTest.java
index d1d4b9de0d53d..5af2a8f54cc1d 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TagTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TagTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java
index cdb7c02c0fd86..d5d0fc51cc1de 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Model tests for TestFormObjectMultipartRequestMarker
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java
index 1fa7d643c4b58..b90b1e4cd2000 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java
index 82e7035a25a2d..910af6a663d2f 100644
--- a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java
+++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java
@@ -20,9 +20,9 @@
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.List;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/native/build.gradle b/samples/client/echo_api/java/native/build.gradle
index 4e526cc1e7515..751afe8baf488 100644
--- a/samples/client/echo_api/java/native/build.gradle
+++ b/samples/client/echo_api/java/native/build.gradle
@@ -68,7 +68,7 @@ artifacts {
ext {
jackson_version = "2.14.1"
jakarta_annotation_version = "1.3.5"
- junit_version = "4.13.2"
+ junit_version = "5.10.2"
httpmime_version = "4.5.13"
}
@@ -81,7 +81,7 @@ dependencies {
implementation "org.openapitools:jackson-databind-nullable:0.2.1"
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
implementation "org.apache.httpcomponents:httpmime:$httpmime_version"
- testImplementation "junit:junit:$junit_version"
+ testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
}
// Use spotless plugin to automatically format code, remove unused import, etc
diff --git a/samples/client/echo_api/java/native/pom.xml b/samples/client/echo_api/java/native/pom.xml
index 704df14708297..5637e81399a16 100644
--- a/samples/client/echo_api/java/native/pom.xml
+++ b/samples/client/echo_api/java/native/pom.xml
@@ -57,7 +57,7 @@
maven-surefire-plugin
- 3.0.0-M7
+ 3.2.5conf/log4j.properties
@@ -242,8 +242,8 @@
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api${junit-version}test
@@ -257,7 +257,7 @@
0.2.61.3.54.5.14
- 4.13.2
+ 5.10.22.27.2
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/CustomTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/CustomTest.java
index 0b2a52f9434e5..9aed8d9bef4e1 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/CustomTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/CustomTest.java
@@ -22,8 +22,8 @@
import java.util.List;
import java.util.Objects;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import org.openapitools.client.api.BodyApi;
import org.openapitools.client.api.FormApi;
import org.openapitools.client.api.QueryApi;
@@ -60,13 +60,13 @@ public void testEchoBodyPet() throws ApiException {
photoUrls( Arrays.asList( new String[] { "http://a.com", "http://b.com" } ) ).category( new Category().id( 987L ).name( "new category" ) );
final Pet p = bodyApi.testEchoBodyPet( queryObject );
- Assert.assertNotNull( p );
- Assert.assertEquals( "Hello World", p.getName() );
- Assert.assertEquals( Long.valueOf( 12345L ), p.getId() );
+ Assertions.assertNotNull( p );
+ Assertions.assertEquals( "Hello World", p.getName() );
+ Assertions.assertEquals( Long.valueOf( 12345L ), p.getId() );
// response is empty body
final Pet p2 = bodyApi.testEchoBodyPet( null );
- Assert.assertNull( p2 );
+ Assertions.assertNull( p2 );
}
/**
@@ -82,13 +82,13 @@ public void testEchoBodyAllOfPet() throws ApiException {
photoUrls( Arrays.asList( new String[] { "http://a.com", "http://b.com" } ) ).category( new Category().id( 987L ).name( "new category" ) );
final Pet p = bodyApi.testEchoBodyAllOfPet( queryObject );
- Assert.assertNotNull( p );
- Assert.assertEquals( "Hello World", p.getName() );
- Assert.assertEquals( Long.valueOf( 12345L ), p.getId() );
+ Assertions.assertNotNull( p );
+ Assertions.assertEquals( "Hello World", p.getName() );
+ Assertions.assertEquals( Long.valueOf( 12345L ), p.getId() );
// response is empty body
final Pet p2 = bodyApi.testEchoBodyPet( null );
- Assert.assertNull( p2 );
+ Assertions.assertNull( p2 );
}
/**
@@ -105,7 +105,7 @@ public void testQueryStyleFormExplodeTrueObjectTest() throws ApiException {
final String response = api.testQueryStyleFormExplodeTrueObject( queryObject );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals(
+ Assertions.assertEquals(
"/query/style_form/explode_true/object?id=12345&name=Hello%20World&category=class%20Category%20%7B%0A%20%20%20%20id%3A%20987%0A%20%20%20%20name%3A%20new%20category%0A%7D&photoUrls=http%3A%2F%2Fa.com&photoUrls=http%3A%2F%2Fb.com",
p.path );
}
@@ -125,7 +125,7 @@ public void testQueryStyleFormExplodeTrueObjectAllOfTest() throws ApiException {
final String response = api.testQueryStyleFormExplodeTrueObjectAllOf( queryObject );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals( "/query/style_form/explode_true/object/allOf?id=3487&outcomes=SKIPPED&outcomes=FAILURE&text=Hello%20World", p.path );
+ Assertions.assertEquals( "/query/style_form/explode_true/object/allOf?id=3487&outcomes=SKIPPED&outcomes=FAILURE&text=Hello%20World", p.path );
}
/**
@@ -140,13 +140,13 @@ public void testQueryStyleDeepObjectExplodeTrueObject() throws ApiException {
final Pet queryObject = new Pet().id( 12345L ).name( "Hello World" ).
photoUrls( Arrays.asList( new String[] { "http://a.com", "http://b.com" } ) ).category( new Category().id( 987L ).name( "new category" ) );
- Assert.assertEquals(
+ Assertions.assertEquals(
"query_object[id]=12345&query_object[name]=Hello%20World&query_object[category][id]=987&query_object[category][name]=new%20category&query_object[photoUrls][0]=http%3A%2F%2Fa.com&query_object[photoUrls][1]=http%3A%2F%2Fb.com",
queryObject.toUrlQueryString( "query_object" ) );
final String response = api.testQueryStyleDeepObjectExplodeTrueObject( queryObject );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals(
+ Assertions.assertEquals(
"/query/style_deepObject/explode_true/object?query_object[id]=12345&query_object[name]=Hello%20World&query_object[category][id]=987&query_object[category][name]=new%20category&query_object[photoUrls][0]=http%3A%2F%2Fa.com&query_object[photoUrls][1]=http%3A%2F%2Fb.com",
p.path );
}
@@ -164,12 +164,12 @@ public void testQueryStyleDeepObjectExplodeTrueObjectAllOf() throws ApiException
12345L ).name( "Hello World" ).
color( "red" ).size( "small" );
- Assert.assertEquals( "query_object[size]=small&query_object[color]=red&query_object[id]=12345&query_object[name]=Hello%20World",
+ Assertions.assertEquals( "query_object[size]=small&query_object[color]=red&query_object[id]=12345&query_object[name]=Hello%20World",
queryObject.toUrlQueryString( "query_object" ) );
final String response = api.testQueryStyleDeepObjectExplodeTrueObjectAllOf( queryObject );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals(
+ Assertions.assertEquals(
"/query/style_deepObject/explode_true/object/allOf?query_object[size]=small&query_object[color]=red&query_object[id]=12345&query_object[name]=Hello%20World",
p.path );
}
@@ -188,45 +188,45 @@ public void testQueryStyleFormExplodeTrueArrayString() throws ApiException {
final String response = api.testQueryStyleFormExplodeTrueArrayString( q );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals( "/query/style_form/explode_true/array_string?values=hello%20world%201&values=hello%20world%202", p.path );
+ Assertions.assertEquals( "/query/style_form/explode_true/array_string?values=hello%20world%201&values=hello%20world%202", p.path );
}
@Test
public void testArrayDefaultValues() {
// test array default values
final DefaultValue d = new DefaultValue();
- Assert.assertEquals( d.getArrayStringEnumRefDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.SUCCESS );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().get( 1 ), StringEnumRef.FAILURE );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.SUCCESS );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().get( 1 ), StringEnumRef.FAILURE );
- Assert.assertEquals( d.getArrayStringEnumDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.SUCCESS );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 1 ), DefaultValue.ArrayStringEnumDefaultEnum.FAILURE );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.SUCCESS );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 1 ), DefaultValue.ArrayStringEnumDefaultEnum.FAILURE );
- Assert.assertEquals( d.getArrayStringDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
- Assert.assertEquals( d.getArrayStringDefault().get( 1 ), "skipped" );
+ Assertions.assertEquals( d.getArrayStringDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 1 ), "skipped" );
- Assert.assertEquals( d.getArrayIntegerDefault().size(), 2 );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
- Assert.assertNull( d.getArrayStringNullable() );
- Assert.assertNull( d.getArrayStringExtensionNullable() );
- Assert.assertEquals( d.getArrayString(), List.of() );
+ Assertions.assertNull( d.getArrayStringNullable() );
+ Assertions.assertNull( d.getArrayStringExtensionNullable() );
+ Assertions.assertEquals( d.getArrayString(), List.of() );
// test addItem
d.addArrayStringEnumDefaultItem( DefaultValue.ArrayStringEnumDefaultEnum.UNCLASSIFIED );
- Assert.assertEquals( d.getArrayStringEnumDefault().size(), 3 );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 2 ), DefaultValue.ArrayStringEnumDefaultEnum.UNCLASSIFIED );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().size(), 3 );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 2 ), DefaultValue.ArrayStringEnumDefaultEnum.UNCLASSIFIED );
d.addArrayStringDefaultItem( "new item" );
- Assert.assertEquals( d.getArrayStringDefault().size(), 3 );
- Assert.assertEquals( d.getArrayStringDefault().get( 2 ), "new item" );
+ Assertions.assertEquals( d.getArrayStringDefault().size(), 3 );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 2 ), "new item" );
d.addArrayIntegerDefaultItem( 5 );
- Assert.assertEquals( d.getArrayIntegerDefault().size(), 3 );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 2 ), Integer.valueOf( 5 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().size(), 3 );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 2 ), Integer.valueOf( 5 ) );
}
@Test
@@ -238,27 +238,27 @@ public void testDefaultValuesSerializationWithEmptyPayload() throws IOException
final DefaultValue d = apiClient.getObjectMapper().readValue( str, new TypeReference<>() {
} );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.SUCCESS );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().get( 1 ), StringEnumRef.FAILURE );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.SUCCESS );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().get( 1 ), StringEnumRef.FAILURE );
- Assert.assertEquals( d.getArrayStringEnumDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.SUCCESS );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 1 ), DefaultValue.ArrayStringEnumDefaultEnum.FAILURE );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.SUCCESS );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 1 ), DefaultValue.ArrayStringEnumDefaultEnum.FAILURE );
- Assert.assertEquals( d.getArrayStringDefault().size(), 2 );
- Assert.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
- Assert.assertEquals( d.getArrayStringDefault().get( 1 ), "skipped" );
+ Assertions.assertEquals( d.getArrayStringDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 1 ), "skipped" );
- Assert.assertEquals( d.getArrayIntegerDefault().size(), 2 );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
- Assert.assertNull( d.getArrayStringNullable() );
- Assert.assertNull( d.getArrayStringExtensionNullable() );
- Assert.assertEquals( d.getArrayString(), List.of() );
+ Assertions.assertNull( d.getArrayStringNullable() );
+ Assertions.assertNull( d.getArrayStringExtensionNullable() );
+ Assertions.assertEquals( d.getArrayString(), List.of() );
- Assert.assertEquals( apiClient.getObjectMapper().writeValueAsString( d ),
+ Assertions.assertEquals( apiClient.getObjectMapper().writeValueAsString( d ),
"{\"array_string_enum_ref_default\":[\"success\",\"failure\"],\"array_string_enum_default\":[\"success\",\"failure\"],\"array_string_default\":[\"failure\",\"skipped\"],\"array_integer_default\":[1,3],\"array_string\":[]}" );
}
@@ -271,24 +271,24 @@ public void testDefaultValuesSerializationWithJSONString() throws IOException {
final DefaultValue d = apiClient.getObjectMapper().readValue( str, new TypeReference<>() {
} );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().size(), 1 );
- Assert.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.UNCLASSIFIED );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().size(), 1 );
+ Assertions.assertEquals( d.getArrayStringEnumRefDefault().get( 0 ), StringEnumRef.UNCLASSIFIED );
- Assert.assertEquals( d.getArrayStringEnumDefault().size(), 1 );
- Assert.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.UNCLASSIFIED );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().size(), 1 );
+ Assertions.assertEquals( d.getArrayStringEnumDefault().get( 0 ), DefaultValue.ArrayStringEnumDefaultEnum.UNCLASSIFIED );
- Assert.assertEquals( d.getArrayStringDefault().size(), 1 );
- Assert.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
+ Assertions.assertEquals( d.getArrayStringDefault().size(), 1 );
+ Assertions.assertEquals( d.getArrayStringDefault().get( 0 ), "failure" );
- Assert.assertEquals( d.getArrayIntegerDefault().size(), 2 );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
- Assert.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().size(), 2 );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 0 ), Integer.valueOf( 1 ) );
+ Assertions.assertEquals( d.getArrayIntegerDefault().get( 1 ), Integer.valueOf( 3 ) );
- Assert.assertNull( d.getArrayStringNullable() );
- Assert.assertNull( d.getArrayStringExtensionNullable() );
- Assert.assertEquals( d.getArrayString(), List.of() );
+ Assertions.assertNull( d.getArrayStringNullable() );
+ Assertions.assertNull( d.getArrayStringExtensionNullable() );
+ Assertions.assertEquals( d.getArrayString(), List.of() );
- Assert.assertEquals( apiClient.getObjectMapper().writeValueAsString( d ),
+ Assertions.assertEquals( apiClient.getObjectMapper().writeValueAsString( d ),
"{\"array_string_enum_ref_default\":[\"unclassified\"],\"array_string_enum_default\":[\"unclassified\"],\"array_string_default\":[\"failure\"],\"array_integer_default\":[1,3],\"array_string\":[]}" );
}
@@ -301,9 +301,9 @@ public void testDefaultValuesSerializationWithIncorrectDefaultValues() throws IO
try {
final DefaultValue d = apiClient.getObjectMapper().readValue( str, new TypeReference<>() {
} );
- Assert.assertTrue( false ); // the test should not reach this line
+ Assertions.assertTrue( false ); // the test should not reach this line
} catch ( final com.fasterxml.jackson.databind.exc.ValueInstantiationException e ) {
- Assert.assertEquals( e.getMessage(),
+ Assertions.assertEquals( e.getMessage(),
"Cannot construct instance of `org.openapitools.client.model.DefaultValue$ArrayStringEnumDefaultEnum`, problem: Unexpected value 'invalid'\n" +
" at [Source: (String)\"{ \"array_string_enum_default\": [\"invalid\"] }\"; line: 1, column: 33] (through reference chain: org.openapitools.client.model.DefaultValue[\"array_string_enum_default\"]->java.util.ArrayList[0])" );
}
@@ -324,8 +324,8 @@ public void testFormIntegerBooleanStringTest() throws ApiException {
final String stringForm = "Hello World";
final String response = formApi.testFormIntegerBooleanString( integerForm, booleanForm, stringForm );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals( "/form/integer/boolean/string", p.path );
- Assert.assertEquals( "3b\ninteger_form=1337&boolean_form=true&string_form=Hello+World\n0\n\n", p.body );
+ Assertions.assertEquals( "/form/integer/boolean/string", p.path );
+ Assertions.assertEquals( "3b\ninteger_form=1337&boolean_form=true&string_form=Hello+World\n0\n\n", p.body );
}
@Test
@@ -336,8 +336,8 @@ public void testFormOneOf() throws ApiException {
final Boolean form4 = true;
final String response = formApi.testFormOneof( form1, form2, form3, form4, null, null );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals( "/form/oneof", p.path );
- Assert.assertEquals( "3c\nform1=form1_example&form2=56&form3=form3++example&form4=true\n0\n\n", p.body );
+ Assertions.assertEquals( "/form/oneof", p.path );
+ Assertions.assertEquals( "3c\nform1=form1_example&form2=56&form3=form3++example&form4=true\n0\n\n", p.body );
}
@Test
@@ -348,12 +348,12 @@ public void testBodyMultipartFormdataArrayOfBinary() throws ApiException {
final String response = bodyApi.testBodyMultipartFormdataArrayOfBinary( List.of( file1, file2 ) );
final org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser( response );
- Assert.assertEquals( "/body/application/octetstream/array_of_binary", p.path );
+ Assertions.assertEquals( "/body/application/octetstream/array_of_binary", p.path );
- Assert.assertTrue( p.body.contains( file1.getName() ) );
- Assert.assertTrue( p.body.contains( "Hello" ) );
- Assert.assertTrue( p.body.contains( file2.getName() ) );
- Assert.assertTrue( p.body.contains( "World" ) );
+ Assertions.assertTrue( p.body.contains( file1.getName() ) );
+ Assertions.assertTrue( p.body.contains( "Hello" ) );
+ Assertions.assertTrue( p.body.contains( file2.getName() ) );
+ Assertions.assertTrue( p.body.contains( "World" ) );
}
private File getFile( final String content ) {
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/AuthApiTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/AuthApiTest.java
index 35d1b0316c719..0efd63dfdd649 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/AuthApiTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/AuthApiTest.java
@@ -13,21 +13,15 @@
package org.openapitools.client.api;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.openapitools.client.ApiException;
-import org.junit.Test;
-import org.junit.Ignore;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
/**
* API tests for AuthApi
*/
-@Ignore
+@Disabled
public class AuthApiTest {
private final AuthApi api = new AuthApi();
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/BodyApiTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/BodyApiTest.java
index fc14326e06a3e..04bcdb16a4a09 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/BodyApiTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/BodyApiTest.java
@@ -13,22 +13,16 @@
package org.openapitools.client.api;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.openapitools.client.ApiException;
import org.openapitools.client.model.Pet;
-import org.junit.Test;
-import org.junit.Ignore;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
/**
* API tests for BodyApi
*/
-@Ignore
+@Disabled
public class BodyApiTest {
private final BodyApi api = new BodyApi();
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/FormApiTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/FormApiTest.java
index 701f505c91dba..c9fd883d79a9d 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/FormApiTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/FormApiTest.java
@@ -13,21 +13,15 @@
package org.openapitools.client.api;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.openapitools.client.ApiException;
-import org.junit.Test;
-import org.junit.Ignore;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
/**
* API tests for FormApi
*/
-@Ignore
+@Disabled
public class FormApiTest {
private final FormApi api = new FormApi();
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/HeaderApiTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/HeaderApiTest.java
index 61b3dc5c0a7f4..844eb5b33206f 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/HeaderApiTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/HeaderApiTest.java
@@ -13,22 +13,16 @@
package org.openapitools.client.api;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.openapitools.client.ApiException;
import org.openapitools.client.model.StringEnumRef;
-import org.junit.Test;
-import org.junit.Ignore;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
/**
* API tests for HeaderApi
*/
-@Ignore
+@Disabled
public class HeaderApiTest {
private final HeaderApi api = new HeaderApi();
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/PathApiTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/PathApiTest.java
index 1b71c16a2c411..b0b834a71d29b 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/PathApiTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/PathApiTest.java
@@ -13,22 +13,16 @@
package org.openapitools.client.api;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.openapitools.client.ApiException;
import org.openapitools.client.model.StringEnumRef;
-import org.junit.Test;
-import org.junit.Ignore;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
/**
* API tests for PathApi
*/
-@Ignore
+@Disabled
public class PathApiTest {
private final PathApi api = new PathApi();
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/QueryApiTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/QueryApiTest.java
index 5ee9ec290b215..13332bb48e831 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/QueryApiTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/api/QueryApiTest.java
@@ -13,22 +13,16 @@
package org.openapitools.client.api;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.openapitools.client.ApiException;
import org.openapitools.client.model.Pet;
-import org.junit.Test;
-import org.junit.Ignore;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
/**
* API tests for QueryApi
*/
-@Ignore
+@Disabled
public class QueryApiTest {
private final QueryApi api = new QueryApi();
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/BirdAndCategoryTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/BirdAndCategoryTest.java
index b96bf46b10538..22e6d18b51321 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/BirdAndCategoryTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/BirdAndCategoryTest.java
@@ -13,14 +13,7 @@
package org.openapitools.client.model;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/BirdTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/BirdTest.java
index ac9a253bb6fbf..87bd92ba5635d 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/BirdTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/BirdTest.java
@@ -13,14 +13,7 @@
package org.openapitools.client.model;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/CategoryTest.java
index 34ead48f6509c..f97a4c0d43f07 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/CategoryTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/CategoryTest.java
@@ -13,14 +13,7 @@
package org.openapitools.client.model;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/DataQueryTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/DataQueryTest.java
index 9b71c406586c1..29ffada7a6e9f 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/DataQueryTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/DataQueryTest.java
@@ -13,18 +13,7 @@
package org.openapitools.client.model;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import java.time.OffsetDateTime;
-import java.util.ArrayList;
-import java.util.List;
-import org.openapitools.client.model.Query;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/DefaultValueTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/DefaultValueTest.java
index 809a14bb008bc..79dd6be90b7c1 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/DefaultValueTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/DefaultValueTest.java
@@ -13,20 +13,7 @@
package org.openapitools.client.model;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import java.util.ArrayList;
-import java.util.List;
-import org.openapitools.jackson.nullable.JsonNullable;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import org.openapitools.jackson.nullable.JsonNullable;
-import java.util.NoSuchElementException;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/EnumStringRefTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/EnumStringRefTest.java
index 3621b1d0af566..019d6f241333a 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/EnumStringRefTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/EnumStringRefTest.java
@@ -13,9 +13,7 @@
package org.openapitools.client.model;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java
index 2d9c5b371fe30..69479f24a76a5 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java
@@ -13,15 +13,7 @@
package org.openapitools.client.model;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import java.math.BigDecimal;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/PetTest.java
index 918a3b169210e..d537ddc510ab2 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/PetTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/PetTest.java
@@ -13,18 +13,7 @@
package org.openapitools.client.model;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import java.util.ArrayList;
-import java.util.List;
-import org.openapitools.client.model.Category;
-import org.openapitools.client.model.Tag;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/QueryTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/QueryTest.java
index 266a3cb67399e..ff1ddefbf5d27 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/QueryTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/QueryTest.java
@@ -13,16 +13,7 @@
package org.openapitools.client.model;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/StringEnumRefTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/StringEnumRefTest.java
index 81d7f918ea01b..933cc14385073 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/StringEnumRefTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/StringEnumRefTest.java
@@ -13,9 +13,7 @@
package org.openapitools.client.model;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TagTest.java
index 342e15ae49d26..050e9a3a16738 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TagTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TagTest.java
@@ -13,14 +13,7 @@
package org.openapitools.client.model;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java
index f4dc3543e6ce1..e1bb4f420c470 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java
@@ -13,15 +13,7 @@
package org.openapitools.client.model;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import java.util.Arrays;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Model tests for TestFormObjectMultipartRequestMarker
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java
index 29cfa46182a40..8214380df37aa 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java
@@ -13,14 +13,7 @@
package org.openapitools.client.model;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java
index 4d1e8e89d49c9..555aaba7e5279 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java
@@ -13,16 +13,7 @@
package org.openapitools.client.model;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameterTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameterTest.java
index c620d9aa9cc45..95892feacec8a 100644
--- a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameterTest.java
+++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueObjectAllOfQueryObjectParameterTest.java
@@ -13,14 +13,7 @@
package org.openapitools.client.model;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.gradle b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.gradle
index c200c7adc70d6..ba29ee2b2f748 100644
--- a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.gradle
+++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.gradle
@@ -118,9 +118,9 @@ dependencies {
implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
- testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1'
+ testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testImplementation 'org.mockito:mockito-core:3.12.4'
- testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1'
+ testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
}
javadoc {
diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.sbt b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.sbt
index 3f438cc18060f..cef996ca186a0 100644
--- a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.sbt
+++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/build.sbt
@@ -22,7 +22,7 @@ lazy val root = (project in file(".")).
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
- "org.junit.jupiter" % "junit-jupiter-api" % "5.9.1" % "test",
+ "org.junit.jupiter" % "junit-jupiter-api" % "5.10.2" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test",
"org.mockito" % "mockito-core" % "3.12.4" % "test"
)
diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/pom.xml b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/pom.xml
index 3c6852826c1eb..6d7d759f3536c 100644
--- a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/pom.xml
+++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/pom.xml
@@ -339,7 +339,7 @@
3.14.00.2.61.3.5
- 5.10.0
+ 5.10.21.10.02.1.11.1.1
diff --git a/samples/client/echo_api/java/okhttp-gson/build.gradle b/samples/client/echo_api/java/okhttp-gson/build.gradle
index 38a181fc21f47..3d38f68764d20 100644
--- a/samples/client/echo_api/java/okhttp-gson/build.gradle
+++ b/samples/client/echo_api/java/okhttp-gson/build.gradle
@@ -117,9 +117,9 @@ dependencies {
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
- testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1'
+ testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testImplementation 'org.mockito:mockito-core:3.12.4'
- testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1'
+ testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
}
javadoc {
diff --git a/samples/client/echo_api/java/okhttp-gson/build.sbt b/samples/client/echo_api/java/okhttp-gson/build.sbt
index 55b2479519fe1..7ea5b0cb5607e 100644
--- a/samples/client/echo_api/java/okhttp-gson/build.sbt
+++ b/samples/client/echo_api/java/okhttp-gson/build.sbt
@@ -21,7 +21,7 @@ lazy val root = (project in file(".")).
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
- "org.junit.jupiter" % "junit-jupiter-api" % "5.9.1" % "test",
+ "org.junit.jupiter" % "junit-jupiter-api" % "5.10.2" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test",
"org.mockito" % "mockito-core" % "3.12.4" % "test"
)
diff --git a/samples/client/echo_api/java/okhttp-gson/pom.xml b/samples/client/echo_api/java/okhttp-gson/pom.xml
index 00a6896416f40..3c3aaad6fb59e 100644
--- a/samples/client/echo_api/java/okhttp-gson/pom.xml
+++ b/samples/client/echo_api/java/okhttp-gson/pom.xml
@@ -334,7 +334,7 @@
3.14.00.2.61.3.5
- 5.10.0
+ 5.10.21.10.02.1.11.1.1
diff --git a/samples/client/echo_api/java/okhttp-gson/src/test/java/org/openapitools/client/CustomTest.java b/samples/client/echo_api/java/okhttp-gson/src/test/java/org/openapitools/client/CustomTest.java
index e7787c995ff54..29855179b5600 100644
--- a/samples/client/echo_api/java/okhttp-gson/src/test/java/org/openapitools/client/CustomTest.java
+++ b/samples/client/echo_api/java/okhttp-gson/src/test/java/org/openapitools/client/CustomTest.java
@@ -13,7 +13,7 @@
package org.openapitools.client;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.openapitools.client.ApiException;
import org.openapitools.client.api.*;
import org.openapitools.client.model.*;
@@ -46,13 +46,13 @@ public void testEchoBodyPet() throws ApiException {
photoUrls(Arrays.asList(new String[]{"http://a.com", "http://b.com"})).category(new Category().id(987L).name("new category"));
Pet p = bodyApi.testEchoBodyPet(queryObject);
- Assert.assertNotNull(p);
- Assert.assertEquals("Hello World", p.getName());
- Assert.assertEquals(Long.valueOf(12345L), p.getId());
+ Assertions.assertNotNull(p);
+ Assertions.assertEquals("Hello World", p.getName());
+ Assertions.assertEquals(Long.valueOf(12345L), p.getId());
// response is empty body
Pet p2 = bodyApi.testEchoBodyPet(null);
- Assert.assertNull(p2);
+ Assertions.assertNull(p2);
}
/**
@@ -70,7 +70,7 @@ public void testQueryStyleFormExplodeTrueObjectTest() throws ApiException {
String response = api.testQueryStyleFormExplodeTrueObject(queryObject);
org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser(response);
- Assert.assertEquals("/query/style_form/explode_true/object?id=12345&name=Hello%20World&category=class%20Category%20%7B%0A%20%20%20%20id%3A%20987%0A%20%20%20%20name%3A%20new%20category%0A%7D&photoUrls=http%3A%2F%2Fa.com&photoUrls=http%3A%2F%2Fb.com", p.path);
+ Assertions.assertEquals("/query/style_form/explode_true/object?id=12345&name=Hello%20World&category=class%20Category%20%7B%0A%20%20%20%20id%3A%20987%0A%20%20%20%20name%3A%20new%20category%0A%7D&photoUrls=http%3A%2F%2Fa.com&photoUrls=http%3A%2F%2Fb.com", p.path);
}
/**
@@ -88,7 +88,7 @@ public void testQueryStyleDeepObjectExplodeTrueObject() throws ApiException {
String response = api.testQueryStyleDeepObjectExplodeTrueObject(queryObject);
org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser(response);
- Assert.assertEquals("/query/style_deepObject/explode_true/object?query_object[id]=12345&query_object[name]=Hello%20World&query_object[category][id]=987&query_object[category][name]=new%20category&query_object[photoUrls][0]=http%3A%2F%2Fa.com&query_object[photoUrls][1]=http%3A%2F%2Fb.com", p.path);
+ Assertions.assertEquals("/query/style_deepObject/explode_true/object?query_object[id]=12345&query_object[name]=Hello%20World&query_object[category][id]=987&query_object[category][name]=new%20category&query_object[photoUrls][0]=http%3A%2F%2Fa.com&query_object[photoUrls][1]=http%3A%2F%2Fb.com", p.path);
}
/**
@@ -106,7 +106,7 @@ public void testQueryStyleDeepObjectExplodeTrueObjectAllOf() throws ApiException
String response = api.testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject);
org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser(response);
- Assert.assertEquals("/query/style_deepObject/explode_true/object/allOf?query_object[size]=small&query_object[color]=red&query_object[id]=12345&query_object[name]=Hello%20World", p.path);
+ Assertions.assertEquals("/query/style_deepObject/explode_true/object/allOf?query_object[size]=small&query_object[color]=red&query_object[id]=12345&query_object[name]=Hello%20World", p.path);
}
/**
@@ -124,6 +124,6 @@ public void testQueryStyleFormExplodeTrueArrayString() throws ApiException {
String response = api.testQueryStyleFormExplodeTrueArrayString(q);
org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser(response);
- Assert.assertEquals("/query/style_form/explode_true/array_string?values=hello%20world%201&values=hello%20world%202", p.path);
+ Assertions.assertEquals("/query/style_form/explode_true/array_string?values=hello%20world%201&values=hello%20world%202", p.path);
}
}
diff --git a/samples/client/echo_api/java/okhttp-gson/src/test/java/org/openapitools/client/api/AuthApiTest.java b/samples/client/echo_api/java/okhttp-gson/src/test/java/org/openapitools/client/api/AuthApiTest.java
index 69083155b5afa..dcf4ae34da4e0 100644
--- a/samples/client/echo_api/java/okhttp-gson/src/test/java/org/openapitools/client/api/AuthApiTest.java
+++ b/samples/client/echo_api/java/okhttp-gson/src/test/java/org/openapitools/client/api/AuthApiTest.java
@@ -13,7 +13,7 @@
package org.openapitools.client.api;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Assertions;
import org.openapitools.client.ApiException;
import org.junit.jupiter.api.Disabled;
diff --git a/samples/client/echo_api/java/resteasy/build.gradle b/samples/client/echo_api/java/resteasy/build.gradle
index 62d43afabd021..e009dc7c48071 100644
--- a/samples/client/echo_api/java/resteasy/build.gradle
+++ b/samples/client/echo_api/java/resteasy/build.gradle
@@ -104,7 +104,8 @@ ext {
jakarta_annotation_version = "1.3.5"
threetenbp_version = "2.9.10"
resteasy_version = "4.5.11.Final"
- junit_version = "4.13"
+ assertj_version = "3.23.1"
+ junit_version = "5.10.2"
}
dependencies {
@@ -120,5 +121,6 @@ dependencies {
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
- testImplementation "junit:junit:$junit_version"
+ testImplementation "org.assertj:assertj-core:$assertj_version"
+ testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
}
diff --git a/samples/client/echo_api/java/resteasy/build.sbt b/samples/client/echo_api/java/resteasy/build.sbt
index 0c31d90292c0f..f68a75caf0e2e 100644
--- a/samples/client/echo_api/java/resteasy/build.sbt
+++ b/samples/client/echo_api/java/resteasy/build.sbt
@@ -19,7 +19,8 @@ lazy val root = (project in file(".")).
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.10" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
- "junit" % "junit" % "4.13" % "test",
+ "org.assertj" % "assertj-core" % "3.23.1" % "test",
+ "junit" % "junit" % "5.10.2" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
)
)
diff --git a/samples/client/echo_api/java/resteasy/pom.xml b/samples/client/echo_api/java/resteasy/pom.xml
index 99657b8eda7e0..d4708d3830c17 100644
--- a/samples/client/echo_api/java/resteasy/pom.xml
+++ b/samples/client/echo_api/java/resteasy/pom.xml
@@ -54,7 +54,7 @@
org.apache.maven.pluginsmaven-surefire-plugin
- 2.12
+ 2.22.2
@@ -64,7 +64,6 @@
-Xms512m -Xmx1500mmethods
- pertest
@@ -240,8 +239,14 @@
- junit
- junit
+ org.assertj
+ assertj-core
+ ${assertj-version}
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-api${junit-version}test
@@ -255,6 +260,7 @@
1.3.52.9.101.0.0
- 4.13
+ 3.23.1
+ 5.10.2
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/CustomTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/CustomTest.java
index 1ffbe4ace0923..5f93aab9399e4 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/CustomTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/CustomTest.java
@@ -11,28 +11,18 @@
*/
-package org.openapitools.client.api;
+package org.openapitools.client;
-import org.openapitools.client.ApiException;
-import java.io.File;
-import org.openapitools.client.model.Pet;
-import org.openapitools.client.model.Tag;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.openapitools.client.api.BodyApi;
+import org.openapitools.client.api.EchoServerResponseParser;
+import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
-import java.time.LocalDate;
-import java.time.OffsetDateTime;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* API tests
@@ -62,12 +52,12 @@ public void testBodyMultipartFormdataSingleBinaryTest() throws ApiException, IOE
api.testBodyMultipartFormdataSingleBinary(myFile);
EchoServerResponseParser parser =
- new EchoServerResponseParser(response);
+ new org.openapitools.client.api.EchoServerResponseParser(response);
String contentDisposition = parser.headers.get("Content-Disposition");
- assertThat(contentDisposition, containsString(
+ assertThat(contentDisposition).contains(
"form-data; name=\"my-file\"; filename=\"test.txt\""
- ));
+ );
}
}
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/AuthApiTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/AuthApiTest.java
index 17e790b761734..6a7b7a4736cea 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/AuthApiTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/AuthApiTest.java
@@ -14,9 +14,9 @@
package org.openapitools.client.api;
import org.openapitools.client.ApiException;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/BodyApiTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/BodyApiTest.java
index 3d2102e4643be..a8d0edaa3f260 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/BodyApiTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/BodyApiTest.java
@@ -13,26 +13,16 @@
package org.openapitools.client.api;
+import org.junit.jupiter.api.Test;
import org.openapitools.client.ApiException;
-import java.io.File;
-import org.openapitools.client.model.Pet;
-import org.openapitools.client.model.Tag;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.openapitools.client.api.EchoServerResponseParser;
+import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
-import java.time.LocalDate;
-import java.time.OffsetDateTime;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* API tests for BodyApi
@@ -117,9 +107,9 @@ public void testBodyMultipartFormdataSingleBinaryTest()
String contentDisposition = parser.headers.get("Content-Disposition");
- assertThat(contentDisposition, containsString(
+ assertThat(contentDisposition).contains(
"form-data; name=\"my-file\"; filename=\"test.txt\""
- ));
+ );
}
/**
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/FormApiTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/FormApiTest.java
index df8fae9511d63..564f7c35a4e52 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/FormApiTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/FormApiTest.java
@@ -14,9 +14,9 @@
package org.openapitools.client.api;
import org.openapitools.client.ApiException;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/HeaderApiTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/HeaderApiTest.java
index 9132aeb9b7819..1f2b0cbf479f5 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/HeaderApiTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/HeaderApiTest.java
@@ -15,9 +15,9 @@
import org.openapitools.client.ApiException;
import org.openapitools.client.model.StringEnumRef;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/PathApiTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/PathApiTest.java
index a48fb9c3bf3f4..f2f6763b12158 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/PathApiTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/PathApiTest.java
@@ -15,9 +15,9 @@
import org.openapitools.client.ApiException;
import org.openapitools.client.model.StringEnumRef;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/QueryApiTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/QueryApiTest.java
index a2bd6f65721b2..c6df34a18c8bc 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/QueryApiTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/QueryApiTest.java
@@ -21,9 +21,9 @@
import org.openapitools.client.model.StringEnumRef;
import org.openapitools.client.model.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter;
import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter;
-import org.junit.Test;
-import org.junit.Ignore;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import java.time.LocalDate;
import java.time.OffsetDateTime;
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/BirdTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/BirdTest.java
index 3e82e9d75535e..487f1889a98a1 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/BirdTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/BirdTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Model tests for Bird
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/CategoryTest.java
index 5b6a08fd67730..1a53a0d909830 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/CategoryTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/CategoryTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Model tests for Category
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/DataQueryTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/DataQueryTest.java
index d08082e114ed1..78b52f08ac767 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/DataQueryTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/DataQueryTest.java
@@ -23,9 +23,9 @@
import java.util.Arrays;
import java.util.List;
import org.openapitools.client.model.Query;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Model tests for DataQuery
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/DefaultValueTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/DefaultValueTest.java
index 843a43b28d72c..bfbfeaf1dadf2 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/DefaultValueTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/DefaultValueTest.java
@@ -26,9 +26,9 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Model tests for DefaultValue
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java
index 80e515fd707e7..6cad1033030f9 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java
@@ -19,9 +19,9 @@
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Model tests for NumberPropertiesOnly
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/PetTest.java
index 30e1991c7e323..e56a9b18d6e91 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/PetTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/PetTest.java
@@ -23,9 +23,9 @@
import java.util.List;
import org.openapitools.client.model.Category;
import org.openapitools.client.model.Tag;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Model tests for Pet
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/QueryTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/QueryTest.java
index 3ae0ecb7b70d6..f9affa7e67541 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/QueryTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/QueryTest.java
@@ -21,9 +21,9 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Model tests for Query
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/StringEnumRefTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/StringEnumRefTest.java
index 81bf17732bda7..9c9ddedd8adfd 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/StringEnumRefTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/StringEnumRefTest.java
@@ -13,9 +13,9 @@
package org.openapitools.client.model;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Model tests for StringEnumRef
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TagTest.java
index 073b7aca33c1e..d74de216cfab5 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TagTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TagTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Model tests for Tag
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java
index cdb7c02c0fd86..d5d0fc51cc1de 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Model tests for TestFormObjectMultipartRequestMarker
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java
index 8ab39f47d7665..d316ca8550ef1 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java
@@ -18,9 +18,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Model tests for TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java
index f3e020346fa0b..21cff973e258f 100644
--- a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java
+++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java
@@ -21,9 +21,9 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
* Model tests for TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
diff --git a/samples/client/echo_api/r/R/data_query.R b/samples/client/echo_api/r/R/data_query.R
index 0a749f98d6ede..228cd65b84670 100644
--- a/samples/client/echo_api/r/R/data_query.R
+++ b/samples/client/echo_api/r/R/data_query.R
@@ -30,13 +30,13 @@ DataQuery <- R6::R6Class(
#' Initialize a new DataQuery class.
#'
#' @param id Query
- #' @param outcomes outcomes. Default to [SUCCESS, FAILURE].
+ #' @param outcomes outcomes. Default to ["SUCCESS","FAILURE"].
#' @param suffix test suffix
#' @param text Some text containing white spaces
#' @param date A date
#' @param ... Other optional arguments.
#' @export
- initialize = function(`id` = NULL, `outcomes` = [SUCCESS, FAILURE], `suffix` = NULL, `text` = NULL, `date` = NULL, ...) {
+ initialize = function(`id` = NULL, `outcomes` = ["SUCCESS","FAILURE"], `suffix` = NULL, `text` = NULL, `date` = NULL, ...) {
if (!is.null(`id`)) {
if (!(is.numeric(`id`) && length(`id`) == 1)) {
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
diff --git a/samples/client/echo_api/r/docs/DataQuery.md b/samples/client/echo_api/r/docs/DataQuery.md
index 097f1885fe5f3..50015244dc5b1 100644
--- a/samples/client/echo_api/r/docs/DataQuery.md
+++ b/samples/client/echo_api/r/docs/DataQuery.md
@@ -5,7 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **integer** | Query | [optional]
-**outcomes** | **array[character]** | | [optional] [default to [SUCCESS, FAILURE]] [Enum: ]
+**outcomes** | **array[character]** | | [optional] [default to ["SUCCESS","FAILURE"]] [Enum: ]
**suffix** | **character** | test suffix | [optional]
**text** | **character** | Some text containing white spaces | [optional]
**date** | **character** | A date | [optional]
diff --git a/samples/client/echo_api/typescript-axios/build/package.json b/samples/client/echo_api/typescript-axios/build/package.json
index fc256cc498a57..e5d6921f72aa0 100644
--- a/samples/client/echo_api/typescript-axios/build/package.json
+++ b/samples/client/echo_api/typescript-axios/build/package.json
@@ -25,7 +25,7 @@
"axios": "^1.6.1"
},
"devDependencies": {
- "@types/node": "^12.11.5",
- "typescript": "^4.0"
+ "@types/node": "12.11.5 - 12.20.42",
+ "typescript": "^4.0 || ^5.0"
}
}
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/.gitignore b/samples/client/others/go/allof_multiple_ref_and_discriminator/.gitignore
new file mode 100644
index 0000000000000..daf913b1b347a
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/.gitignore
@@ -0,0 +1,24 @@
+# Compiled Object files, Static and Dynamic libs (Shared Objects)
+*.o
+*.a
+*.so
+
+# Folders
+_obj
+_test
+
+# Architecture specific extensions/prefixes
+*.[568vq]
+[568vq].out
+
+*.cgo1.go
+*.cgo2.c
+_cgo_defun.c
+_cgo_gotypes.go
+_cgo_export.*
+
+_testmain.go
+
+*.exe
+*.test
+*.prof
diff --git a/samples/client/petstore/java-helidon-client/mp/.openapi-generator-ignore b/samples/client/others/go/allof_multiple_ref_and_discriminator/.openapi-generator-ignore
similarity index 100%
rename from samples/client/petstore/java-helidon-client/mp/.openapi-generator-ignore
rename to samples/client/others/go/allof_multiple_ref_and_discriminator/.openapi-generator-ignore
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/.openapi-generator/FILES b/samples/client/others/go/allof_multiple_ref_and_discriminator/.openapi-generator/FILES
new file mode 100644
index 0000000000000..a4d184b4dd832
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/.openapi-generator/FILES
@@ -0,0 +1,17 @@
+.gitignore
+.travis.yml
+README.md
+api/openapi.yaml
+client.go
+configuration.go
+docs/AdditionalData.md
+docs/BaseItem.md
+docs/FinalItem.md
+git_push.sh
+go.mod
+go.sum
+model_additional_data.go
+model_base_item.go
+model_final_item.go
+response.go
+utils.go
diff --git a/samples/client/petstore/java-helidon-client/mp/.openapi-generator/VERSION b/samples/client/others/go/allof_multiple_ref_and_discriminator/.openapi-generator/VERSION
similarity index 100%
rename from samples/client/petstore/java-helidon-client/mp/.openapi-generator/VERSION
rename to samples/client/others/go/allof_multiple_ref_and_discriminator/.openapi-generator/VERSION
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/.travis.yml b/samples/client/others/go/allof_multiple_ref_and_discriminator/.travis.yml
new file mode 100644
index 0000000000000..f5cb2ce9a5aad
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/.travis.yml
@@ -0,0 +1,8 @@
+language: go
+
+install:
+ - go get -d -v .
+
+script:
+ - go build -v ./
+
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/README.md b/samples/client/others/go/allof_multiple_ref_and_discriminator/README.md
new file mode 100644
index 0000000000000..7bf4430b69869
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/README.md
@@ -0,0 +1,113 @@
+# Go API client for openapi
+
+No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+
+## Overview
+This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
+
+- API version: 1.0.0
+- Package version: 1.0.0
+- Generator version: 7.6.0-SNAPSHOT
+- Build package: org.openapitools.codegen.languages.GoClientCodegen
+
+## Installation
+
+Install the following dependencies:
+
+```sh
+go get github.com/stretchr/testify/assert
+go get golang.org/x/net/context
+```
+
+Put the package under your project folder and add the following in import:
+
+```go
+import openapi "github.com/GIT_USER_ID/GIT_REPO_ID"
+```
+
+To use a proxy, set the environment variable `HTTP_PROXY`:
+
+```go
+os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
+```
+
+## Configuration of Server URL
+
+Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification.
+
+### Select Server Configuration
+
+For using other server than the one defined on index 0 set context value `openapi.ContextServerIndex` of type `int`.
+
+```go
+ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)
+```
+
+### Templated Server URL
+
+Templated server URL is formatted using default variables from configuration or from context value `openapi.ContextServerVariables` of type `map[string]string`.
+
+```go
+ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
+ "basePath": "v2",
+})
+```
+
+Note, enum values are always validated and all unused variables are silently ignored.
+
+### URLs Configuration per Operation
+
+Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
+An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
+Similar rules for overriding default operation server index and variables applies by using `openapi.ContextOperationServerIndices` and `openapi.ContextOperationServerVariables` context maps.
+
+```go
+ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
+ "{classname}Service.{nickname}": 2,
+})
+ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
+ "{classname}Service.{nickname}": {
+ "port": "8443",
+ },
+})
+```
+
+## Documentation for API Endpoints
+
+All URIs are relative to *http://localhost*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+
+
+## Documentation For Models
+
+ - [AdditionalData](docs/AdditionalData.md)
+ - [BaseItem](docs/BaseItem.md)
+ - [FinalItem](docs/FinalItem.md)
+
+
+## Documentation For Authorization
+
+Endpoints do not require authorization.
+
+
+## Documentation for Utility Methods
+
+Due to the fact that model structure members are all pointers, this package contains
+a number of utility functions to easily obtain pointers to values of basic types.
+Each of these functions takes a value of the given basic type and returns a pointer to it:
+
+* `PtrBool`
+* `PtrInt`
+* `PtrInt32`
+* `PtrInt64`
+* `PtrFloat`
+* `PtrFloat32`
+* `PtrFloat64`
+* `PtrString`
+* `PtrTime`
+
+## Author
+
+
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/api/openapi.yaml b/samples/client/others/go/allof_multiple_ref_and_discriminator/api/openapi.yaml
new file mode 100644
index 0000000000000..e4571723e4ead
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/api/openapi.yaml
@@ -0,0 +1,56 @@
+openapi: 3.0.0
+info:
+ title: Test
+ version: 1.0.0
+servers:
+- url: /
+paths: {}
+components:
+ schemas:
+ FinalItem:
+ allOf:
+ - $ref: '#/components/schemas/base.item'
+ - $ref: '#/components/schemas/AdditionalData'
+ type: object
+ base.item:
+ discriminator:
+ mapping:
+ FINAL: '#/components/schemas/FinalItem'
+ propertyName: type
+ properties:
+ title:
+ type: string
+ type:
+ enum:
+ - FINAL
+ example: FINAL
+ type: string
+ required:
+ - title
+ - type
+ type: object
+ AdditionalData:
+ properties:
+ prop1:
+ type: string
+ quantity:
+ example: 1
+ format: int32
+ minimum: 1
+ type: integer
+ unitPrice:
+ example: 9.99
+ format: double
+ minimum: 0.0
+ type: number
+ totalPrice:
+ example: 9.99
+ format: double
+ minimum: 0.0
+ type: number
+ required:
+ - prop1
+ - quantity
+ - totalPrice
+ - unitPrice
+ type: object
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/client.go b/samples/client/others/go/allof_multiple_ref_and_discriminator/client.go
new file mode 100644
index 0000000000000..f745e46a42685
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/client.go
@@ -0,0 +1,657 @@
+/*
+Test
+
+No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+
+API version: 1.0.0
+*/
+
+// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
+
+package openapi
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "encoding/xml"
+ "errors"
+ "fmt"
+ "io"
+ "log"
+ "mime/multipart"
+ "net/http"
+ "net/http/httputil"
+ "net/url"
+ "os"
+ "path/filepath"
+ "reflect"
+ "regexp"
+ "strconv"
+ "strings"
+ "time"
+ "unicode/utf8"
+
+)
+
+var (
+ JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`)
+ XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`)
+ queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`)
+ queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" )
+)
+
+// APIClient manages communication with the Test API v1.0.0
+// In most cases there should be only one, shared, APIClient.
+type APIClient struct {
+ cfg *Configuration
+ common service // Reuse a single struct instead of allocating one for each service on the heap.
+
+ // API Services
+}
+
+type service struct {
+ client *APIClient
+}
+
+// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
+// optionally a custom http.Client to allow for advanced features such as caching.
+func NewAPIClient(cfg *Configuration) *APIClient {
+ if cfg.HTTPClient == nil {
+ cfg.HTTPClient = http.DefaultClient
+ }
+
+ c := &APIClient{}
+ c.cfg = cfg
+ c.common.client = c
+
+ // API Services
+
+ return c
+}
+
+func atoi(in string) (int, error) {
+ return strconv.Atoi(in)
+}
+
+// selectHeaderContentType select a content type from the available list.
+func selectHeaderContentType(contentTypes []string) string {
+ if len(contentTypes) == 0 {
+ return ""
+ }
+ if contains(contentTypes, "application/json") {
+ return "application/json"
+ }
+ return contentTypes[0] // use the first content type specified in 'consumes'
+}
+
+// selectHeaderAccept join all accept types and return
+func selectHeaderAccept(accepts []string) string {
+ if len(accepts) == 0 {
+ return ""
+ }
+
+ if contains(accepts, "application/json") {
+ return "application/json"
+ }
+
+ return strings.Join(accepts, ",")
+}
+
+// contains is a case insensitive match, finding needle in a haystack
+func contains(haystack []string, needle string) bool {
+ for _, a := range haystack {
+ if strings.EqualFold(a, needle) {
+ return true
+ }
+ }
+ return false
+}
+
+// Verify optional parameters are of the correct type.
+func typeCheckParameter(obj interface{}, expected string, name string) error {
+ // Make sure there is an object.
+ if obj == nil {
+ return nil
+ }
+
+ // Check the type is as expected.
+ if reflect.TypeOf(obj).String() != expected {
+ return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String())
+ }
+ return nil
+}
+
+func parameterValueToString( obj interface{}, key string ) string {
+ if reflect.TypeOf(obj).Kind() != reflect.Ptr {
+ return fmt.Sprintf("%v", obj)
+ }
+ var param,ok = obj.(MappedNullable)
+ if !ok {
+ return ""
+ }
+ dataMap,err := param.ToMap()
+ if err != nil {
+ return ""
+ }
+ return fmt.Sprintf("%v", dataMap[key])
+}
+
+// parameterAddToHeaderOrQuery adds the provided object to the request header or url query
+// supporting deep object syntax
+func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) {
+ var v = reflect.ValueOf(obj)
+ var value = ""
+ if v == reflect.ValueOf(nil) {
+ value = "null"
+ } else {
+ switch v.Kind() {
+ case reflect.Invalid:
+ value = "invalid"
+
+ case reflect.Struct:
+ if t,ok := obj.(MappedNullable); ok {
+ dataMap,err := t.ToMap()
+ if err != nil {
+ return
+ }
+ parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType)
+ return
+ }
+ if t, ok := obj.(time.Time); ok {
+ parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType)
+ return
+ }
+ value = v.Type().String() + " value"
+ case reflect.Slice:
+ var indValue = reflect.ValueOf(obj)
+ if indValue == reflect.ValueOf(nil) {
+ return
+ }
+ var lenIndValue = indValue.Len()
+ for i:=0;i 0 || (len(formFiles) > 0) {
+ if body != nil {
+ return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
+ }
+ body = &bytes.Buffer{}
+ w := multipart.NewWriter(body)
+
+ for k, v := range formParams {
+ for _, iv := range v {
+ if strings.HasPrefix(k, "@") { // file
+ err = addFile(w, k[1:], iv)
+ if err != nil {
+ return nil, err
+ }
+ } else { // form value
+ w.WriteField(k, iv)
+ }
+ }
+ }
+ for _, formFile := range formFiles {
+ if len(formFile.fileBytes) > 0 && formFile.fileName != "" {
+ w.Boundary()
+ part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName))
+ if err != nil {
+ return nil, err
+ }
+ _, err = part.Write(formFile.fileBytes)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+
+ // Set the Boundary in the Content-Type
+ headerParams["Content-Type"] = w.FormDataContentType()
+
+ // Set Content-Length
+ headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
+ w.Close()
+ }
+
+ if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 {
+ if body != nil {
+ return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.")
+ }
+ body = &bytes.Buffer{}
+ body.WriteString(formParams.Encode())
+ // Set Content-Length
+ headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
+ }
+
+ // Setup path and query parameters
+ url, err := url.Parse(path)
+ if err != nil {
+ return nil, err
+ }
+
+ // Override request host, if applicable
+ if c.cfg.Host != "" {
+ url.Host = c.cfg.Host
+ }
+
+ // Override request scheme, if applicable
+ if c.cfg.Scheme != "" {
+ url.Scheme = c.cfg.Scheme
+ }
+
+ // Adding Query Param
+ query := url.Query()
+ for k, v := range queryParams {
+ for _, iv := range v {
+ query.Add(k, iv)
+ }
+ }
+
+ // Encode the parameters.
+ url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string {
+ pieces := strings.Split(s, "=")
+ pieces[0] = queryDescape.Replace(pieces[0])
+ return strings.Join(pieces, "=")
+ })
+
+ // Generate a new request
+ if body != nil {
+ localVarRequest, err = http.NewRequest(method, url.String(), body)
+ } else {
+ localVarRequest, err = http.NewRequest(method, url.String(), nil)
+ }
+ if err != nil {
+ return nil, err
+ }
+
+ // add header parameters, if any
+ if len(headerParams) > 0 {
+ headers := http.Header{}
+ for h, v := range headerParams {
+ headers[h] = []string{v}
+ }
+ localVarRequest.Header = headers
+ }
+
+ // Add the user agent to the request.
+ localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
+
+ if ctx != nil {
+ // add context to the request
+ localVarRequest = localVarRequest.WithContext(ctx)
+
+ // Walk through any authentication.
+
+ }
+
+ for header, value := range c.cfg.DefaultHeader {
+ localVarRequest.Header.Add(header, value)
+ }
+ return localVarRequest, nil
+}
+
+func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
+ if len(b) == 0 {
+ return nil
+ }
+ if s, ok := v.(*string); ok {
+ *s = string(b)
+ return nil
+ }
+ if f, ok := v.(*os.File); ok {
+ f, err = os.CreateTemp("", "HttpClientFile")
+ if err != nil {
+ return
+ }
+ _, err = f.Write(b)
+ if err != nil {
+ return
+ }
+ _, err = f.Seek(0, io.SeekStart)
+ return
+ }
+ if f, ok := v.(**os.File); ok {
+ *f, err = os.CreateTemp("", "HttpClientFile")
+ if err != nil {
+ return
+ }
+ _, err = (*f).Write(b)
+ if err != nil {
+ return
+ }
+ _, err = (*f).Seek(0, io.SeekStart)
+ return
+ }
+ if XmlCheck.MatchString(contentType) {
+ if err = xml.Unmarshal(b, v); err != nil {
+ return err
+ }
+ return nil
+ }
+ if JsonCheck.MatchString(contentType) {
+ if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas
+ if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined
+ if err = unmarshalObj.UnmarshalJSON(b); err != nil {
+ return err
+ }
+ } else {
+ return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined")
+ }
+ } else if err = json.Unmarshal(b, v); err != nil { // simple model
+ return err
+ }
+ return nil
+ }
+ return errors.New("undefined response type")
+}
+
+// Add a file to the multipart request
+func addFile(w *multipart.Writer, fieldName, path string) error {
+ file, err := os.Open(filepath.Clean(path))
+ if err != nil {
+ return err
+ }
+ err = file.Close()
+ if err != nil {
+ return err
+ }
+
+ part, err := w.CreateFormFile(fieldName, filepath.Base(path))
+ if err != nil {
+ return err
+ }
+ _, err = io.Copy(part, file)
+
+ return err
+}
+
+// Prevent trying to import "fmt"
+func reportError(format string, a ...interface{}) error {
+ return fmt.Errorf(format, a...)
+}
+
+// A wrapper for strict JSON decoding
+func newStrictDecoder(data []byte) *json.Decoder {
+ dec := json.NewDecoder(bytes.NewBuffer(data))
+ dec.DisallowUnknownFields()
+ return dec
+}
+
+// Set request body from an interface{}
+func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
+ if bodyBuf == nil {
+ bodyBuf = &bytes.Buffer{}
+ }
+
+ if reader, ok := body.(io.Reader); ok {
+ _, err = bodyBuf.ReadFrom(reader)
+ } else if fp, ok := body.(*os.File); ok {
+ _, err = bodyBuf.ReadFrom(fp)
+ } else if b, ok := body.([]byte); ok {
+ _, err = bodyBuf.Write(b)
+ } else if s, ok := body.(string); ok {
+ _, err = bodyBuf.WriteString(s)
+ } else if s, ok := body.(*string); ok {
+ _, err = bodyBuf.WriteString(*s)
+ } else if JsonCheck.MatchString(contentType) {
+ err = json.NewEncoder(bodyBuf).Encode(body)
+ } else if XmlCheck.MatchString(contentType) {
+ var bs []byte
+ bs, err = xml.Marshal(body)
+ if err == nil {
+ bodyBuf.Write(bs)
+ }
+ }
+
+ if err != nil {
+ return nil, err
+ }
+
+ if bodyBuf.Len() == 0 {
+ err = fmt.Errorf("invalid body type %s\n", contentType)
+ return nil, err
+ }
+ return bodyBuf, nil
+}
+
+// detectContentType method is used to figure out `Request.Body` content type for request header
+func detectContentType(body interface{}) string {
+ contentType := "text/plain; charset=utf-8"
+ kind := reflect.TypeOf(body).Kind()
+
+ switch kind {
+ case reflect.Struct, reflect.Map, reflect.Ptr:
+ contentType = "application/json; charset=utf-8"
+ case reflect.String:
+ contentType = "text/plain; charset=utf-8"
+ default:
+ if b, ok := body.([]byte); ok {
+ contentType = http.DetectContentType(b)
+ } else if kind == reflect.Slice {
+ contentType = "application/json; charset=utf-8"
+ }
+ }
+
+ return contentType
+}
+
+// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
+type cacheControl map[string]string
+
+func parseCacheControl(headers http.Header) cacheControl {
+ cc := cacheControl{}
+ ccHeader := headers.Get("Cache-Control")
+ for _, part := range strings.Split(ccHeader, ",") {
+ part = strings.Trim(part, " ")
+ if part == "" {
+ continue
+ }
+ if strings.ContainsRune(part, '=') {
+ keyval := strings.Split(part, "=")
+ cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
+ } else {
+ cc[part] = ""
+ }
+ }
+ return cc
+}
+
+// CacheExpires helper function to determine remaining time before repeating a request.
+func CacheExpires(r *http.Response) time.Time {
+ // Figure out when the cache expires.
+ var expires time.Time
+ now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
+ if err != nil {
+ return time.Now()
+ }
+ respCacheControl := parseCacheControl(r.Header)
+
+ if maxAge, ok := respCacheControl["max-age"]; ok {
+ lifetime, err := time.ParseDuration(maxAge + "s")
+ if err != nil {
+ expires = now
+ } else {
+ expires = now.Add(lifetime)
+ }
+ } else {
+ expiresHeader := r.Header.Get("Expires")
+ if expiresHeader != "" {
+ expires, err = time.Parse(time.RFC1123, expiresHeader)
+ if err != nil {
+ expires = now
+ }
+ }
+ }
+ return expires
+}
+
+func strlen(s string) int {
+ return utf8.RuneCountInString(s)
+}
+
+// GenericOpenAPIError Provides access to the body, error and model on returned errors.
+type GenericOpenAPIError struct {
+ body []byte
+ error string
+ model interface{}
+}
+
+// Error returns non-empty string if there was an error.
+func (e GenericOpenAPIError) Error() string {
+ return e.error
+}
+
+// Body returns the raw bytes of the response
+func (e GenericOpenAPIError) Body() []byte {
+ return e.body
+}
+
+// Model returns the unpacked model of the error
+func (e GenericOpenAPIError) Model() interface{} {
+ return e.model
+}
+
+// format error message using title and detail when model implements rfc7807
+func formatErrorMessage(status string, v interface{}) string {
+ str := ""
+ metaValue := reflect.ValueOf(v).Elem()
+
+ if metaValue.Kind() == reflect.Struct {
+ field := metaValue.FieldByName("Title")
+ if field != (reflect.Value{}) {
+ str = fmt.Sprintf("%s", field.Interface())
+ }
+
+ field = metaValue.FieldByName("Detail")
+ if field != (reflect.Value{}) {
+ str = fmt.Sprintf("%s (%s)", str, field.Interface())
+ }
+ }
+
+ return strings.TrimSpace(fmt.Sprintf("%s %s", status, str))
+}
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/configuration.go b/samples/client/others/go/allof_multiple_ref_and_discriminator/configuration.go
new file mode 100644
index 0000000000000..c3b676ba005e9
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/configuration.go
@@ -0,0 +1,215 @@
+/*
+Test
+
+No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+
+API version: 1.0.0
+*/
+
+// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
+
+package openapi
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "strings"
+)
+
+// contextKeys are used to identify the type of value in the context.
+// Since these are string, it is possible to get a short description of the
+// context key for logging and debugging using key.String().
+
+type contextKey string
+
+func (c contextKey) String() string {
+ return "auth " + string(c)
+}
+
+var (
+ // ContextServerIndex uses a server configuration from the index.
+ ContextServerIndex = contextKey("serverIndex")
+
+ // ContextOperationServerIndices uses a server configuration from the index mapping.
+ ContextOperationServerIndices = contextKey("serverOperationIndices")
+
+ // ContextServerVariables overrides a server configuration variables.
+ ContextServerVariables = contextKey("serverVariables")
+
+ // ContextOperationServerVariables overrides a server configuration variables using operation specific values.
+ ContextOperationServerVariables = contextKey("serverOperationVariables")
+)
+
+// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
+type BasicAuth struct {
+ UserName string `json:"userName,omitempty"`
+ Password string `json:"password,omitempty"`
+}
+
+// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
+type APIKey struct {
+ Key string
+ Prefix string
+}
+
+// ServerVariable stores the information about a server variable
+type ServerVariable struct {
+ Description string
+ DefaultValue string
+ EnumValues []string
+}
+
+// ServerConfiguration stores the information about a server
+type ServerConfiguration struct {
+ URL string
+ Description string
+ Variables map[string]ServerVariable
+}
+
+// ServerConfigurations stores multiple ServerConfiguration items
+type ServerConfigurations []ServerConfiguration
+
+// Configuration stores the configuration of the API client
+type Configuration struct {
+ Host string `json:"host,omitempty"`
+ Scheme string `json:"scheme,omitempty"`
+ DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
+ UserAgent string `json:"userAgent,omitempty"`
+ Debug bool `json:"debug,omitempty"`
+ Servers ServerConfigurations
+ OperationServers map[string]ServerConfigurations
+ HTTPClient *http.Client
+}
+
+// NewConfiguration returns a new Configuration object
+func NewConfiguration() *Configuration {
+ cfg := &Configuration{
+ DefaultHeader: make(map[string]string),
+ UserAgent: "OpenAPI-Generator/1.0.0/go",
+ Debug: false,
+ Servers: ServerConfigurations{
+ {
+ URL: "",
+ Description: "No description provided",
+ },
+ },
+ OperationServers: map[string]ServerConfigurations{
+ },
+ }
+ return cfg
+}
+
+// AddDefaultHeader adds a new HTTP header to the default header in the request
+func (c *Configuration) AddDefaultHeader(key string, value string) {
+ c.DefaultHeader[key] = value
+}
+
+// URL formats template on a index using given variables
+func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) {
+ if index < 0 || len(sc) <= index {
+ return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1)
+ }
+ server := sc[index]
+ url := server.URL
+
+ // go through variables and replace placeholders
+ for name, variable := range server.Variables {
+ if value, ok := variables[name]; ok {
+ found := bool(len(variable.EnumValues) == 0)
+ for _, enumValue := range variable.EnumValues {
+ if value == enumValue {
+ found = true
+ }
+ }
+ if !found {
+ return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues)
+ }
+ url = strings.Replace(url, "{"+name+"}", value, -1)
+ } else {
+ url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1)
+ }
+ }
+ return url, nil
+}
+
+// ServerURL returns URL based on server settings
+func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) {
+ return c.Servers.URL(index, variables)
+}
+
+func getServerIndex(ctx context.Context) (int, error) {
+ si := ctx.Value(ContextServerIndex)
+ if si != nil {
+ if index, ok := si.(int); ok {
+ return index, nil
+ }
+ return 0, reportError("Invalid type %T should be int", si)
+ }
+ return 0, nil
+}
+
+func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) {
+ osi := ctx.Value(ContextOperationServerIndices)
+ if osi != nil {
+ if operationIndices, ok := osi.(map[string]int); !ok {
+ return 0, reportError("Invalid type %T should be map[string]int", osi)
+ } else {
+ index, ok := operationIndices[endpoint]
+ if ok {
+ return index, nil
+ }
+ }
+ }
+ return getServerIndex(ctx)
+}
+
+func getServerVariables(ctx context.Context) (map[string]string, error) {
+ sv := ctx.Value(ContextServerVariables)
+ if sv != nil {
+ if variables, ok := sv.(map[string]string); ok {
+ return variables, nil
+ }
+ return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv)
+ }
+ return nil, nil
+}
+
+func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) {
+ osv := ctx.Value(ContextOperationServerVariables)
+ if osv != nil {
+ if operationVariables, ok := osv.(map[string]map[string]string); !ok {
+ return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv)
+ } else {
+ variables, ok := operationVariables[endpoint]
+ if ok {
+ return variables, nil
+ }
+ }
+ }
+ return getServerVariables(ctx)
+}
+
+// ServerURLWithContext returns a new server URL given an endpoint
+func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) {
+ sc, ok := c.OperationServers[endpoint]
+ if !ok {
+ sc = c.Servers
+ }
+
+ if ctx == nil {
+ return sc.URL(0, nil)
+ }
+
+ index, err := getServerOperationIndex(ctx, endpoint)
+ if err != nil {
+ return "", err
+ }
+
+ variables, err := getServerOperationVariables(ctx, endpoint)
+ if err != nil {
+ return "", err
+ }
+
+ return sc.URL(index, variables)
+}
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/docs/AdditionalData.md b/samples/client/others/go/allof_multiple_ref_and_discriminator/docs/AdditionalData.md
new file mode 100644
index 0000000000000..5f4bb21a8e5a4
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/docs/AdditionalData.md
@@ -0,0 +1,114 @@
+# AdditionalData
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Prop1** | **string** | |
+**Quantity** | **int32** | |
+**UnitPrice** | **float64** | |
+**TotalPrice** | **float64** | |
+
+## Methods
+
+### NewAdditionalData
+
+`func NewAdditionalData(prop1 string, quantity int32, unitPrice float64, totalPrice float64, ) *AdditionalData`
+
+NewAdditionalData instantiates a new AdditionalData object
+This constructor will assign default values to properties that have it defined,
+and makes sure properties required by API are set, but the set of arguments
+will change when the set of required properties is changed
+
+### NewAdditionalDataWithDefaults
+
+`func NewAdditionalDataWithDefaults() *AdditionalData`
+
+NewAdditionalDataWithDefaults instantiates a new AdditionalData object
+This constructor will only assign default values to properties that have it defined,
+but it doesn't guarantee that properties required by API are set
+
+### GetProp1
+
+`func (o *AdditionalData) GetProp1() string`
+
+GetProp1 returns the Prop1 field if non-nil, zero value otherwise.
+
+### GetProp1Ok
+
+`func (o *AdditionalData) GetProp1Ok() (*string, bool)`
+
+GetProp1Ok returns a tuple with the Prop1 field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetProp1
+
+`func (o *AdditionalData) SetProp1(v string)`
+
+SetProp1 sets Prop1 field to given value.
+
+
+### GetQuantity
+
+`func (o *AdditionalData) GetQuantity() int32`
+
+GetQuantity returns the Quantity field if non-nil, zero value otherwise.
+
+### GetQuantityOk
+
+`func (o *AdditionalData) GetQuantityOk() (*int32, bool)`
+
+GetQuantityOk returns a tuple with the Quantity field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetQuantity
+
+`func (o *AdditionalData) SetQuantity(v int32)`
+
+SetQuantity sets Quantity field to given value.
+
+
+### GetUnitPrice
+
+`func (o *AdditionalData) GetUnitPrice() float64`
+
+GetUnitPrice returns the UnitPrice field if non-nil, zero value otherwise.
+
+### GetUnitPriceOk
+
+`func (o *AdditionalData) GetUnitPriceOk() (*float64, bool)`
+
+GetUnitPriceOk returns a tuple with the UnitPrice field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetUnitPrice
+
+`func (o *AdditionalData) SetUnitPrice(v float64)`
+
+SetUnitPrice sets UnitPrice field to given value.
+
+
+### GetTotalPrice
+
+`func (o *AdditionalData) GetTotalPrice() float64`
+
+GetTotalPrice returns the TotalPrice field if non-nil, zero value otherwise.
+
+### GetTotalPriceOk
+
+`func (o *AdditionalData) GetTotalPriceOk() (*float64, bool)`
+
+GetTotalPriceOk returns a tuple with the TotalPrice field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetTotalPrice
+
+`func (o *AdditionalData) SetTotalPrice(v float64)`
+
+SetTotalPrice sets TotalPrice field to given value.
+
+
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/docs/BaseItem.md b/samples/client/others/go/allof_multiple_ref_and_discriminator/docs/BaseItem.md
new file mode 100644
index 0000000000000..cccf13906647a
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/docs/BaseItem.md
@@ -0,0 +1,72 @@
+# BaseItem
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Title** | **string** | |
+**Type** | **string** | |
+
+## Methods
+
+### NewBaseItem
+
+`func NewBaseItem(title string, type_ string, ) *BaseItem`
+
+NewBaseItem instantiates a new BaseItem object
+This constructor will assign default values to properties that have it defined,
+and makes sure properties required by API are set, but the set of arguments
+will change when the set of required properties is changed
+
+### NewBaseItemWithDefaults
+
+`func NewBaseItemWithDefaults() *BaseItem`
+
+NewBaseItemWithDefaults instantiates a new BaseItem object
+This constructor will only assign default values to properties that have it defined,
+but it doesn't guarantee that properties required by API are set
+
+### GetTitle
+
+`func (o *BaseItem) GetTitle() string`
+
+GetTitle returns the Title field if non-nil, zero value otherwise.
+
+### GetTitleOk
+
+`func (o *BaseItem) GetTitleOk() (*string, bool)`
+
+GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetTitle
+
+`func (o *BaseItem) SetTitle(v string)`
+
+SetTitle sets Title field to given value.
+
+
+### GetType
+
+`func (o *BaseItem) GetType() string`
+
+GetType returns the Type field if non-nil, zero value otherwise.
+
+### GetTypeOk
+
+`func (o *BaseItem) GetTypeOk() (*string, bool)`
+
+GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetType
+
+`func (o *BaseItem) SetType(v string)`
+
+SetType sets Type field to given value.
+
+
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/docs/FinalItem.md b/samples/client/others/go/allof_multiple_ref_and_discriminator/docs/FinalItem.md
new file mode 100644
index 0000000000000..9054848df9eb6
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/docs/FinalItem.md
@@ -0,0 +1,114 @@
+# FinalItem
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Prop1** | **string** | |
+**Quantity** | **int32** | |
+**UnitPrice** | **float64** | |
+**TotalPrice** | **float64** | |
+
+## Methods
+
+### NewFinalItem
+
+`func NewFinalItem(prop1 string, quantity int32, unitPrice float64, totalPrice float64, ) *FinalItem`
+
+NewFinalItem instantiates a new FinalItem object
+This constructor will assign default values to properties that have it defined,
+and makes sure properties required by API are set, but the set of arguments
+will change when the set of required properties is changed
+
+### NewFinalItemWithDefaults
+
+`func NewFinalItemWithDefaults() *FinalItem`
+
+NewFinalItemWithDefaults instantiates a new FinalItem object
+This constructor will only assign default values to properties that have it defined,
+but it doesn't guarantee that properties required by API are set
+
+### GetProp1
+
+`func (o *FinalItem) GetProp1() string`
+
+GetProp1 returns the Prop1 field if non-nil, zero value otherwise.
+
+### GetProp1Ok
+
+`func (o *FinalItem) GetProp1Ok() (*string, bool)`
+
+GetProp1Ok returns a tuple with the Prop1 field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetProp1
+
+`func (o *FinalItem) SetProp1(v string)`
+
+SetProp1 sets Prop1 field to given value.
+
+
+### GetQuantity
+
+`func (o *FinalItem) GetQuantity() int32`
+
+GetQuantity returns the Quantity field if non-nil, zero value otherwise.
+
+### GetQuantityOk
+
+`func (o *FinalItem) GetQuantityOk() (*int32, bool)`
+
+GetQuantityOk returns a tuple with the Quantity field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetQuantity
+
+`func (o *FinalItem) SetQuantity(v int32)`
+
+SetQuantity sets Quantity field to given value.
+
+
+### GetUnitPrice
+
+`func (o *FinalItem) GetUnitPrice() float64`
+
+GetUnitPrice returns the UnitPrice field if non-nil, zero value otherwise.
+
+### GetUnitPriceOk
+
+`func (o *FinalItem) GetUnitPriceOk() (*float64, bool)`
+
+GetUnitPriceOk returns a tuple with the UnitPrice field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetUnitPrice
+
+`func (o *FinalItem) SetUnitPrice(v float64)`
+
+SetUnitPrice sets UnitPrice field to given value.
+
+
+### GetTotalPrice
+
+`func (o *FinalItem) GetTotalPrice() float64`
+
+GetTotalPrice returns the TotalPrice field if non-nil, zero value otherwise.
+
+### GetTotalPriceOk
+
+`func (o *FinalItem) GetTotalPriceOk() (*float64, bool)`
+
+GetTotalPriceOk returns a tuple with the TotalPrice field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetTotalPrice
+
+`func (o *FinalItem) SetTotalPrice(v float64)`
+
+SetTotalPrice sets TotalPrice field to given value.
+
+
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/git_push.sh b/samples/client/others/go/allof_multiple_ref_and_discriminator/git_push.sh
new file mode 100644
index 0000000000000..f53a75d4fabe7
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/git_push.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
+#
+# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
+
+git_user_id=$1
+git_repo_id=$2
+release_note=$3
+git_host=$4
+
+if [ "$git_host" = "" ]; then
+ git_host="github.com"
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
+fi
+
+if [ "$git_user_id" = "" ]; then
+ git_user_id="GIT_USER_ID"
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
+fi
+
+if [ "$git_repo_id" = "" ]; then
+ git_repo_id="GIT_REPO_ID"
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
+fi
+
+if [ "$release_note" = "" ]; then
+ release_note="Minor update"
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
+fi
+
+# Initialize the local directory as a Git repository
+git init
+
+# Adds the files in the local repository and stages them for commit.
+git add .
+
+# Commits the tracked changes and prepares them to be pushed to a remote repository.
+git commit -m "$release_note"
+
+# Sets the new remote
+git_remote=$(git remote)
+if [ "$git_remote" = "" ]; then # git remote not defined
+
+ if [ "$GIT_TOKEN" = "" ]; then
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
+ else
+ git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
+ fi
+
+fi
+
+git pull origin master
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/go.mod b/samples/client/others/go/allof_multiple_ref_and_discriminator/go.mod
new file mode 100644
index 0000000000000..7fca7eee925b0
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/go.mod
@@ -0,0 +1,6 @@
+module github.com/GIT_USER_ID/GIT_REPO_ID
+
+go 1.18
+
+require (
+)
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/go.sum b/samples/client/others/go/allof_multiple_ref_and_discriminator/go.sum
new file mode 100644
index 0000000000000..c966c8ddfd0dc
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/go.sum
@@ -0,0 +1,11 @@
+cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
+golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
+google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/model_additional_data.go b/samples/client/others/go/allof_multiple_ref_and_discriminator/model_additional_data.go
new file mode 100644
index 0000000000000..a7186d87f51fe
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/model_additional_data.go
@@ -0,0 +1,242 @@
+/*
+Test
+
+No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+
+API version: 1.0.0
+*/
+
+// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
+
+package openapi
+
+import (
+ "encoding/json"
+ "bytes"
+ "fmt"
+)
+
+// checks if the AdditionalData type satisfies the MappedNullable interface at compile time
+var _ MappedNullable = &AdditionalData{}
+
+// AdditionalData struct for AdditionalData
+type AdditionalData struct {
+ Prop1 string `json:"prop1"`
+ Quantity int32 `json:"quantity"`
+ UnitPrice float64 `json:"unitPrice"`
+ TotalPrice float64 `json:"totalPrice"`
+}
+
+type _AdditionalData AdditionalData
+
+// NewAdditionalData instantiates a new AdditionalData object
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed
+func NewAdditionalData(prop1 string, quantity int32, unitPrice float64, totalPrice float64) *AdditionalData {
+ this := AdditionalData{}
+ this.Prop1 = prop1
+ this.Quantity = quantity
+ this.UnitPrice = unitPrice
+ this.TotalPrice = totalPrice
+ return &this
+}
+
+// NewAdditionalDataWithDefaults instantiates a new AdditionalData object
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set
+func NewAdditionalDataWithDefaults() *AdditionalData {
+ this := AdditionalData{}
+ return &this
+}
+
+// GetProp1 returns the Prop1 field value
+func (o *AdditionalData) GetProp1() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+
+ return o.Prop1
+}
+
+// GetProp1Ok returns a tuple with the Prop1 field value
+// and a boolean to check if the value has been set.
+func (o *AdditionalData) GetProp1Ok() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Prop1, true
+}
+
+// SetProp1 sets field value
+func (o *AdditionalData) SetProp1(v string) {
+ o.Prop1 = v
+}
+
+// GetQuantity returns the Quantity field value
+func (o *AdditionalData) GetQuantity() int32 {
+ if o == nil {
+ var ret int32
+ return ret
+ }
+
+ return o.Quantity
+}
+
+// GetQuantityOk returns a tuple with the Quantity field value
+// and a boolean to check if the value has been set.
+func (o *AdditionalData) GetQuantityOk() (*int32, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Quantity, true
+}
+
+// SetQuantity sets field value
+func (o *AdditionalData) SetQuantity(v int32) {
+ o.Quantity = v
+}
+
+// GetUnitPrice returns the UnitPrice field value
+func (o *AdditionalData) GetUnitPrice() float64 {
+ if o == nil {
+ var ret float64
+ return ret
+ }
+
+ return o.UnitPrice
+}
+
+// GetUnitPriceOk returns a tuple with the UnitPrice field value
+// and a boolean to check if the value has been set.
+func (o *AdditionalData) GetUnitPriceOk() (*float64, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.UnitPrice, true
+}
+
+// SetUnitPrice sets field value
+func (o *AdditionalData) SetUnitPrice(v float64) {
+ o.UnitPrice = v
+}
+
+// GetTotalPrice returns the TotalPrice field value
+func (o *AdditionalData) GetTotalPrice() float64 {
+ if o == nil {
+ var ret float64
+ return ret
+ }
+
+ return o.TotalPrice
+}
+
+// GetTotalPriceOk returns a tuple with the TotalPrice field value
+// and a boolean to check if the value has been set.
+func (o *AdditionalData) GetTotalPriceOk() (*float64, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.TotalPrice, true
+}
+
+// SetTotalPrice sets field value
+func (o *AdditionalData) SetTotalPrice(v float64) {
+ o.TotalPrice = v
+}
+
+func (o AdditionalData) MarshalJSON() ([]byte, error) {
+ toSerialize,err := o.ToMap()
+ if err != nil {
+ return []byte{}, err
+ }
+ return json.Marshal(toSerialize)
+}
+
+func (o AdditionalData) ToMap() (map[string]interface{}, error) {
+ toSerialize := map[string]interface{}{}
+ toSerialize["prop1"] = o.Prop1
+ toSerialize["quantity"] = o.Quantity
+ toSerialize["unitPrice"] = o.UnitPrice
+ toSerialize["totalPrice"] = o.TotalPrice
+ return toSerialize, nil
+}
+
+func (o *AdditionalData) UnmarshalJSON(data []byte) (err error) {
+ // This validates that all required properties are included in the JSON object
+ // by unmarshalling the object into a generic map with string keys and checking
+ // that every required field exists as a key in the generic map.
+ requiredProperties := []string{
+ "prop1",
+ "quantity",
+ "unitPrice",
+ "totalPrice",
+ }
+
+ allProperties := make(map[string]interface{})
+
+ err = json.Unmarshal(data, &allProperties)
+
+ if err != nil {
+ return err;
+ }
+
+ for _, requiredProperty := range(requiredProperties) {
+ if _, exists := allProperties[requiredProperty]; !exists {
+ return fmt.Errorf("no value given for required property %v", requiredProperty)
+ }
+ }
+
+ varAdditionalData := _AdditionalData{}
+
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varAdditionalData)
+
+ if err != nil {
+ return err
+ }
+
+ *o = AdditionalData(varAdditionalData)
+
+ return err
+}
+
+type NullableAdditionalData struct {
+ value *AdditionalData
+ isSet bool
+}
+
+func (v NullableAdditionalData) Get() *AdditionalData {
+ return v.value
+}
+
+func (v *NullableAdditionalData) Set(val *AdditionalData) {
+ v.value = val
+ v.isSet = true
+}
+
+func (v NullableAdditionalData) IsSet() bool {
+ return v.isSet
+}
+
+func (v *NullableAdditionalData) Unset() {
+ v.value = nil
+ v.isSet = false
+}
+
+func NewNullableAdditionalData(val *AdditionalData) *NullableAdditionalData {
+ return &NullableAdditionalData{value: val, isSet: true}
+}
+
+func (v NullableAdditionalData) MarshalJSON() ([]byte, error) {
+ return json.Marshal(v.value)
+}
+
+func (v *NullableAdditionalData) UnmarshalJSON(src []byte) error {
+ v.isSet = true
+ return json.Unmarshal(src, &v.value)
+}
+
+
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/model_base_item.go b/samples/client/others/go/allof_multiple_ref_and_discriminator/model_base_item.go
new file mode 100644
index 0000000000000..96d4179808c93
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/model_base_item.go
@@ -0,0 +1,186 @@
+/*
+Test
+
+No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+
+API version: 1.0.0
+*/
+
+// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
+
+package openapi
+
+import (
+ "encoding/json"
+ "bytes"
+ "fmt"
+)
+
+// checks if the BaseItem type satisfies the MappedNullable interface at compile time
+var _ MappedNullable = &BaseItem{}
+
+// BaseItem struct for BaseItem
+type BaseItem struct {
+ Title string `json:"title"`
+ Type string `json:"type"`
+}
+
+type _BaseItem BaseItem
+
+// NewBaseItem instantiates a new BaseItem object
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed
+func NewBaseItem(title string, type_ string) *BaseItem {
+ this := BaseItem{}
+ this.Title = title
+ this.Type = type_
+ return &this
+}
+
+// NewBaseItemWithDefaults instantiates a new BaseItem object
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set
+func NewBaseItemWithDefaults() *BaseItem {
+ this := BaseItem{}
+ return &this
+}
+
+// GetTitle returns the Title field value
+func (o *BaseItem) GetTitle() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+
+ return o.Title
+}
+
+// GetTitleOk returns a tuple with the Title field value
+// and a boolean to check if the value has been set.
+func (o *BaseItem) GetTitleOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Title, true
+}
+
+// SetTitle sets field value
+func (o *BaseItem) SetTitle(v string) {
+ o.Title = v
+}
+
+// GetType returns the Type field value
+func (o *BaseItem) GetType() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+
+ return o.Type
+}
+
+// GetTypeOk returns a tuple with the Type field value
+// and a boolean to check if the value has been set.
+func (o *BaseItem) GetTypeOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Type, true
+}
+
+// SetType sets field value
+func (o *BaseItem) SetType(v string) {
+ o.Type = v
+}
+
+func (o BaseItem) MarshalJSON() ([]byte, error) {
+ toSerialize,err := o.ToMap()
+ if err != nil {
+ return []byte{}, err
+ }
+ return json.Marshal(toSerialize)
+}
+
+func (o BaseItem) ToMap() (map[string]interface{}, error) {
+ toSerialize := map[string]interface{}{}
+ toSerialize["title"] = o.Title
+ toSerialize["type"] = o.Type
+ return toSerialize, nil
+}
+
+func (o *BaseItem) UnmarshalJSON(data []byte) (err error) {
+ // This validates that all required properties are included in the JSON object
+ // by unmarshalling the object into a generic map with string keys and checking
+ // that every required field exists as a key in the generic map.
+ requiredProperties := []string{
+ "title",
+ "type",
+ }
+
+ allProperties := make(map[string]interface{})
+
+ err = json.Unmarshal(data, &allProperties)
+
+ if err != nil {
+ return err;
+ }
+
+ for _, requiredProperty := range(requiredProperties) {
+ if _, exists := allProperties[requiredProperty]; !exists {
+ return fmt.Errorf("no value given for required property %v", requiredProperty)
+ }
+ }
+
+ varBaseItem := _BaseItem{}
+
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varBaseItem)
+
+ if err != nil {
+ return err
+ }
+
+ *o = BaseItem(varBaseItem)
+
+ return err
+}
+
+type NullableBaseItem struct {
+ value *BaseItem
+ isSet bool
+}
+
+func (v NullableBaseItem) Get() *BaseItem {
+ return v.value
+}
+
+func (v *NullableBaseItem) Set(val *BaseItem) {
+ v.value = val
+ v.isSet = true
+}
+
+func (v NullableBaseItem) IsSet() bool {
+ return v.isSet
+}
+
+func (v *NullableBaseItem) Unset() {
+ v.value = nil
+ v.isSet = false
+}
+
+func NewNullableBaseItem(val *BaseItem) *NullableBaseItem {
+ return &NullableBaseItem{value: val, isSet: true}
+}
+
+func (v NullableBaseItem) MarshalJSON() ([]byte, error) {
+ return json.Marshal(v.value)
+}
+
+func (v *NullableBaseItem) UnmarshalJSON(src []byte) error {
+ v.isSet = true
+ return json.Unmarshal(src, &v.value)
+}
+
+
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/model_final_item.go b/samples/client/others/go/allof_multiple_ref_and_discriminator/model_final_item.go
new file mode 100644
index 0000000000000..d3845f84998fb
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/model_final_item.go
@@ -0,0 +1,247 @@
+/*
+Test
+
+No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+
+API version: 1.0.0
+*/
+
+// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
+
+package openapi
+
+import (
+ "encoding/json"
+ "bytes"
+ "fmt"
+)
+
+// checks if the FinalItem type satisfies the MappedNullable interface at compile time
+var _ MappedNullable = &FinalItem{}
+
+// FinalItem struct for FinalItem
+type FinalItem struct {
+ BaseItem
+ Prop1 string `json:"prop1"`
+ Quantity int32 `json:"quantity"`
+ UnitPrice float64 `json:"unitPrice"`
+ TotalPrice float64 `json:"totalPrice"`
+}
+
+type _FinalItem FinalItem
+
+// NewFinalItem instantiates a new FinalItem object
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed
+func NewFinalItem(prop1 string, quantity int32, unitPrice float64, totalPrice float64, title string, type_ string) *FinalItem {
+ this := FinalItem{}
+ this.Title = title
+ this.Type = type_
+ this.Prop1 = prop1
+ this.Quantity = quantity
+ this.UnitPrice = unitPrice
+ this.TotalPrice = totalPrice
+ return &this
+}
+
+// NewFinalItemWithDefaults instantiates a new FinalItem object
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set
+func NewFinalItemWithDefaults() *FinalItem {
+ this := FinalItem{}
+ return &this
+}
+
+// GetProp1 returns the Prop1 field value
+func (o *FinalItem) GetProp1() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+
+ return o.Prop1
+}
+
+// GetProp1Ok returns a tuple with the Prop1 field value
+// and a boolean to check if the value has been set.
+func (o *FinalItem) GetProp1Ok() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Prop1, true
+}
+
+// SetProp1 sets field value
+func (o *FinalItem) SetProp1(v string) {
+ o.Prop1 = v
+}
+
+// GetQuantity returns the Quantity field value
+func (o *FinalItem) GetQuantity() int32 {
+ if o == nil {
+ var ret int32
+ return ret
+ }
+
+ return o.Quantity
+}
+
+// GetQuantityOk returns a tuple with the Quantity field value
+// and a boolean to check if the value has been set.
+func (o *FinalItem) GetQuantityOk() (*int32, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Quantity, true
+}
+
+// SetQuantity sets field value
+func (o *FinalItem) SetQuantity(v int32) {
+ o.Quantity = v
+}
+
+// GetUnitPrice returns the UnitPrice field value
+func (o *FinalItem) GetUnitPrice() float64 {
+ if o == nil {
+ var ret float64
+ return ret
+ }
+
+ return o.UnitPrice
+}
+
+// GetUnitPriceOk returns a tuple with the UnitPrice field value
+// and a boolean to check if the value has been set.
+func (o *FinalItem) GetUnitPriceOk() (*float64, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.UnitPrice, true
+}
+
+// SetUnitPrice sets field value
+func (o *FinalItem) SetUnitPrice(v float64) {
+ o.UnitPrice = v
+}
+
+// GetTotalPrice returns the TotalPrice field value
+func (o *FinalItem) GetTotalPrice() float64 {
+ if o == nil {
+ var ret float64
+ return ret
+ }
+
+ return o.TotalPrice
+}
+
+// GetTotalPriceOk returns a tuple with the TotalPrice field value
+// and a boolean to check if the value has been set.
+func (o *FinalItem) GetTotalPriceOk() (*float64, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.TotalPrice, true
+}
+
+// SetTotalPrice sets field value
+func (o *FinalItem) SetTotalPrice(v float64) {
+ o.TotalPrice = v
+}
+
+func (o FinalItem) MarshalJSON() ([]byte, error) {
+ toSerialize,err := o.ToMap()
+ if err != nil {
+ return []byte{}, err
+ }
+ return json.Marshal(toSerialize)
+}
+
+func (o FinalItem) ToMap() (map[string]interface{}, error) {
+ toSerialize := map[string]interface{}{}
+ toSerialize["prop1"] = o.Prop1
+ toSerialize["quantity"] = o.Quantity
+ toSerialize["unitPrice"] = o.UnitPrice
+ toSerialize["totalPrice"] = o.TotalPrice
+ return toSerialize, nil
+}
+
+func (o *FinalItem) UnmarshalJSON(data []byte) (err error) {
+ // This validates that all required properties are included in the JSON object
+ // by unmarshalling the object into a generic map with string keys and checking
+ // that every required field exists as a key in the generic map.
+ requiredProperties := []string{
+ "prop1",
+ "quantity",
+ "unitPrice",
+ "totalPrice",
+ "title",
+ "type",
+ }
+
+ allProperties := make(map[string]interface{})
+
+ err = json.Unmarshal(data, &allProperties)
+
+ if err != nil {
+ return err;
+ }
+
+ for _, requiredProperty := range(requiredProperties) {
+ if _, exists := allProperties[requiredProperty]; !exists {
+ return fmt.Errorf("no value given for required property %v", requiredProperty)
+ }
+ }
+
+ varFinalItem := _FinalItem{}
+
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varFinalItem)
+
+ if err != nil {
+ return err
+ }
+
+ *o = FinalItem(varFinalItem)
+
+ return err
+}
+
+type NullableFinalItem struct {
+ value *FinalItem
+ isSet bool
+}
+
+func (v NullableFinalItem) Get() *FinalItem {
+ return v.value
+}
+
+func (v *NullableFinalItem) Set(val *FinalItem) {
+ v.value = val
+ v.isSet = true
+}
+
+func (v NullableFinalItem) IsSet() bool {
+ return v.isSet
+}
+
+func (v *NullableFinalItem) Unset() {
+ v.value = nil
+ v.isSet = false
+}
+
+func NewNullableFinalItem(val *FinalItem) *NullableFinalItem {
+ return &NullableFinalItem{value: val, isSet: true}
+}
+
+func (v NullableFinalItem) MarshalJSON() ([]byte, error) {
+ return json.Marshal(v.value)
+}
+
+func (v *NullableFinalItem) UnmarshalJSON(src []byte) error {
+ v.isSet = true
+ return json.Unmarshal(src, &v.value)
+}
+
+
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/pom.xml b/samples/client/others/go/allof_multiple_ref_and_discriminator/pom.xml
new file mode 100644
index 0000000000000..5a6af72f2546f
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/pom.xml
@@ -0,0 +1,89 @@
+
+ 4.0.0
+ org.openapitools
+ GoAllOfRefWithDiscriminator
+ pom
+ 1.0.0
+ Go Multiple AllOf Ref with Discriminator test
+
+
+
+ maven-dependency-plugin
+
+
+ package
+
+ copy-dependencies
+
+
+ ${project.build.directory}
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.2.1
+
+
+ go-get-testify
+ pre-integration-test
+
+ exec
+
+
+ go
+
+ get
+ github.com/stretchr/testify/assert
+
+
+
+
+ go-get-oauth2
+ pre-integration-test
+
+ exec
+
+
+ go
+
+ get
+ golang.org/x/oauth2
+
+
+
+
+ go-get-context
+ pre-integration-test
+
+ exec
+
+
+ go
+
+ get
+ golang.org/x/net/context
+
+
+
+
+ go-test
+ integration-test
+
+ exec
+
+
+ go
+
+ test
+ -v
+
+
+
+
+
+
+
+
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/response.go b/samples/client/others/go/allof_multiple_ref_and_discriminator/response.go
new file mode 100644
index 0000000000000..7498f33f6fcab
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/response.go
@@ -0,0 +1,47 @@
+/*
+Test
+
+No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+
+API version: 1.0.0
+*/
+
+// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
+
+package openapi
+
+import (
+ "net/http"
+)
+
+// APIResponse stores the API response returned by the server.
+type APIResponse struct {
+ *http.Response `json:"-"`
+ Message string `json:"message,omitempty"`
+ // Operation is the name of the OpenAPI operation.
+ Operation string `json:"operation,omitempty"`
+ // RequestURL is the request URL. This value is always available, even if the
+ // embedded *http.Response is nil.
+ RequestURL string `json:"url,omitempty"`
+ // Method is the HTTP method used for the request. This value is always
+ // available, even if the embedded *http.Response is nil.
+ Method string `json:"method,omitempty"`
+ // Payload holds the contents of the response body (which may be nil or empty).
+ // This is provided here as the raw response.Body() reader will have already
+ // been drained.
+ Payload []byte `json:"-"`
+}
+
+// NewAPIResponse returns a new APIResponse object.
+func NewAPIResponse(r *http.Response) *APIResponse {
+
+ response := &APIResponse{Response: r}
+ return response
+}
+
+// NewAPIResponseWithError returns a new APIResponse object with the provided error message.
+func NewAPIResponseWithError(errorMessage string) *APIResponse {
+
+ response := &APIResponse{Message: errorMessage}
+ return response
+}
diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/utils.go b/samples/client/others/go/allof_multiple_ref_and_discriminator/utils.go
new file mode 100644
index 0000000000000..5bcb22982429e
--- /dev/null
+++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/utils.go
@@ -0,0 +1,347 @@
+/*
+Test
+
+No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+
+API version: 1.0.0
+*/
+
+// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
+
+package openapi
+
+import (
+ "encoding/json"
+ "reflect"
+ "time"
+)
+
+// PtrBool is a helper routine that returns a pointer to given boolean value.
+func PtrBool(v bool) *bool { return &v }
+
+// PtrInt is a helper routine that returns a pointer to given integer value.
+func PtrInt(v int) *int { return &v }
+
+// PtrInt32 is a helper routine that returns a pointer to given integer value.
+func PtrInt32(v int32) *int32 { return &v }
+
+// PtrInt64 is a helper routine that returns a pointer to given integer value.
+func PtrInt64(v int64) *int64 { return &v }
+
+// PtrFloat32 is a helper routine that returns a pointer to given float value.
+func PtrFloat32(v float32) *float32 { return &v }
+
+// PtrFloat64 is a helper routine that returns a pointer to given float value.
+func PtrFloat64(v float64) *float64 { return &v }
+
+// PtrString is a helper routine that returns a pointer to given string value.
+func PtrString(v string) *string { return &v }
+
+// PtrTime is helper routine that returns a pointer to given Time value.
+func PtrTime(v time.Time) *time.Time { return &v }
+
+type NullableBool struct {
+ value *bool
+ isSet bool
+}
+
+func (v NullableBool) Get() *bool {
+ return v.value
+}
+
+func (v *NullableBool) Set(val *bool) {
+ v.value = val
+ v.isSet = true
+}
+
+func (v NullableBool) IsSet() bool {
+ return v.isSet
+}
+
+func (v *NullableBool) Unset() {
+ v.value = nil
+ v.isSet = false
+}
+
+func NewNullableBool(val *bool) *NullableBool {
+ return &NullableBool{value: val, isSet: true}
+}
+
+func (v NullableBool) MarshalJSON() ([]byte, error) {
+ return json.Marshal(v.value)
+}
+
+func (v *NullableBool) UnmarshalJSON(src []byte) error {
+ v.isSet = true
+ return json.Unmarshal(src, &v.value)
+}
+
+type NullableInt struct {
+ value *int
+ isSet bool
+}
+
+func (v NullableInt) Get() *int {
+ return v.value
+}
+
+func (v *NullableInt) Set(val *int) {
+ v.value = val
+ v.isSet = true
+}
+
+func (v NullableInt) IsSet() bool {
+ return v.isSet
+}
+
+func (v *NullableInt) Unset() {
+ v.value = nil
+ v.isSet = false
+}
+
+func NewNullableInt(val *int) *NullableInt {
+ return &NullableInt{value: val, isSet: true}
+}
+
+func (v NullableInt) MarshalJSON() ([]byte, error) {
+ return json.Marshal(v.value)
+}
+
+func (v *NullableInt) UnmarshalJSON(src []byte) error {
+ v.isSet = true
+ return json.Unmarshal(src, &v.value)
+}
+
+type NullableInt32 struct {
+ value *int32
+ isSet bool
+}
+
+func (v NullableInt32) Get() *int32 {
+ return v.value
+}
+
+func (v *NullableInt32) Set(val *int32) {
+ v.value = val
+ v.isSet = true
+}
+
+func (v NullableInt32) IsSet() bool {
+ return v.isSet
+}
+
+func (v *NullableInt32) Unset() {
+ v.value = nil
+ v.isSet = false
+}
+
+func NewNullableInt32(val *int32) *NullableInt32 {
+ return &NullableInt32{value: val, isSet: true}
+}
+
+func (v NullableInt32) MarshalJSON() ([]byte, error) {
+ return json.Marshal(v.value)
+}
+
+func (v *NullableInt32) UnmarshalJSON(src []byte) error {
+ v.isSet = true
+ return json.Unmarshal(src, &v.value)
+}
+
+type NullableInt64 struct {
+ value *int64
+ isSet bool
+}
+
+func (v NullableInt64) Get() *int64 {
+ return v.value
+}
+
+func (v *NullableInt64) Set(val *int64) {
+ v.value = val
+ v.isSet = true
+}
+
+func (v NullableInt64) IsSet() bool {
+ return v.isSet
+}
+
+func (v *NullableInt64) Unset() {
+ v.value = nil
+ v.isSet = false
+}
+
+func NewNullableInt64(val *int64) *NullableInt64 {
+ return &NullableInt64{value: val, isSet: true}
+}
+
+func (v NullableInt64) MarshalJSON() ([]byte, error) {
+ return json.Marshal(v.value)
+}
+
+func (v *NullableInt64) UnmarshalJSON(src []byte) error {
+ v.isSet = true
+ return json.Unmarshal(src, &v.value)
+}
+
+type NullableFloat32 struct {
+ value *float32
+ isSet bool
+}
+
+func (v NullableFloat32) Get() *float32 {
+ return v.value
+}
+
+func (v *NullableFloat32) Set(val *float32) {
+ v.value = val
+ v.isSet = true
+}
+
+func (v NullableFloat32) IsSet() bool {
+ return v.isSet
+}
+
+func (v *NullableFloat32) Unset() {
+ v.value = nil
+ v.isSet = false
+}
+
+func NewNullableFloat32(val *float32) *NullableFloat32 {
+ return &NullableFloat32{value: val, isSet: true}
+}
+
+func (v NullableFloat32) MarshalJSON() ([]byte, error) {
+ return json.Marshal(v.value)
+}
+
+func (v *NullableFloat32) UnmarshalJSON(src []byte) error {
+ v.isSet = true
+ return json.Unmarshal(src, &v.value)
+}
+
+type NullableFloat64 struct {
+ value *float64
+ isSet bool
+}
+
+func (v NullableFloat64) Get() *float64 {
+ return v.value
+}
+
+func (v *NullableFloat64) Set(val *float64) {
+ v.value = val
+ v.isSet = true
+}
+
+func (v NullableFloat64) IsSet() bool {
+ return v.isSet
+}
+
+func (v *NullableFloat64) Unset() {
+ v.value = nil
+ v.isSet = false
+}
+
+func NewNullableFloat64(val *float64) *NullableFloat64 {
+ return &NullableFloat64{value: val, isSet: true}
+}
+
+func (v NullableFloat64) MarshalJSON() ([]byte, error) {
+ return json.Marshal(v.value)
+}
+
+func (v *NullableFloat64) UnmarshalJSON(src []byte) error {
+ v.isSet = true
+ return json.Unmarshal(src, &v.value)
+}
+
+type NullableString struct {
+ value *string
+ isSet bool
+}
+
+func (v NullableString) Get() *string {
+ return v.value
+}
+
+func (v *NullableString) Set(val *string) {
+ v.value = val
+ v.isSet = true
+}
+
+func (v NullableString) IsSet() bool {
+ return v.isSet
+}
+
+func (v *NullableString) Unset() {
+ v.value = nil
+ v.isSet = false
+}
+
+func NewNullableString(val *string) *NullableString {
+ return &NullableString{value: val, isSet: true}
+}
+
+func (v NullableString) MarshalJSON() ([]byte, error) {
+ return json.Marshal(v.value)
+}
+
+func (v *NullableString) UnmarshalJSON(src []byte) error {
+ v.isSet = true
+ return json.Unmarshal(src, &v.value)
+}
+
+type NullableTime struct {
+ value *time.Time
+ isSet bool
+}
+
+func (v NullableTime) Get() *time.Time {
+ return v.value
+}
+
+func (v *NullableTime) Set(val *time.Time) {
+ v.value = val
+ v.isSet = true
+}
+
+func (v NullableTime) IsSet() bool {
+ return v.isSet
+}
+
+func (v *NullableTime) Unset() {
+ v.value = nil
+ v.isSet = false
+}
+
+func NewNullableTime(val *time.Time) *NullableTime {
+ return &NullableTime{value: val, isSet: true}
+}
+
+func (v NullableTime) MarshalJSON() ([]byte, error) {
+ return json.Marshal(v.value)
+}
+
+func (v *NullableTime) UnmarshalJSON(src []byte) error {
+ v.isSet = true
+ return json.Unmarshal(src, &v.value)
+}
+
+// IsNil checks if an input is nil
+func IsNil(i interface{}) bool {
+ if i == nil {
+ return true
+ }
+ switch reflect.TypeOf(i).Kind() {
+ case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice:
+ return reflect.ValueOf(i).IsNil()
+ case reflect.Array:
+ return reflect.ValueOf(i).IsZero()
+ }
+ return false
+}
+
+type MappedNullable interface {
+ ToMap() (map[string]interface{}, error)
+}
diff --git a/samples/client/others/java/okhttp-gson-oneOf/build.gradle b/samples/client/others/java/okhttp-gson-oneOf/build.gradle
index 385a98a20746a..06b2fd80c4c2b 100644
--- a/samples/client/others/java/okhttp-gson-oneOf/build.gradle
+++ b/samples/client/others/java/okhttp-gson-oneOf/build.gradle
@@ -117,9 +117,9 @@ dependencies {
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
- testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1'
+ testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testImplementation 'org.mockito:mockito-core:3.12.4'
- testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1'
+ testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
}
javadoc {
diff --git a/samples/client/others/java/okhttp-gson-oneOf/build.sbt b/samples/client/others/java/okhttp-gson-oneOf/build.sbt
index ee12a918d3980..5aea48501a093 100644
--- a/samples/client/others/java/okhttp-gson-oneOf/build.sbt
+++ b/samples/client/others/java/okhttp-gson-oneOf/build.sbt
@@ -21,7 +21,7 @@ lazy val root = (project in file(".")).
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
- "org.junit.jupiter" % "junit-jupiter-api" % "5.9.1" % "test",
+ "org.junit.jupiter" % "junit-jupiter-api" % "5.10.2" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test",
"org.mockito" % "mockito-core" % "3.12.4" % "test"
)
diff --git a/samples/client/others/java/okhttp-gson-oneOf/pom.xml b/samples/client/others/java/okhttp-gson-oneOf/pom.xml
index c69b956b30a25..bb8290ae29ae2 100644
--- a/samples/client/others/java/okhttp-gson-oneOf/pom.xml
+++ b/samples/client/others/java/okhttp-gson-oneOf/pom.xml
@@ -334,7 +334,7 @@
3.14.00.2.61.3.5
- 5.10.0
+ 5.10.21.10.02.1.11.1.1
diff --git a/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java b/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java
index 4b2fe83863a55..c2abb81acedd4 100644
--- a/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java
+++ b/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java
@@ -124,7 +124,7 @@ public MyExamplePostRequest() {
super("oneOf", Boolean.FALSE);
}
- public MyExamplePostRequest(String o) {
+ public MyExamplePostRequest(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
diff --git a/samples/client/others/java/okhttp-gson-streaming/build.gradle b/samples/client/others/java/okhttp-gson-streaming/build.gradle
index 41d81af4dcc2b..de95fe59eb4bc 100644
--- a/samples/client/others/java/okhttp-gson-streaming/build.gradle
+++ b/samples/client/others/java/okhttp-gson-streaming/build.gradle
@@ -117,9 +117,9 @@ dependencies {
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
- testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1'
+ testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testImplementation 'org.mockito:mockito-core:3.12.4'
- testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1'
+ testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
}
javadoc {
diff --git a/samples/client/others/java/okhttp-gson-streaming/build.sbt b/samples/client/others/java/okhttp-gson-streaming/build.sbt
index 2a9184320b662..43dc93b586203 100644
--- a/samples/client/others/java/okhttp-gson-streaming/build.sbt
+++ b/samples/client/others/java/okhttp-gson-streaming/build.sbt
@@ -21,7 +21,7 @@ lazy val root = (project in file(".")).
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
- "org.junit.jupiter" % "junit-jupiter-api" % "5.9.1" % "test",
+ "org.junit.jupiter" % "junit-jupiter-api" % "5.10.2" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test",
"org.mockito" % "mockito-core" % "3.12.4" % "test"
)
diff --git a/samples/client/others/java/okhttp-gson-streaming/pom.xml b/samples/client/others/java/okhttp-gson-streaming/pom.xml
index 9bb5940334571..83e02f07a0844 100644
--- a/samples/client/others/java/okhttp-gson-streaming/pom.xml
+++ b/samples/client/others/java/okhttp-gson-streaming/pom.xml
@@ -334,7 +334,7 @@
3.14.00.2.61.3.5
- 5.10.0
+ 5.10.21.10.02.1.11.1.1
diff --git a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java
index 19c136f1c67b7..2fc4629528e30 100644
--- a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java
+++ b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java
@@ -146,12 +146,7 @@ public SimpleOneOf() {
super("oneOf", Boolean.FALSE);
}
- public SimpleOneOf(Integer o) {
- super("oneOf", Boolean.FALSE);
- setActualInstance(o);
- }
-
- public SimpleOneOf(String o) {
+ public SimpleOneOf(Object o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
diff --git a/samples/client/others/rust/Cargo.toml b/samples/client/others/rust/Cargo.toml
index 85fad3af177bb..d36e0a12fecde 100644
--- a/samples/client/others/rust/Cargo.toml
+++ b/samples/client/others/rust/Cargo.toml
@@ -1,2 +1,3 @@
[workspace]
members = ["hyper/*", "reqwest/*", "reqwest-regression-16119"]
+resolver = "2"
diff --git a/samples/client/others/rust/hyper/api-with-ref-param/Cargo.toml b/samples/client/others/rust/hyper/api-with-ref-param/Cargo.toml
index 78dd6778b998a..bbf7d006f4993 100644
--- a/samples/client/others/rust/hyper/api-with-ref-param/Cargo.toml
+++ b/samples/client/others/rust/hyper/api-with-ref-param/Cargo.toml
@@ -5,14 +5,13 @@ authors = ["OpenAPI Generator team and contributors"]
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
-edition = "2018"
+edition = "2021"
[dependencies]
-serde = "^1.0"
-serde_derive = "^1.0"
+serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
-url = "^2.2"
-uuid = { version = "^1.0", features = ["serde", "v4"] }
+url = "^2.5"
+uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
http = "~0.2"
diff --git a/samples/client/others/rust/hyper/api-with-ref-param/src/apis/mod.rs b/samples/client/others/rust/hyper/api-with-ref-param/src/apis/mod.rs
index 1a5b2f58e4b96..4d85ccfc475de 100644
--- a/samples/client/others/rust/hyper/api-with-ref-param/src/apis/mod.rs
+++ b/samples/client/others/rust/hyper/api-with-ref-param/src/apis/mod.rs
@@ -29,19 +29,19 @@ impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
impl From for Error {
fn from(e: http::Error) -> Self {
- return Error::Http(e)
+ Error::Http(e)
}
}
impl From for Error {
fn from(e: hyper::Error) -> Self {
- return Error::Hyper(e)
+ Error::Hyper(e)
}
}
impl From for Error {
fn from(e: serde_json::Error) -> Self {
- return Error::Serde(e)
+ Error::Serde(e)
}
}
diff --git a/samples/client/others/rust/hyper/api-with-ref-param/src/lib.rs b/samples/client/others/rust/hyper/api-with-ref-param/src/lib.rs
index b49043ca04023..1de74d07cff17 100644
--- a/samples/client/others/rust/hyper/api-with-ref-param/src/lib.rs
+++ b/samples/client/others/rust/hyper/api-with-ref-param/src/lib.rs
@@ -1,7 +1,5 @@
#![allow(unused_imports)]
-
-#[macro_use]
-extern crate serde_derive;
+#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
diff --git a/samples/client/others/rust/hyper/api-with-ref-param/src/models/color.rs b/samples/client/others/rust/hyper/api-with-ref-param/src/models/color.rs
index b5df438c65220..7fcd2768c2090 100644
--- a/samples/client/others/rust/hyper/api-with-ref-param/src/models/color.rs
+++ b/samples/client/others/rust/hyper/api-with-ref-param/src/models/color.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
@@ -22,12 +23,12 @@ pub enum Color {
}
-impl ToString for Color {
- fn to_string(&self) -> String {
+impl std::fmt::Display for Color {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
- Self::Red => String::from("RED"),
- Self::Green => String::from("GREEN"),
- Self::Blue => String::from("BLUE"),
+ Self::Red => write!(f, "RED"),
+ Self::Green => write!(f, "GREEN"),
+ Self::Blue => write!(f, "BLUE"),
}
}
}
diff --git a/samples/client/others/rust/hyper/composed-oneof/Cargo.toml b/samples/client/others/rust/hyper/composed-oneof/Cargo.toml
index 0f8feed80f4be..c91777db137ce 100644
--- a/samples/client/others/rust/hyper/composed-oneof/Cargo.toml
+++ b/samples/client/others/rust/hyper/composed-oneof/Cargo.toml
@@ -5,14 +5,13 @@ authors = ["OpenAPI Generator team and contributors"]
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
-edition = "2018"
+edition = "2021"
[dependencies]
-serde = "^1.0"
-serde_derive = "^1.0"
+serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
-url = "^2.2"
-uuid = { version = "^1.0", features = ["serde", "v4"] }
+url = "^2.5"
+uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
http = "~0.2"
diff --git a/samples/client/others/rust/hyper/composed-oneof/src/apis/mod.rs b/samples/client/others/rust/hyper/composed-oneof/src/apis/mod.rs
index 1a5b2f58e4b96..4d85ccfc475de 100644
--- a/samples/client/others/rust/hyper/composed-oneof/src/apis/mod.rs
+++ b/samples/client/others/rust/hyper/composed-oneof/src/apis/mod.rs
@@ -29,19 +29,19 @@ impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
impl From for Error {
fn from(e: http::Error) -> Self {
- return Error::Http(e)
+ Error::Http(e)
}
}
impl From for Error {
fn from(e: hyper::Error) -> Self {
- return Error::Hyper(e)
+ Error::Hyper(e)
}
}
impl From for Error {
fn from(e: serde_json::Error) -> Self {
- return Error::Serde(e)
+ Error::Serde(e)
}
}
diff --git a/samples/client/others/rust/hyper/composed-oneof/src/lib.rs b/samples/client/others/rust/hyper/composed-oneof/src/lib.rs
index b49043ca04023..1de74d07cff17 100644
--- a/samples/client/others/rust/hyper/composed-oneof/src/lib.rs
+++ b/samples/client/others/rust/hyper/composed-oneof/src/lib.rs
@@ -1,7 +1,5 @@
#![allow(unused_imports)]
-
-#[macro_use]
-extern crate serde_derive;
+#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/create_state_request.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/create_state_request.rs
index a3ba90fcdedec..7e3701b8c963e 100644
--- a/samples/client/others/rust/hyper/composed-oneof/src/models/create_state_request.rs
+++ b/samples/client/others/rust/hyper/composed-oneof/src/models/create_state_request.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "realtype")]
diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_array_schema_inner.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_array_schema_inner.rs
index afff7fb23a6bc..2b3c27f0d4e89 100644
--- a/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_array_schema_inner.rs
+++ b/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_array_schema_inner.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "realtype")]
diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_schema.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_schema.rs
index 1b1f60a3ffd7b..c4f53db183daf 100644
--- a/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_schema.rs
+++ b/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_schema.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "realtype")]
diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/get_state_200_response.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/get_state_200_response.rs
index aaa86cbafbb0c..aeee0c377e42f 100644
--- a/samples/client/others/rust/hyper/composed-oneof/src/models/get_state_200_response.rs
+++ b/samples/client/others/rust/hyper/composed-oneof/src/models/get_state_200_response.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "realtype")]
diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_a.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_a.rs
index 67e72b00fed4a..0d581be15d955 100644
--- a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_a.rs
+++ b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_a.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ObjA {
diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_b.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_b.rs
index 835695c76619c..d0c508338d86d 100644
--- a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_b.rs
+++ b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_b.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ObjB {
diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_c.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_c.rs
index abc6aae248701..df21df238a321 100644
--- a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_c.rs
+++ b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_c.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ObjC {
diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_d.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_d.rs
index 287c2f24e3e9e..37640c7b418c9 100644
--- a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_d.rs
+++ b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_d.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ObjD {
diff --git a/samples/client/others/rust/hyper/emptyObject/Cargo.toml b/samples/client/others/rust/hyper/emptyObject/Cargo.toml
index 3574a9d4a89f9..7e570fe7056f1 100644
--- a/samples/client/others/rust/hyper/emptyObject/Cargo.toml
+++ b/samples/client/others/rust/hyper/emptyObject/Cargo.toml
@@ -5,14 +5,13 @@ authors = ["OpenAPI Generator team and contributors"]
description = "Ensure rust supports empty objects using serde::Value"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
-edition = "2018"
+edition = "2021"
[dependencies]
-serde = "^1.0"
-serde_derive = "^1.0"
+serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
-url = "^2.2"
-uuid = { version = "^1.0", features = ["serde", "v4"] }
+url = "^2.5"
+uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
http = "~0.2"
diff --git a/samples/client/others/rust/hyper/emptyObject/src/apis/mod.rs b/samples/client/others/rust/hyper/emptyObject/src/apis/mod.rs
index 1a5b2f58e4b96..4d85ccfc475de 100644
--- a/samples/client/others/rust/hyper/emptyObject/src/apis/mod.rs
+++ b/samples/client/others/rust/hyper/emptyObject/src/apis/mod.rs
@@ -29,19 +29,19 @@ impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
impl From for Error {
fn from(e: http::Error) -> Self {
- return Error::Http(e)
+ Error::Http(e)
}
}
impl From for Error {
fn from(e: hyper::Error) -> Self {
- return Error::Hyper(e)
+ Error::Hyper(e)
}
}
impl From for Error {
fn from(e: serde_json::Error) -> Self {
- return Error::Serde(e)
+ Error::Serde(e)
}
}
diff --git a/samples/client/others/rust/hyper/emptyObject/src/lib.rs b/samples/client/others/rust/hyper/emptyObject/src/lib.rs
index b49043ca04023..1de74d07cff17 100644
--- a/samples/client/others/rust/hyper/emptyObject/src/lib.rs
+++ b/samples/client/others/rust/hyper/emptyObject/src/lib.rs
@@ -1,7 +1,5 @@
#![allow(unused_imports)]
-
-#[macro_use]
-extern crate serde_derive;
+#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
diff --git a/samples/client/others/rust/hyper/emptyObject/src/models/empty_object.rs b/samples/client/others/rust/hyper/emptyObject/src/models/empty_object.rs
index 6db5fbff7ad23..ed5bffc2d3792 100644
--- a/samples/client/others/rust/hyper/emptyObject/src/models/empty_object.rs
+++ b/samples/client/others/rust/hyper/emptyObject/src/models/empty_object.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct EmptyObject {
diff --git a/samples/client/others/rust/hyper/oneOf-array-map/Cargo.toml b/samples/client/others/rust/hyper/oneOf-array-map/Cargo.toml
index 9b6c6d0bed384..7e1c7960f6dd2 100644
--- a/samples/client/others/rust/hyper/oneOf-array-map/Cargo.toml
+++ b/samples/client/others/rust/hyper/oneOf-array-map/Cargo.toml
@@ -5,14 +5,13 @@ authors = ["OpenAPI Generator team and contributors"]
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
-edition = "2018"
+edition = "2021"
[dependencies]
-serde = "^1.0"
-serde_derive = "^1.0"
+serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
-url = "^2.2"
-uuid = { version = "^1.0", features = ["serde", "v4"] }
+url = "^2.5"
+uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
http = "~0.2"
diff --git a/samples/client/others/rust/hyper/oneOf-array-map/src/apis/mod.rs b/samples/client/others/rust/hyper/oneOf-array-map/src/apis/mod.rs
index 1a5b2f58e4b96..4d85ccfc475de 100644
--- a/samples/client/others/rust/hyper/oneOf-array-map/src/apis/mod.rs
+++ b/samples/client/others/rust/hyper/oneOf-array-map/src/apis/mod.rs
@@ -29,19 +29,19 @@ impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
impl From for Error {
fn from(e: http::Error) -> Self {
- return Error::Http(e)
+ Error::Http(e)
}
}
impl From for Error {
fn from(e: hyper::Error) -> Self {
- return Error::Hyper(e)
+ Error::Hyper(e)
}
}
impl From for Error {
fn from(e: serde_json::Error) -> Self {
- return Error::Serde(e)
+ Error::Serde(e)
}
}
diff --git a/samples/client/others/rust/hyper/oneOf-array-map/src/lib.rs b/samples/client/others/rust/hyper/oneOf-array-map/src/lib.rs
index b49043ca04023..1de74d07cff17 100644
--- a/samples/client/others/rust/hyper/oneOf-array-map/src/lib.rs
+++ b/samples/client/others/rust/hyper/oneOf-array-map/src/lib.rs
@@ -1,7 +1,5 @@
#![allow(unused_imports)]
-
-#[macro_use]
-extern crate serde_derive;
+#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
diff --git a/samples/client/others/rust/hyper/oneOf-array-map/src/models/apple.rs b/samples/client/others/rust/hyper/oneOf-array-map/src/models/apple.rs
index 8472b2a8e5a04..a9f47c5e029b0 100644
--- a/samples/client/others/rust/hyper/oneOf-array-map/src/models/apple.rs
+++ b/samples/client/others/rust/hyper/oneOf-array-map/src/models/apple.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Apple {
diff --git a/samples/client/others/rust/hyper/oneOf-array-map/src/models/fruit.rs b/samples/client/others/rust/hyper/oneOf-array-map/src/models/fruit.rs
index 3bf995add30f6..827f9e4706380 100644
--- a/samples/client/others/rust/hyper/oneOf-array-map/src/models/fruit.rs
+++ b/samples/client/others/rust/hyper/oneOf-array-map/src/models/fruit.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
diff --git a/samples/client/others/rust/hyper/oneOf-array-map/src/models/grape.rs b/samples/client/others/rust/hyper/oneOf-array-map/src/models/grape.rs
index bc7d12681c4e3..50b1144cd1de8 100644
--- a/samples/client/others/rust/hyper/oneOf-array-map/src/models/grape.rs
+++ b/samples/client/others/rust/hyper/oneOf-array-map/src/models/grape.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Grape {
diff --git a/samples/client/others/rust/hyper/oneOf-reuseRef/Cargo.toml b/samples/client/others/rust/hyper/oneOf-reuseRef/Cargo.toml
index 60cde076e1bf8..6ff45ef734e91 100644
--- a/samples/client/others/rust/hyper/oneOf-reuseRef/Cargo.toml
+++ b/samples/client/others/rust/hyper/oneOf-reuseRef/Cargo.toml
@@ -4,14 +4,13 @@ version = "1.0.0"
authors = ["OpenAPI Generator team and contributors"]
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
license = "MIT"
-edition = "2018"
+edition = "2021"
[dependencies]
-serde = "^1.0"
-serde_derive = "^1.0"
+serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
-url = "^2.2"
-uuid = { version = "^1.0", features = ["serde", "v4"] }
+url = "^2.5"
+uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
http = "~0.2"
diff --git a/samples/client/others/rust/hyper/oneOf-reuseRef/src/apis/mod.rs b/samples/client/others/rust/hyper/oneOf-reuseRef/src/apis/mod.rs
index 1a5b2f58e4b96..4d85ccfc475de 100644
--- a/samples/client/others/rust/hyper/oneOf-reuseRef/src/apis/mod.rs
+++ b/samples/client/others/rust/hyper/oneOf-reuseRef/src/apis/mod.rs
@@ -29,19 +29,19 @@ impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
impl From for Error {
fn from(e: http::Error) -> Self {
- return Error::Http(e)
+ Error::Http(e)
}
}
impl From for Error {
fn from(e: hyper::Error) -> Self {
- return Error::Hyper(e)
+ Error::Hyper(e)
}
}
impl From for Error {
fn from(e: serde_json::Error) -> Self {
- return Error::Serde(e)
+ Error::Serde(e)
}
}
diff --git a/samples/client/others/rust/hyper/oneOf-reuseRef/src/lib.rs b/samples/client/others/rust/hyper/oneOf-reuseRef/src/lib.rs
index b49043ca04023..1de74d07cff17 100644
--- a/samples/client/others/rust/hyper/oneOf-reuseRef/src/lib.rs
+++ b/samples/client/others/rust/hyper/oneOf-reuseRef/src/lib.rs
@@ -1,7 +1,5 @@
#![allow(unused_imports)]
-
-#[macro_use]
-extern crate serde_derive;
+#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
diff --git a/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/apple.rs b/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/apple.rs
index 72586e6047169..6a7c03c3bc1e2 100644
--- a/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/apple.rs
+++ b/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/apple.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Apple {
diff --git a/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/banana.rs b/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/banana.rs
index b3dfb65a245de..a80f3d23e0fe8 100644
--- a/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/banana.rs
+++ b/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/banana.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Banana {
diff --git a/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/fruit.rs b/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/fruit.rs
index e1b018e841145..cd28f15520c00 100644
--- a/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/fruit.rs
+++ b/samples/client/others/rust/hyper/oneOf-reuseRef/src/models/fruit.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "fruitType")]
diff --git a/samples/client/others/rust/hyper/oneOf/Cargo.toml b/samples/client/others/rust/hyper/oneOf/Cargo.toml
index 0209137ee82e0..647e27693941f 100644
--- a/samples/client/others/rust/hyper/oneOf/Cargo.toml
+++ b/samples/client/others/rust/hyper/oneOf/Cargo.toml
@@ -5,14 +5,13 @@ authors = ["OpenAPI Generator team and contributors"]
description = "This tests for a oneOf interface representation "
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
-edition = "2018"
+edition = "2021"
[dependencies]
-serde = "^1.0"
-serde_derive = "^1.0"
+serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
-url = "^2.2"
-uuid = { version = "^1.0", features = ["serde", "v4"] }
+url = "^2.5"
+uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
http = "~0.2"
diff --git a/samples/client/others/rust/hyper/oneOf/src/apis/mod.rs b/samples/client/others/rust/hyper/oneOf/src/apis/mod.rs
index e0dbe42efe7cc..288eec40a0e0e 100644
--- a/samples/client/others/rust/hyper/oneOf/src/apis/mod.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/apis/mod.rs
@@ -29,19 +29,19 @@ impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
impl From for Error {
fn from(e: http::Error) -> Self {
- return Error::Http(e)
+ Error::Http(e)
}
}
impl From for Error {
fn from(e: hyper::Error) -> Self {
- return Error::Hyper(e)
+ Error::Hyper(e)
}
}
impl From for Error {
fn from(e: serde_json::Error) -> Self {
- return Error::Serde(e)
+ Error::Serde(e)
}
}
diff --git a/samples/client/others/rust/hyper/oneOf/src/lib.rs b/samples/client/others/rust/hyper/oneOf/src/lib.rs
index b49043ca04023..1de74d07cff17 100644
--- a/samples/client/others/rust/hyper/oneOf/src/lib.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/lib.rs
@@ -1,7 +1,5 @@
#![allow(unused_imports)]
-
-#[macro_use]
-extern crate serde_derive;
+#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/addressable.rs b/samples/client/others/rust/hyper/oneOf/src/models/addressable.rs
index 82d62ccc28838..bbca8e7e92368 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/addressable.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/addressable.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
/// Addressable : Base schema for addressable entities
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/apple.rs b/samples/client/others/rust/hyper/oneOf/src/models/apple.rs
index 54b954846718e..3796fb213f47f 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/apple.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/apple.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Apple {
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/banana.rs b/samples/client/others/rust/hyper/oneOf/src/models/banana.rs
index d026dbd2b8e53..4bfe41822573b 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/banana.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/banana.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Banana {
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/bar.rs b/samples/client/others/rust/hyper/oneOf/src/models/bar.rs
index 7508b00b9af57..2499fb3a586bc 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/bar.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/bar.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Bar {
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/bar_create.rs b/samples/client/others/rust/hyper/oneOf/src/models/bar_create.rs
index 0afc67998fe49..6eb81b9903366 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/bar_create.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/bar_create.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct BarCreate {
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/bar_ref.rs b/samples/client/others/rust/hyper/oneOf/src/models/bar_ref.rs
index 42e2176fca0b6..8533dd933f57a 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/bar_ref.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/bar_ref.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct BarRef {
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/bar_ref_or_value.rs b/samples/client/others/rust/hyper/oneOf/src/models/bar_ref_or_value.rs
index 3c9312706a76d..6d1977d5ba0ea 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/bar_ref_or_value.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/bar_ref_or_value.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/entity.rs b/samples/client/others/rust/hyper/oneOf/src/models/entity.rs
index b864cab686e03..bfb1aac3382cc 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/entity.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/entity.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "@type")]
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/entity_ref.rs b/samples/client/others/rust/hyper/oneOf/src/models/entity_ref.rs
index 60773f6e9afb5..01272ef9fadb1 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/entity_ref.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/entity_ref.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
/// EntityRef : Entity reference schema to be use for all entityRef class.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/extensible.rs b/samples/client/others/rust/hyper/oneOf/src/models/extensible.rs
index d87abf5be19a4..23875ef0c6e29 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/extensible.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/extensible.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Extensible {
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/foo.rs b/samples/client/others/rust/hyper/oneOf/src/models/foo.rs
index be82765a3a89a..ea618695d0bd4 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/foo.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/foo.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Foo {
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/foo_ref.rs b/samples/client/others/rust/hyper/oneOf/src/models/foo_ref.rs
index 11640d85a7caf..d0b425044b75d 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/foo_ref.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/foo_ref.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct FooRef {
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/foo_ref_or_value.rs b/samples/client/others/rust/hyper/oneOf/src/models/foo_ref_or_value.rs
index b3ad0848d623d..fbbbd13150e37 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/foo_ref_or_value.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/foo_ref_or_value.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "@type")]
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/fruit.rs b/samples/client/others/rust/hyper/oneOf/src/models/fruit.rs
index 84967523295ee..56d7f1eba285a 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/fruit.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/fruit.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "fruitType")]
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/fruit_type.rs b/samples/client/others/rust/hyper/oneOf/src/models/fruit_type.rs
index 00f405a7846a6..6548af28e3f84 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/fruit_type.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/fruit_type.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
@@ -20,11 +21,11 @@ pub enum FruitType {
}
-impl ToString for FruitType {
- fn to_string(&self) -> String {
+impl std::fmt::Display for FruitType {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
- Self::Apple => String::from("APPLE"),
- Self::Banana => String::from("BANANA"),
+ Self::Apple => write!(f, "APPLE"),
+ Self::Banana => write!(f, "BANANA"),
}
}
}
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/pasta.rs b/samples/client/others/rust/hyper/oneOf/src/models/pasta.rs
index 69ae5110cf6d0..8ba2efce08384 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/pasta.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/pasta.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Pasta {
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/pizza.rs b/samples/client/others/rust/hyper/oneOf/src/models/pizza.rs
index 6ae7f457df412..bfe6de648264f 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/pizza.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/pizza.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Pizza {
diff --git a/samples/client/others/rust/hyper/oneOf/src/models/pizza_speziale.rs b/samples/client/others/rust/hyper/oneOf/src/models/pizza_speziale.rs
index e1c5258c616d7..a294e07dfdbf0 100644
--- a/samples/client/others/rust/hyper/oneOf/src/models/pizza_speziale.rs
+++ b/samples/client/others/rust/hyper/oneOf/src/models/pizza_speziale.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PizzaSpeziale {
diff --git a/samples/client/others/rust/reqwest-regression-16119/Cargo.toml b/samples/client/others/rust/reqwest-regression-16119/Cargo.toml
index 529ee9eba6348..1919da46b0882 100644
--- a/samples/client/others/rust/reqwest-regression-16119/Cargo.toml
+++ b/samples/client/others/rust/reqwest-regression-16119/Cargo.toml
@@ -5,14 +5,11 @@ authors = ["OpenAPI Generator team and contributors"]
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
-edition = "2018"
+edition = "2021"
[dependencies]
-serde = "^1.0"
-serde_derive = "^1.0"
+serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
-url = "^2.2"
-uuid = { version = "^1.0", features = ["serde", "v4"] }
-[dependencies.reqwest]
-version = "^0.11"
-features = ["json", "blocking", "multipart"]
+url = "^2.5"
+uuid = { version = "^1.8", features = ["serde", "v4"] }
+reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] }
diff --git a/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs b/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs
index 9f70938d1bc3f..3886a83c95439 100644
--- a/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs
+++ b/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs
@@ -10,7 +10,7 @@
use reqwest;
-
+use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
diff --git a/samples/client/others/rust/reqwest-regression-16119/src/lib.rs b/samples/client/others/rust/reqwest-regression-16119/src/lib.rs
index 1ac114198fddf..a1837b966dc7e 100644
--- a/samples/client/others/rust/reqwest-regression-16119/src/lib.rs
+++ b/samples/client/others/rust/reqwest-regression-16119/src/lib.rs
@@ -1,7 +1,5 @@
#![allow(unused_imports)]
-
-#[macro_use]
-extern crate serde_derive;
+#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
diff --git a/samples/client/others/rust/reqwest-regression-16119/src/models/parent.rs b/samples/client/others/rust/reqwest-regression-16119/src/models/parent.rs
index 620ea7cb4b94d..31d1ea44857cf 100644
--- a/samples/client/others/rust/reqwest-regression-16119/src/models/parent.rs
+++ b/samples/client/others/rust/reqwest-regression-16119/src/models/parent.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Parent {
diff --git a/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml b/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml
index 7aacac5ecacf4..7fc367e02dd30 100644
--- a/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml
+++ b/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml
@@ -5,14 +5,11 @@ authors = ["OpenAPI Generator team and contributors"]
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
-edition = "2018"
+edition = "2021"
[dependencies]
-serde = "^1.0"
-serde_derive = "^1.0"
+serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
-url = "^2.2"
-uuid = { version = "^1.0", features = ["serde", "v4"] }
-[dependencies.reqwest]
-version = "^0.11"
-features = ["json", "multipart"]
+url = "^2.5"
+uuid = { version = "^1.8", features = ["serde", "v4"] }
+reqwest = { version = "^0.12", features = ["json", "multipart"] }
diff --git a/samples/client/others/rust/reqwest/api-with-ref-param/src/apis/default_api.rs b/samples/client/others/rust/reqwest/api-with-ref-param/src/apis/default_api.rs
index b1be5415e4d88..27a37acccf490 100644
--- a/samples/client/others/rust/reqwest/api-with-ref-param/src/apis/default_api.rs
+++ b/samples/client/others/rust/reqwest/api-with-ref-param/src/apis/default_api.rs
@@ -10,7 +10,7 @@
use reqwest;
-
+use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
diff --git a/samples/client/others/rust/reqwest/api-with-ref-param/src/lib.rs b/samples/client/others/rust/reqwest/api-with-ref-param/src/lib.rs
index 1ac114198fddf..a1837b966dc7e 100644
--- a/samples/client/others/rust/reqwest/api-with-ref-param/src/lib.rs
+++ b/samples/client/others/rust/reqwest/api-with-ref-param/src/lib.rs
@@ -1,7 +1,5 @@
#![allow(unused_imports)]
-
-#[macro_use]
-extern crate serde_derive;
+#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
diff --git a/samples/client/others/rust/reqwest/api-with-ref-param/src/models/color.rs b/samples/client/others/rust/reqwest/api-with-ref-param/src/models/color.rs
index b5df438c65220..7fcd2768c2090 100644
--- a/samples/client/others/rust/reqwest/api-with-ref-param/src/models/color.rs
+++ b/samples/client/others/rust/reqwest/api-with-ref-param/src/models/color.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
@@ -22,12 +23,12 @@ pub enum Color {
}
-impl ToString for Color {
- fn to_string(&self) -> String {
+impl std::fmt::Display for Color {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
- Self::Red => String::from("RED"),
- Self::Green => String::from("GREEN"),
- Self::Blue => String::from("BLUE"),
+ Self::Red => write!(f, "RED"),
+ Self::Green => write!(f, "GREEN"),
+ Self::Blue => write!(f, "BLUE"),
}
}
}
diff --git a/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml b/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml
index 0ff96294b5aba..0a06ebb4f8724 100644
--- a/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml
+++ b/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml
@@ -5,14 +5,11 @@ authors = ["OpenAPI Generator team and contributors"]
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
-edition = "2018"
+edition = "2021"
[dependencies]
-serde = "^1.0"
-serde_derive = "^1.0"
+serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
-url = "^2.2"
-uuid = { version = "^1.0", features = ["serde", "v4"] }
-[dependencies.reqwest]
-version = "^0.11"
-features = ["json", "blocking", "multipart"]
+url = "^2.5"
+uuid = { version = "^1.8", features = ["serde", "v4"] }
+reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] }
diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs b/samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs
index 03e6c12b1715d..59d4035053a91 100644
--- a/samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs
+++ b/samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs
@@ -10,7 +10,7 @@
use reqwest;
-
+use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/lib.rs b/samples/client/others/rust/reqwest/composed-oneof/src/lib.rs
index 1ac114198fddf..a1837b966dc7e 100644
--- a/samples/client/others/rust/reqwest/composed-oneof/src/lib.rs
+++ b/samples/client/others/rust/reqwest/composed-oneof/src/lib.rs
@@ -1,7 +1,5 @@
#![allow(unused_imports)]
-
-#[macro_use]
-extern crate serde_derive;
+#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/create_state_request.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/create_state_request.rs
index a3ba90fcdedec..7e3701b8c963e 100644
--- a/samples/client/others/rust/reqwest/composed-oneof/src/models/create_state_request.rs
+++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/create_state_request.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "realtype")]
diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_array_schema_inner.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_array_schema_inner.rs
index afff7fb23a6bc..2b3c27f0d4e89 100644
--- a/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_array_schema_inner.rs
+++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_array_schema_inner.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "realtype")]
diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_schema.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_schema.rs
index 1b1f60a3ffd7b..c4f53db183daf 100644
--- a/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_schema.rs
+++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_schema.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "realtype")]
diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/get_state_200_response.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/get_state_200_response.rs
index aaa86cbafbb0c..aeee0c377e42f 100644
--- a/samples/client/others/rust/reqwest/composed-oneof/src/models/get_state_200_response.rs
+++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/get_state_200_response.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "realtype")]
diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_a.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_a.rs
index 67e72b00fed4a..0d581be15d955 100644
--- a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_a.rs
+++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_a.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ObjA {
diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_b.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_b.rs
index 835695c76619c..d0c508338d86d 100644
--- a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_b.rs
+++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_b.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ObjB {
diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_c.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_c.rs
index abc6aae248701..df21df238a321 100644
--- a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_c.rs
+++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_c.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ObjC {
diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_d.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_d.rs
index 287c2f24e3e9e..37640c7b418c9 100644
--- a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_d.rs
+++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_d.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ObjD {
diff --git a/samples/client/others/rust/reqwest/emptyObject/Cargo.toml b/samples/client/others/rust/reqwest/emptyObject/Cargo.toml
index fa318861c5793..8245af0063cd1 100644
--- a/samples/client/others/rust/reqwest/emptyObject/Cargo.toml
+++ b/samples/client/others/rust/reqwest/emptyObject/Cargo.toml
@@ -5,14 +5,11 @@ authors = ["OpenAPI Generator team and contributors"]
description = "Ensure rust supports empty objects using serde::Value"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
-edition = "2018"
+edition = "2021"
[dependencies]
-serde = "^1.0"
-serde_derive = "^1.0"
+serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
-url = "^2.2"
-uuid = { version = "^1.0", features = ["serde", "v4"] }
-[dependencies.reqwest]
-version = "^0.11"
-features = ["json", "blocking", "multipart"]
+url = "^2.5"
+uuid = { version = "^1.8", features = ["serde", "v4"] }
+reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] }
diff --git a/samples/client/others/rust/reqwest/emptyObject/src/apis/default_api.rs b/samples/client/others/rust/reqwest/emptyObject/src/apis/default_api.rs
index 09832aa9133ec..5f5b46edc2c80 100644
--- a/samples/client/others/rust/reqwest/emptyObject/src/apis/default_api.rs
+++ b/samples/client/others/rust/reqwest/emptyObject/src/apis/default_api.rs
@@ -10,7 +10,7 @@
use reqwest;
-
+use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
diff --git a/samples/client/others/rust/reqwest/emptyObject/src/lib.rs b/samples/client/others/rust/reqwest/emptyObject/src/lib.rs
index 1ac114198fddf..a1837b966dc7e 100644
--- a/samples/client/others/rust/reqwest/emptyObject/src/lib.rs
+++ b/samples/client/others/rust/reqwest/emptyObject/src/lib.rs
@@ -1,7 +1,5 @@
#![allow(unused_imports)]
-
-#[macro_use]
-extern crate serde_derive;
+#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
diff --git a/samples/client/others/rust/reqwest/emptyObject/src/models/empty_object.rs b/samples/client/others/rust/reqwest/emptyObject/src/models/empty_object.rs
index 6db5fbff7ad23..ed5bffc2d3792 100644
--- a/samples/client/others/rust/reqwest/emptyObject/src/models/empty_object.rs
+++ b/samples/client/others/rust/reqwest/emptyObject/src/models/empty_object.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct EmptyObject {
diff --git a/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml b/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml
index 9d5cdb6803189..0b23d93ace1be 100644
--- a/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml
+++ b/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml
@@ -5,14 +5,11 @@ authors = ["OpenAPI Generator team and contributors"]
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
-edition = "2018"
+edition = "2021"
[dependencies]
-serde = "^1.0"
-serde_derive = "^1.0"
+serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
-url = "^2.2"
-uuid = { version = "^1.0", features = ["serde", "v4"] }
-[dependencies.reqwest]
-version = "^0.11"
-features = ["json", "blocking", "multipart"]
+url = "^2.5"
+uuid = { version = "^1.8", features = ["serde", "v4"] }
+reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] }
diff --git a/samples/client/others/rust/reqwest/oneOf-array-map/src/apis/default_api.rs b/samples/client/others/rust/reqwest/oneOf-array-map/src/apis/default_api.rs
index b87854cd090c3..c487220374ea5 100644
--- a/samples/client/others/rust/reqwest/oneOf-array-map/src/apis/default_api.rs
+++ b/samples/client/others/rust/reqwest/oneOf-array-map/src/apis/default_api.rs
@@ -10,7 +10,7 @@
use reqwest;
-
+use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
diff --git a/samples/client/others/rust/reqwest/oneOf-array-map/src/lib.rs b/samples/client/others/rust/reqwest/oneOf-array-map/src/lib.rs
index 1ac114198fddf..a1837b966dc7e 100644
--- a/samples/client/others/rust/reqwest/oneOf-array-map/src/lib.rs
+++ b/samples/client/others/rust/reqwest/oneOf-array-map/src/lib.rs
@@ -1,7 +1,5 @@
#![allow(unused_imports)]
-
-#[macro_use]
-extern crate serde_derive;
+#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
diff --git a/samples/client/others/rust/reqwest/oneOf-array-map/src/models/apple.rs b/samples/client/others/rust/reqwest/oneOf-array-map/src/models/apple.rs
index 8472b2a8e5a04..a9f47c5e029b0 100644
--- a/samples/client/others/rust/reqwest/oneOf-array-map/src/models/apple.rs
+++ b/samples/client/others/rust/reqwest/oneOf-array-map/src/models/apple.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Apple {
diff --git a/samples/client/others/rust/reqwest/oneOf-array-map/src/models/fruit.rs b/samples/client/others/rust/reqwest/oneOf-array-map/src/models/fruit.rs
index 3bf995add30f6..827f9e4706380 100644
--- a/samples/client/others/rust/reqwest/oneOf-array-map/src/models/fruit.rs
+++ b/samples/client/others/rust/reqwest/oneOf-array-map/src/models/fruit.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
diff --git a/samples/client/others/rust/reqwest/oneOf-array-map/src/models/grape.rs b/samples/client/others/rust/reqwest/oneOf-array-map/src/models/grape.rs
index bc7d12681c4e3..50b1144cd1de8 100644
--- a/samples/client/others/rust/reqwest/oneOf-array-map/src/models/grape.rs
+++ b/samples/client/others/rust/reqwest/oneOf-array-map/src/models/grape.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Grape {
diff --git a/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml b/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml
index 4c98b3374252f..4d69b38b2e598 100644
--- a/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml
+++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml
@@ -4,14 +4,11 @@ version = "1.0.0"
authors = ["OpenAPI Generator team and contributors"]
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
license = "MIT"
-edition = "2018"
+edition = "2021"
[dependencies]
-serde = "^1.0"
-serde_derive = "^1.0"
+serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
-url = "^2.2"
-uuid = { version = "^1.0", features = ["serde", "v4"] }
-[dependencies.reqwest]
-version = "^0.11"
-features = ["json", "blocking", "multipart"]
+url = "^2.5"
+uuid = { version = "^1.8", features = ["serde", "v4"] }
+reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] }
diff --git a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/apis/default_api.rs b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/apis/default_api.rs
index c0d92bc1e7eb8..035872574bf6c 100644
--- a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/apis/default_api.rs
+++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/apis/default_api.rs
@@ -10,7 +10,7 @@
use reqwest;
-
+use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
diff --git a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/lib.rs b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/lib.rs
index 1ac114198fddf..a1837b966dc7e 100644
--- a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/lib.rs
+++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/lib.rs
@@ -1,7 +1,5 @@
#![allow(unused_imports)]
-
-#[macro_use]
-extern crate serde_derive;
+#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
diff --git a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/apple.rs b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/apple.rs
index 72586e6047169..6a7c03c3bc1e2 100644
--- a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/apple.rs
+++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/apple.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Apple {
diff --git a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/banana.rs b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/banana.rs
index b3dfb65a245de..a80f3d23e0fe8 100644
--- a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/banana.rs
+++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/banana.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Banana {
diff --git a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/fruit.rs b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/fruit.rs
index e1b018e841145..cd28f15520c00 100644
--- a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/fruit.rs
+++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/models/fruit.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "fruitType")]
diff --git a/samples/client/others/rust/reqwest/oneOf/Cargo.toml b/samples/client/others/rust/reqwest/oneOf/Cargo.toml
index 91e5d81c55b2e..89997ba956667 100644
--- a/samples/client/others/rust/reqwest/oneOf/Cargo.toml
+++ b/samples/client/others/rust/reqwest/oneOf/Cargo.toml
@@ -5,14 +5,11 @@ authors = ["OpenAPI Generator team and contributors"]
description = "This tests for a oneOf interface representation "
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
-edition = "2018"
+edition = "2021"
[dependencies]
-serde = "^1.0"
-serde_derive = "^1.0"
+serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
-url = "^2.2"
-uuid = { version = "^1.0", features = ["serde", "v4"] }
-[dependencies.reqwest]
-version = "^0.11"
-features = ["json", "blocking", "multipart"]
+url = "^2.5"
+uuid = { version = "^1.8", features = ["serde", "v4"] }
+reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] }
diff --git a/samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs b/samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs
index 2d07cacdb4908..f8ce13d5cac64 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs
@@ -10,7 +10,7 @@
use reqwest;
-
+use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
diff --git a/samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs b/samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs
index be07fec200890..202e6bb667939 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs
@@ -10,7 +10,7 @@
use reqwest;
-
+use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
diff --git a/samples/client/others/rust/reqwest/oneOf/src/lib.rs b/samples/client/others/rust/reqwest/oneOf/src/lib.rs
index 1ac114198fddf..a1837b966dc7e 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/lib.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/lib.rs
@@ -1,7 +1,5 @@
#![allow(unused_imports)]
-
-#[macro_use]
-extern crate serde_derive;
+#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/addressable.rs b/samples/client/others/rust/reqwest/oneOf/src/models/addressable.rs
index 82d62ccc28838..bbca8e7e92368 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/addressable.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/addressable.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
/// Addressable : Base schema for addressable entities
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/apple.rs b/samples/client/others/rust/reqwest/oneOf/src/models/apple.rs
index 54b954846718e..3796fb213f47f 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/apple.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/apple.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Apple {
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/banana.rs b/samples/client/others/rust/reqwest/oneOf/src/models/banana.rs
index d026dbd2b8e53..4bfe41822573b 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/banana.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/banana.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Banana {
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/bar.rs b/samples/client/others/rust/reqwest/oneOf/src/models/bar.rs
index 7508b00b9af57..2499fb3a586bc 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/bar.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/bar.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Bar {
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/bar_create.rs b/samples/client/others/rust/reqwest/oneOf/src/models/bar_create.rs
index 0afc67998fe49..6eb81b9903366 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/bar_create.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/bar_create.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct BarCreate {
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref.rs b/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref.rs
index 42e2176fca0b6..8533dd933f57a 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct BarRef {
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref_or_value.rs b/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref_or_value.rs
index 3c9312706a76d..6d1977d5ba0ea 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref_or_value.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref_or_value.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/entity.rs b/samples/client/others/rust/reqwest/oneOf/src/models/entity.rs
index b864cab686e03..bfb1aac3382cc 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/entity.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/entity.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "@type")]
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/entity_ref.rs b/samples/client/others/rust/reqwest/oneOf/src/models/entity_ref.rs
index 60773f6e9afb5..01272ef9fadb1 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/entity_ref.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/entity_ref.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
/// EntityRef : Entity reference schema to be use for all entityRef class.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/extensible.rs b/samples/client/others/rust/reqwest/oneOf/src/models/extensible.rs
index d87abf5be19a4..23875ef0c6e29 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/extensible.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/extensible.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Extensible {
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/foo.rs b/samples/client/others/rust/reqwest/oneOf/src/models/foo.rs
index be82765a3a89a..ea618695d0bd4 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/foo.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/foo.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Foo {
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref.rs b/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref.rs
index 11640d85a7caf..d0b425044b75d 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct FooRef {
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref_or_value.rs b/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref_or_value.rs
index b3ad0848d623d..fbbbd13150e37 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref_or_value.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref_or_value.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "@type")]
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/fruit.rs b/samples/client/others/rust/reqwest/oneOf/src/models/fruit.rs
index 84967523295ee..56d7f1eba285a 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/fruit.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/fruit.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "fruitType")]
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/fruit_type.rs b/samples/client/others/rust/reqwest/oneOf/src/models/fruit_type.rs
index 00f405a7846a6..6548af28e3f84 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/fruit_type.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/fruit_type.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
@@ -20,11 +21,11 @@ pub enum FruitType {
}
-impl ToString for FruitType {
- fn to_string(&self) -> String {
+impl std::fmt::Display for FruitType {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
- Self::Apple => String::from("APPLE"),
- Self::Banana => String::from("BANANA"),
+ Self::Apple => write!(f, "APPLE"),
+ Self::Banana => write!(f, "BANANA"),
}
}
}
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/pasta.rs b/samples/client/others/rust/reqwest/oneOf/src/models/pasta.rs
index 69ae5110cf6d0..8ba2efce08384 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/pasta.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/pasta.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Pasta {
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/pizza.rs b/samples/client/others/rust/reqwest/oneOf/src/models/pizza.rs
index 6ae7f457df412..bfe6de648264f 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/pizza.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/pizza.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Pizza {
diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/pizza_speziale.rs b/samples/client/others/rust/reqwest/oneOf/src/models/pizza_speziale.rs
index e1c5258c616d7..a294e07dfdbf0 100644
--- a/samples/client/others/rust/reqwest/oneOf/src/models/pizza_speziale.rs
+++ b/samples/client/others/rust/reqwest/oneOf/src/models/pizza_speziale.rs
@@ -9,6 +9,7 @@
*/
use crate::models;
+use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PizzaSpeziale {
diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/abstract-user-dto.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/abstract-user-dto.ts
index 765c42588337c..3643cc60cff65 100644
--- a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/abstract-user-dto.ts
+++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/abstract-user-dto.ts
@@ -15,7 +15,7 @@
// May contain unused imports in some cases
// @ts-ignore
-import { BranchDto } from './branch-dto';
+import type { BranchDto } from './branch-dto';
/**
*
diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/flat-stock-pick-order-dto.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/flat-stock-pick-order-dto.ts
index f0c0e4a678c05..12cd97a7d4cc0 100644
--- a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/flat-stock-pick-order-dto.ts
+++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/flat-stock-pick-order-dto.ts
@@ -15,7 +15,7 @@
// May contain unused imports in some cases
// @ts-ignore
-import { AbstractFlatStockPickOrderBaseDto } from './abstract-flat-stock-pick-order-base-dto';
+import type { AbstractFlatStockPickOrderBaseDto } from './abstract-flat-stock-pick-order-base-dto';
/**
* @type FlatStockPickOrderDto
diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/internal-authenticated-user-dto.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/internal-authenticated-user-dto.ts
index 790458e5390f8..b3d1d3737cabe 100644
--- a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/internal-authenticated-user-dto.ts
+++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/internal-authenticated-user-dto.ts
@@ -15,10 +15,10 @@
// May contain unused imports in some cases
// @ts-ignore
-import { AbstractUserDto } from './abstract-user-dto';
+import type { AbstractUserDto } from './abstract-user-dto';
// May contain unused imports in some cases
// @ts-ignore
-import { BranchDto } from './branch-dto';
+import type { BranchDto } from './branch-dto';
/**
* @type InternalAuthenticatedUserDto
diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/remote-authenticated-user-dto.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/remote-authenticated-user-dto.ts
index b8071de44216d..0cfe57c46a78e 100644
--- a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/remote-authenticated-user-dto.ts
+++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/remote-authenticated-user-dto.ts
@@ -15,10 +15,10 @@
// May contain unused imports in some cases
// @ts-ignore
-import { AbstractUserDto } from './abstract-user-dto';
+import type { AbstractUserDto } from './abstract-user-dto';
// May contain unused imports in some cases
// @ts-ignore
-import { BranchDto } from './branch-dto';
+import type { BranchDto } from './branch-dto';
/**
* @type RemoteAuthenticatedUserDto
diff --git a/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES
index 2691d1503cb8a..06401fbfbce32 100644
--- a/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES
+++ b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES
@@ -20,8 +20,11 @@ include/CppRestPetstoreClient/model/ApiResponse.h
include/CppRestPetstoreClient/model/Category.h
include/CppRestPetstoreClient/model/Order.h
include/CppRestPetstoreClient/model/Pet.h
+include/CppRestPetstoreClient/model/SchemaWithSet.h
+include/CppRestPetstoreClient/model/SchemaWithSet_vaccinationBook.h
include/CppRestPetstoreClient/model/Tag.h
include/CppRestPetstoreClient/model/User.h
+include/CppRestPetstoreClient/model/Vaccine.h
src/AnyType.cpp
src/ApiClient.cpp
src/ApiConfiguration.cpp
@@ -38,5 +41,8 @@ src/model/ApiResponse.cpp
src/model/Category.cpp
src/model/Order.cpp
src/model/Pet.cpp
+src/model/SchemaWithSet.cpp
+src/model/SchemaWithSet_vaccinationBook.cpp
src/model/Tag.cpp
src/model/User.cpp
+src/model/Vaccine.cpp
diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/ModelBase.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/ModelBase.h
index d3a1766c2d507..40167660cb9f1 100644
--- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/ModelBase.h
+++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/ModelBase.h
@@ -27,6 +27,7 @@
#include
#include
+#include
#include
namespace org {
@@ -63,6 +64,8 @@ class ModelBase
static utility::string_t toString( const std::shared_ptr& val );
template
static utility::string_t toString( const std::vector & val );
+ template
+ static utility::string_t toString( const std::set & val );
static web::json::value toJson( bool val );
static web::json::value toJson( float val );
@@ -79,6 +82,8 @@ class ModelBase
template
static web::json::value toJson( const std::vector& val );
template
+ static web::json::value toJson( const std::set& val );
+ template
static web::json::value toJson( const std::map& val );
static bool fromString( const utility::string_t& val, bool & );
@@ -96,6 +101,8 @@ class ModelBase
template
static bool fromString( const utility::string_t& val, std::vector & );
template
+ static bool fromString( const utility::string_t& val, std::set & );
+ template
static bool fromString( const utility::string_t& val, std::map & );
static bool fromJson( const web::json::value& val, bool & );
@@ -113,6 +120,8 @@ class ModelBase
template
static bool fromJson( const web::json::value& val, std::vector & );
template
+ static bool fromJson( const web::json::value& val, std::set & );
+ template
static bool fromJson( const web::json::value& val, std::map & );
@@ -131,6 +140,8 @@ class ModelBase
template
static std::shared_ptr toHttpContent( const utility::string_t& name, const std::vector& value, const utility::string_t& contentType = utility::conversions::to_string_t("") );
template
+ static std::shared_ptr toHttpContent( const utility::string_t& name, const std::set& value, const utility::string_t& contentType = utility::conversions::to_string_t("") );
+ template
static std::shared_ptr toHttpContent( const utility::string_t& name, const std::map& value, const utility::string_t& contentType = utility::conversions::to_string_t("") );
static bool fromHttpContent( std::shared_ptr val, bool & );
@@ -147,6 +158,8 @@ class ModelBase
template
static bool fromHttpContent( std::shared_ptr val, std::vector & );
template
+ static bool fromHttpContent( std::shared_ptr val, std::set & );
+ template
static bool fromHttpContent( std::shared_ptr val, std::map & );
static utility::string_t toBase64( utility::string_t value );
@@ -166,6 +179,8 @@ utility::string_t ModelBase::toString( const std::shared_ptr& val )
}
return utility::string_t(ss.str());
}
+
+// std::vector to string
template
utility::string_t ModelBase::toString( const std::vector & val )
{
@@ -180,6 +195,24 @@ utility::string_t ModelBase::toString( const std::vector & val )
}
return strArray;
}
+
+// std::set to string
+template
+utility::string_t ModelBase::toString( const std::set & val )
+{
+ utility::string_t strArray;
+ for ( const auto &item : val )
+ {
+ strArray.append( toString(item) + "," );
+ }
+ if (val.count() > 0)
+ {
+ strArray.pop_back();
+ }
+ return strArray;
+}
+
+
template
web::json::value ModelBase::toJson( const std::shared_ptr& val )
{
@@ -190,6 +223,8 @@ web::json::value ModelBase::toJson( const std::shared_ptr& val )
}
return retVal;
}
+
+// std::vector to json
template
web::json::value ModelBase::toJson( const std::vector& value )
{
@@ -200,6 +235,21 @@ web::json::value ModelBase::toJson( const std::vector& value )
}
return web::json::value::array(ret);
}
+
+// std::set to json
+template
+web::json::value ModelBase::toJson( const std::set& value )
+{
+ // There's no protoype web::json::value::array(...) taking a std::set parameter. Converting to std::vector to get an array.
+ std::vector ret;
+ for ( const auto& x : value )
+ {
+ ret.push_back( toJson(x) );
+ }
+ return web::json::value::array(ret);
+}
+
+
template
web::json::value ModelBase::toJson( const std::map& val )
{
@@ -290,6 +340,7 @@ std::shared_ptr ModelBase::toHttpContent(const utility::string_t& n
}
return content;
}
+
template
std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, const std::vector& value, const utility::string_t& contentType )
{
@@ -301,6 +352,7 @@ std::shared_ptr ModelBase::toHttpContent( const utility::string_t&
content->setData( std::shared_ptr( new std::stringstream( utility::conversions::to_utf8string(json_array.serialize()) ) ) );
return content;
}
+
template
std::shared_ptr ModelBase::toHttpContent( const utility::string_t& name, const std::map& value, const utility::string_t& contentType )
{
diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/PetApi.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/PetApi.h
index acf70da46d3cd..275bda18c4708 100644
--- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/PetApi.h
+++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/PetApi.h
@@ -52,9 +52,9 @@ class PetApi
///
///
///
- /// Pet object that needs to be added to the store
- pplx::task addPet(
- std::shared_ptr body
+ /// Pet object that needs to be added to the store
+ pplx::task> addPet(
+ std::shared_ptr pet
) const;
///
/// Deletes a pet
@@ -104,9 +104,9 @@ class PetApi
///
///
///
- /// Pet object that needs to be added to the store
- pplx::task updatePet(
- std::shared_ptr body
+ /// Pet object that needs to be added to the store
+ pplx::task> updatePet(
+ std::shared_ptr pet
) const;
///
/// Updates a pet in the store with form data
diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/StoreApi.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/StoreApi.h
index db0f8e55fce67..e030a86d67eaf 100644
--- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/StoreApi.h
+++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/StoreApi.h
@@ -78,9 +78,9 @@ class StoreApi
///
///
///
- /// order placed for purchasing the pet
+ /// order placed for purchasing the pet
pplx::task> placeOrder(
- std::shared_ptr body
+ std::shared_ptr order
) const;
protected:
diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/UserApi.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/UserApi.h
index c8189772f6fe7..9e0c7b544f93f 100644
--- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/UserApi.h
+++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/api/UserApi.h
@@ -50,9 +50,9 @@ class UserApi
///
/// This can only be done by the logged in user.
///
- /// Created user object
+ /// Created user object
pplx::task createUser(
- std::shared_ptr body
+ std::shared_ptr user
) const;
///
/// Creates list of users with given input array
@@ -60,9 +60,9 @@ class UserApi
///
///
///
- /// List of user object
+ /// List of user object
pplx::task createUsersWithArrayInput(
- std::vector> body
+ std::vector> user
) const;
///
/// Creates list of users with given input array
@@ -70,9 +70,9 @@ class UserApi
///
///
///
- /// List of user object
+ /// List of user object
pplx::task createUsersWithListInput(
- std::vector> body
+ std::vector> user
) const;
///
/// Delete user
@@ -121,10 +121,10 @@ class UserApi
/// This can only be done by the logged in user.
///
/// name that need to be deleted
- /// Updated user object
+ /// Updated user object
pplx::task updateUser(
utility::string_t username,
- std::shared_ptr body
+ std::shared_ptr user
) const;
protected:
diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Pet_vaccinationBook.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Pet_vaccinationBook.h
new file mode 100644
index 0000000000000..e82de6ab65aac
--- /dev/null
+++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Pet_vaccinationBook.h
@@ -0,0 +1,79 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * NOTE: This class is auto generated by OpenAPI-Generator 7.6.0-SNAPSHOT.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+/*
+ * Pet_vaccinationBook.h
+ *
+ * Vaccination book of the pet
+ */
+
+#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_Pet_vaccinationBook_H_
+#define ORG_OPENAPITOOLS_CLIENT_MODEL_Pet_vaccinationBook_H_
+
+
+#include "CppRestPetstoreClient/ModelBase.h"
+
+#include "CppRestPetstoreClient/model/Vaccine.h"
+#include
+
+namespace org {
+namespace openapitools {
+namespace client {
+namespace model {
+
+class Vaccine;
+
+///
+/// Vaccination book of the pet
+///
+class Pet_vaccinationBook
+ : public ModelBase
+{
+public:
+ Pet_vaccinationBook();
+ virtual ~Pet_vaccinationBook();
+
+ /////////////////////////////////////////////
+ /// ModelBase overrides
+
+ void validate() override;
+
+ web::json::value toJson() const override;
+ bool fromJson(const web::json::value& json) override;
+
+ void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override;
+ bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override;
+
+ /////////////////////////////////////////////
+ /// Pet_vaccinationBook members
+
+ ///
+ ///
+ ///
+ std::set>& getVaccines();
+ bool vaccinesIsSet() const;
+ void unsetVaccines();
+
+ void setVaccines(const std::set>& value);
+
+
+protected:
+ std::set> m_Vaccines;
+ bool m_VaccinesIsSet;
+};
+
+
+}
+}
+}
+}
+
+#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_Pet_vaccinationBook_H_ */
diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet.h
new file mode 100644
index 0000000000000..9951d5d10a414
--- /dev/null
+++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet.h
@@ -0,0 +1,91 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * NOTE: This class is auto generated by OpenAPI-Generator 7.6.0-SNAPSHOT.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+/*
+ * SchemaWithSet.h
+ *
+ * Schema with a set property
+ */
+
+#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_SchemaWithSet_H_
+#define ORG_OPENAPITOOLS_CLIENT_MODEL_SchemaWithSet_H_
+
+
+#include "CppRestPetstoreClient/ModelBase.h"
+
+#include "CppRestPetstoreClient/model/SchemaWithSet_vaccinationBook.h"
+#include
+#include
+
+namespace org {
+namespace openapitools {
+namespace client {
+namespace model {
+
+class SchemaWithSet_vaccinationBook;
+
+///
+/// Schema with a set property
+///
+class SchemaWithSet
+ : public ModelBase
+{
+public:
+ SchemaWithSet();
+ virtual ~SchemaWithSet();
+
+ /////////////////////////////////////////////
+ /// ModelBase overrides
+
+ void validate() override;
+
+ web::json::value toJson() const override;
+ bool fromJson(const web::json::value& json) override;
+
+ void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override;
+ bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override;
+
+ /////////////////////////////////////////////
+ /// SchemaWithSet members
+
+ ///
+ /// pedigree and other certificates
+ ///
+ std::set& getCertificates();
+ bool certificatesIsSet() const;
+ void unsetCertificates();
+
+ void setCertificates(const std::set& value);
+
+ ///
+ ///
+ ///
+ std::shared_ptr getVaccinationBook() const;
+ bool vaccinationBookIsSet() const;
+ void unsetVaccinationBook();
+
+ void setVaccinationBook(const std::shared_ptr& value);
+
+
+protected:
+ std::set m_Certificates;
+ bool m_CertificatesIsSet;
+ std::shared_ptr m_VaccinationBook;
+ bool m_VaccinationBookIsSet;
+};
+
+
+}
+}
+}
+}
+
+#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_SchemaWithSet_H_ */
diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet_vaccinationBook.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet_vaccinationBook.h
new file mode 100644
index 0000000000000..1712b2fc1b516
--- /dev/null
+++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithSet_vaccinationBook.h
@@ -0,0 +1,79 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * NOTE: This class is auto generated by OpenAPI-Generator 7.6.0-SNAPSHOT.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+/*
+ * SchemaWithSet_vaccinationBook.h
+ *
+ * Vaccination book of the pet
+ */
+
+#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_SchemaWithSet_vaccinationBook_H_
+#define ORG_OPENAPITOOLS_CLIENT_MODEL_SchemaWithSet_vaccinationBook_H_
+
+
+#include "CppRestPetstoreClient/ModelBase.h"
+
+#include "CppRestPetstoreClient/model/Vaccine.h"
+#include
+
+namespace org {
+namespace openapitools {
+namespace client {
+namespace model {
+
+class Vaccine;
+
+///
+/// Vaccination book of the pet
+///
+class SchemaWithSet_vaccinationBook
+ : public ModelBase
+{
+public:
+ SchemaWithSet_vaccinationBook();
+ virtual ~SchemaWithSet_vaccinationBook();
+
+ /////////////////////////////////////////////
+ /// ModelBase overrides
+
+ void validate() override;
+
+ web::json::value toJson() const override;
+ bool fromJson(const web::json::value& json) override;
+
+ void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override;
+ bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override;
+
+ /////////////////////////////////////////////
+ /// SchemaWithSet_vaccinationBook members
+
+ ///
+ ///
+ ///
+ std::set>& getVaccines();
+ bool vaccinesIsSet() const;
+ void unsetVaccines();
+
+ void setVaccines(const std::set>& value);
+
+
+protected:
+ std::set> m_Vaccines;
+ bool m_VaccinesIsSet;
+};
+
+
+}
+}
+}
+}
+
+#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_SchemaWithSet_vaccinationBook_H_ */
diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Vaccine.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Vaccine.h
new file mode 100644
index 0000000000000..81eceace2a77a
--- /dev/null
+++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/Vaccine.h
@@ -0,0 +1,88 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * NOTE: This class is auto generated by OpenAPI-Generator 7.6.0-SNAPSHOT.
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+/*
+ * Vaccine.h
+ *
+ *
+ */
+
+#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_Vaccine_H_
+#define ORG_OPENAPITOOLS_CLIENT_MODEL_Vaccine_H_
+
+
+#include "CppRestPetstoreClient/ModelBase.h"
+
+#include "CppRestPetstoreClient/AnyType.h"
+
+namespace org {
+namespace openapitools {
+namespace client {
+namespace model {
+
+
+///
+///
+///
+class Vaccine
+ : public ModelBase
+{
+public:
+ Vaccine();
+ virtual ~Vaccine();
+
+ /////////////////////////////////////////////
+ /// ModelBase overrides
+
+ void validate() override;
+
+ web::json::value toJson() const override;
+ bool fromJson(const web::json::value& json) override;
+
+ void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override;
+ bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override;
+
+ /////////////////////////////////////////////
+ /// Vaccine members
+
+ ///
+ /// vaccination date
+ ///
+ std::shared_ptr getDate() const;
+ bool dateIsSet() const;
+ void unsetdate();
+
+ void setDate(const std::shared_ptr& value);
+
+ ///
+ /// true if a booster is still needed to complete the vaccination
+ ///
+ bool isBoosterRequired() const;
+ bool boosterRequiredIsSet() const;
+ void unsetBoosterRequired();
+
+ void setBoosterRequired(bool value);
+
+
+protected:
+ std::shared_ptr m_date;
+ bool m_dateIsSet;
+ bool m_BoosterRequired;
+ bool m_BoosterRequiredIsSet;
+};
+
+
+}
+}
+}
+}
+
+#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_Vaccine_H_ */
diff --git a/samples/client/petstore/cpp-restsdk/client/src/api/PetApi.cpp b/samples/client/petstore/cpp-restsdk/client/src/api/PetApi.cpp
index 430eb99771c4c..ff8a1b23ad830 100644
--- a/samples/client/petstore/cpp-restsdk/client/src/api/PetApi.cpp
+++ b/samples/client/petstore/cpp-restsdk/client/src/api/PetApi.cpp
@@ -35,13 +35,13 @@ PetApi::~PetApi()
{
}
-pplx::task PetApi::addPet(std::shared_ptr body) const
+pplx::task> PetApi::addPet(std::shared_ptr pet) const
{
- // verify the required parameter 'body' is set
- if (body == nullptr)
+ // verify the required parameter 'pet' is set
+ if (pet == nullptr)
{
- throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'body' when calling PetApi->addPet"));
+ throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'pet' when calling PetApi->addPet"));
}
@@ -54,6 +54,8 @@ pplx::task PetApi::addPet(std::shared_ptr body) const
std::map> localVarFileParams;
std::unordered_set localVarResponseHttpContentTypes;
+ localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") );
+ localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
utility::string_t localVarResponseHttpContentType;
@@ -93,7 +95,7 @@ pplx::task PetApi::addPet(std::shared_ptr body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
web::json::value localVarJson;
- localVarJson = ModelBase::toJson(body);
+ localVarJson = ModelBase::toJson(pet);
localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) );
@@ -104,9 +106,9 @@ pplx::task PetApi::addPet(std::shared_ptr body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
std::shared_ptr localVarMultipart(new MultipartFormData);
- if(body.get())
+ if(pet.get())
{
- body->toMultipart(localVarMultipart, utility::conversions::to_string_t("body"));
+ pet->toMultipart(localVarMultipart, utility::conversions::to_string_t("pet"));
}
@@ -161,7 +163,25 @@ pplx::task PetApi::addPet(std::shared_ptr body) const
})
.then([=](utility::string_t localVarResponse)
{
- return void();
+ std::shared_ptr localVarResult(new Pet());
+
+ if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
+ {
+ web::json::value localVarJson = web::json::value::parse(localVarResponse);
+
+ ModelBase::fromJson(localVarJson, localVarResult);
+ }
+ // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data"))
+ // {
+ // TODO multipart response parsing
+ // }
+ else
+ {
+ throw ApiException(500
+ , utility::conversions::to_string_t("error calling addPet: unsupported response type"));
+ }
+
+ return localVarResult;
});
}
pplx::task PetApi::deletePet(int64_t petId, boost::optional apiKey) const
@@ -670,13 +690,13 @@ pplx::task> PetApi::getPetById(int64_t petId) const
return localVarResult;
});
}
-pplx::task PetApi::updatePet(std::shared_ptr body) const
+pplx::task> PetApi::updatePet(std::shared_ptr pet) const
{
- // verify the required parameter 'body' is set
- if (body == nullptr)
+ // verify the required parameter 'pet' is set
+ if (pet == nullptr)
{
- throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'body' when calling PetApi->updatePet"));
+ throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'pet' when calling PetApi->updatePet"));
}
@@ -689,6 +709,8 @@ pplx::task PetApi::updatePet(std::shared_ptr body) const
std::map> localVarFileParams;
std::unordered_set localVarResponseHttpContentTypes;
+ localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/xml") );
+ localVarResponseHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
utility::string_t localVarResponseHttpContentType;
@@ -728,7 +750,7 @@ pplx::task PetApi::updatePet(std::shared_ptr body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
web::json::value localVarJson;
- localVarJson = ModelBase::toJson(body);
+ localVarJson = ModelBase::toJson(pet);
localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) );
@@ -739,9 +761,9 @@ pplx::task PetApi::updatePet(std::shared_ptr body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
std::shared_ptr localVarMultipart(new MultipartFormData);
- if(body.get())
+ if(pet.get())
{
- body->toMultipart(localVarMultipart, utility::conversions::to_string_t("body"));
+ pet->toMultipart(localVarMultipart, utility::conversions::to_string_t("pet"));
}
@@ -796,7 +818,25 @@ pplx::task PetApi::updatePet(std::shared_ptr body) const
})
.then([=](utility::string_t localVarResponse)
{
- return void();
+ std::shared_ptr localVarResult(new Pet());
+
+ if(localVarResponseHttpContentType == utility::conversions::to_string_t("application/json"))
+ {
+ web::json::value localVarJson = web::json::value::parse(localVarResponse);
+
+ ModelBase::fromJson(localVarJson, localVarResult);
+ }
+ // else if(localVarResponseHttpContentType == utility::conversions::to_string_t("multipart/form-data"))
+ // {
+ // TODO multipart response parsing
+ // }
+ else
+ {
+ throw ApiException(500
+ , utility::conversions::to_string_t("error calling updatePet: unsupported response type"));
+ }
+
+ return localVarResult;
});
}
pplx::task PetApi::updatePetWithForm(int64_t petId, boost::optional name, boost::optional status) const
diff --git a/samples/client/petstore/cpp-restsdk/client/src/api/StoreApi.cpp b/samples/client/petstore/cpp-restsdk/client/src/api/StoreApi.cpp
index 25617af00acb1..c7608091749a9 100644
--- a/samples/client/petstore/cpp-restsdk/client/src/api/StoreApi.cpp
+++ b/samples/client/petstore/cpp-restsdk/client/src/api/StoreApi.cpp
@@ -398,13 +398,13 @@ pplx::task> StoreApi::getOrderById(int64_t orderId) const
return localVarResult;
});
}
-pplx::task> StoreApi::placeOrder(std::shared_ptr body) const
+pplx::task> StoreApi::placeOrder(std::shared_ptr order) const
{
- // verify the required parameter 'body' is set
- if (body == nullptr)
+ // verify the required parameter 'order' is set
+ if (order == nullptr)
{
- throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'body' when calling StoreApi->placeOrder"));
+ throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'order' when calling StoreApi->placeOrder"));
}
@@ -445,6 +445,7 @@ pplx::task> StoreApi::placeOrder(std::shared_ptr b
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set localVarConsumeHttpContentTypes;
+ localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
std::shared_ptr localVarHttpBody;
@@ -456,7 +457,7 @@ pplx::task> StoreApi::placeOrder(std::shared_ptr b
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
web::json::value localVarJson;
- localVarJson = ModelBase::toJson(body);
+ localVarJson = ModelBase::toJson(order);
localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) );
@@ -467,9 +468,9 @@ pplx::task> StoreApi::placeOrder(std::shared_ptr b
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
std::shared_ptr localVarMultipart(new MultipartFormData);
- if(body.get())
+ if(order.get())
{
- body->toMultipart(localVarMultipart, utility::conversions::to_string_t("body"));
+ order->toMultipart(localVarMultipart, utility::conversions::to_string_t("order"));
}
diff --git a/samples/client/petstore/cpp-restsdk/client/src/api/UserApi.cpp b/samples/client/petstore/cpp-restsdk/client/src/api/UserApi.cpp
index 398620a7238de..d877c40a70d58 100644
--- a/samples/client/petstore/cpp-restsdk/client/src/api/UserApi.cpp
+++ b/samples/client/petstore/cpp-restsdk/client/src/api/UserApi.cpp
@@ -35,13 +35,13 @@ UserApi::~UserApi()
{
}
-pplx::task UserApi::createUser(std::shared_ptr body) const
+pplx::task UserApi::createUser(std::shared_ptr user) const
{
- // verify the required parameter 'body' is set
- if (body == nullptr)
+ // verify the required parameter 'user' is set
+ if (user == nullptr)
{
- throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'body' when calling UserApi->createUser"));
+ throw ApiException(400, utility::conversions::to_string_t("Missing required parameter 'user' when calling UserApi->createUser"));
}
@@ -80,6 +80,7 @@ pplx::task UserApi::createUser(std::shared_ptr body) const
localVarHeaderParams[utility::conversions::to_string_t("Accept")] = localVarResponseHttpContentType;
std::unordered_set localVarConsumeHttpContentTypes;
+ localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
std::shared_ptr localVarHttpBody;
@@ -91,7 +92,7 @@ pplx::task UserApi::createUser(std::shared_ptr body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("application/json");
web::json::value localVarJson;
- localVarJson = ModelBase::toJson(body);
+ localVarJson = ModelBase::toJson(user);
localVarHttpBody = std::shared_ptr( new JsonBody( localVarJson ) );
@@ -102,9 +103,9 @@ pplx::task UserApi::createUser(std::shared_ptr body) const
localVarRequestHttpContentType = utility::conversions::to_string_t("multipart/form-data");
std::shared_ptr localVarMultipart(new MultipartFormData);
- if(body.get())
+ if(user.get())
{
- body->toMultipart(localVarMultipart, utility::conversions::to_string_t("body"));
+ user->toMultipart(localVarMultipart, utility::conversions::to_string_t("user"));
}
@@ -120,6 +121,14 @@ pplx::task UserApi::createUser(std::shared_ptr body) const
throw ApiException(415, utility::conversions::to_string_t("UserApi->createUser does not consume any supported media type"));
}
+ // authentication (api_key) required
+ {
+ utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key"));
+ if ( localVarApiKey.size() > 0 )
+ {
+ localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey;
+ }
+ }
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=](web::http::http_response localVarResponse)
@@ -160,7 +169,7 @@ pplx::task UserApi::createUser(std::shared_ptr body) const
return void();
});
}
-pplx::task UserApi::createUsersWithArrayInput(std::vector> body) const
+pplx::task UserApi::createUsersWithArrayInput(std::vector> user) const
{
@@ -199,6 +208,7 @@ pplx::task UserApi::createUsersWithArrayInput(std::vector localVarConsumeHttpContentTypes;
+ localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
std::shared_ptr localVarHttpBody;
@@ -212,7 +222,7 @@ pplx::task UserApi::createUsersWithArrayInput(std::vector localVarJsonArray;
- for( auto& localVarItem : body )
+ for( auto& localVarItem : user )
{
localVarJsonArray.push_back( localVarItem.get() ? localVarItem->toJson() : web::json::value::null() );
@@ -230,11 +240,11 @@ pplx::task UserApi::createUsersWithArrayInput(std::vector localVarJsonArray;
- for( auto& localVarItem : body )
+ for( auto& localVarItem : user )
{
localVarJsonArray.push_back(ModelBase::toJson(localVarItem));
}
- localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("body"), localVarJsonArray, utility::conversions::to_string_t("application/json")));
+ localVarMultipart->add(ModelBase::toHttpContent(utility::conversions::to_string_t("user"), localVarJsonArray, utility::conversions::to_string_t("application/json")));
}
@@ -250,6 +260,14 @@ pplx::task UserApi::createUsersWithArrayInput(std::vectorcreateUsersWithArrayInput does not consume any supported media type"));
}
+ // authentication (api_key) required
+ {
+ utility::string_t localVarApiKey = localVarApiConfiguration->getApiKey(utility::conversions::to_string_t("api_key"));
+ if ( localVarApiKey.size() > 0 )
+ {
+ localVarHeaderParams[utility::conversions::to_string_t("api_key")] = localVarApiKey;
+ }
+ }
return m_ApiClient->callApi(localVarPath, utility::conversions::to_string_t("POST"), localVarQueryParams, localVarHttpBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarRequestHttpContentType)
.then([=](web::http::http_response localVarResponse)
@@ -290,7 +308,7 @@ pplx::task UserApi::createUsersWithArrayInput(std::vector UserApi::createUsersWithListInput(std::vector> body) const
+pplx::task UserApi::createUsersWithListInput(std::vector> user) const
{
@@ -329,6 +347,7 @@ pplx::task UserApi::createUsersWithListInput(std::vector localVarConsumeHttpContentTypes;
+ localVarConsumeHttpContentTypes.insert( utility::conversions::to_string_t("application/json") );
std::shared_ptr localVarHttpBody;
@@ -342,7 +361,7 @@ pplx::task UserApi::createUsersWithListInput(std::vector localVarJsonArray;
- for( auto& localVarItem : body )
+ for( auto& localVarItem : user )
{
localVarJsonArray.push_back( localVarItem.get() ? localVarItem->toJson() : web::json::value::null() );
@@ -360,11 +379,11 @@ pplx::task