diff --git a/README.md b/README.md
index ec9b3822b9..0e45c2ff47 100644
--- a/README.md
+++ b/README.md
@@ -614,6 +614,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [MailSlurp](https://www.mailslurp.com)
- [Médiavision](https://www.mediavision.fr/)
- [Metaswitch](https://www.metaswitch.com/)
+- [MoonVision](https://www.moonvision.io/)
- [Myworkout](https://myworkout.com)
- [NamSor](https://www.namsor.com/)
- [Openet](https://www.openet.com/)
@@ -749,6 +750,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- 2020-03-10 - [OpenAPI Generator Meetup #1](https://speakerdeck.com/akihito_nakano/openapi-generator-meetup-number-1) by [中野暁人](https://github.com/ackintosh) at [OpenAPI Generator Meetup #1](https://openapi-generator-meetup.connpass.com/event/168187/)
- 2020-03-15 - [Load Testing Your API with Swagger/OpenAPI and k6](https://k6.io/blog/load-testing-your-api-with-swagger-openapi-and-k6)
- 2020-04-13 - [俺的【OAS】との向き合い方 (爆速でOpenAPIと友達になろう)](https://tech-blog.optim.co.jp/entry/2020/04/13/100000) in [OPTim Blog](https://tech-blog.optim.co.jp/)
+- 2020-04-22 - [Introduction to OpenAPI Generator](https://nordicapis.com/introduction-to-openapi-generator/) by [Kristopher Sandoval](https://nordicapis.com/author/sandovaleffect/) in [Nordic APIs](https://nordicapis.com/)
## [6 - About Us](#table-of-contents)
diff --git a/bin/java-petstore-jersey2-experimental.json b/bin/java-petstore-jersey2-experimental.json
new file mode 100644
index 0000000000..156775302d
--- /dev/null
+++ b/bin/java-petstore-jersey2-experimental.json
@@ -0,0 +1,4 @@
+{
+ "library": "jersey2-experimental",
+ "artifactId": "petstore-jersey2-exp"
+}
diff --git a/bin/java-petstore-jersey2-experimental.sh b/bin/java-petstore-jersey2-experimental.sh
new file mode 100755
index 0000000000..2bd023c97b
--- /dev/null
+++ b/bin/java-petstore-jersey2-experimental.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+SCRIPT="$0"
+echo "# START SCRIPT: $SCRIPT"
+
+while [ -h "$SCRIPT" ] ; do
+ ls=`ls -ld "$SCRIPT"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ SCRIPT="$link"
+ else
+ SCRIPT=`dirname "$SCRIPT"`/"$link"
+ fi
+done
+
+if [ ! -d "${APP_DIR}" ]; then
+ APP_DIR=`dirname "$SCRIPT"`/..
+ APP_DIR=`cd "${APP_DIR}"; pwd`
+fi
+
+executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
+
+if [ ! -f "$executable" ]
+then
+ mvn -B clean package
+fi
+
+# if you've executed sbt assembly previously it will use that instead.
+export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
+ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-jersey2-experimental.json -o samples/client/petstore/java/jersey2-experimental -t modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental --additional-properties hideGenerationTimestamp=true $@"
+
+echo "Removing files and folders under samples/client/petstore/java/jersey2-experimental/src/main"
+rm -rf samples/client/petstore/java/jersey2-experimental/src/main
+find samples/client/petstore/java/jersey2-experimental -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
+java $JAVA_OPTS -jar $executable $ags
+
+#mvn com.coveo:fmt-maven-plugin:format -f samples/client/petstore/java/jersey2-experimental/pom.xml
+
+# copy additional manually written unit-tests
+#mkdir samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client
+#mkdir samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/auth
+#mkdir samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model
+
+#cp CI/samples.ci/client/petstore/java/test-manual/common/StringUtilTest.java samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/StringUtilTest.java
+#cp CI/samples.ci/client/petstore/java/test-manual/jersey2/ApiClientTest.java samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/ApiClientTest.java
+#cp CI/samples.ci/client/petstore/java/test-manual/common/ConfigurationTest.java samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/ConfigurationTest.java
+#cp CI/samples.ci/client/petstore/java/test-manual/jersey2/auth/ApiKeyAuthTest.java samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/auth/ApiKeyAuthTest.java
+#cp CI/samples.ci/client/petstore/java/test-manual/jersey2/auth/HttpBasicAuthTest.java samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/auth/HttpBasicAuthTest.java
+#cp CI/samples.ci/client/petstore/java/test-manual/jersey2/model/EnumValueTest.java samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/EnumValueTest.java
+#cp CI/samples.ci/client/petstore/java/test-manual/jersey2/JSONTest.java samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/JSONTest.java
diff --git a/docs/generators/ada-server.md b/docs/generators/ada-server.md
index 9a86032ec7..7f804ddf0d 100644
--- a/docs/generators/ada-server.md
+++ b/docs/generators/ada-server.md
@@ -7,6 +7,16 @@ sidebar_label: ada-server
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|projectName|GNAT project name| |defaultProject|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/ada.md b/docs/generators/ada.md
index 2b382b4c4f..c5d73461dc 100644
--- a/docs/generators/ada.md
+++ b/docs/generators/ada.md
@@ -7,6 +7,16 @@ sidebar_label: ada
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|projectName|GNAT project name| |defaultProject|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/android.md b/docs/generators/android.md
index 4eeeec214b..430500d9e6 100644
--- a/docs/generators/android.md
+++ b/docs/generators/android.md
@@ -15,6 +15,16 @@ sidebar_label: android
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|groupId|groupId for use in the generated build.gradle and pom.xml| |null|
|invokerPackage|root package for generated code| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|library|library template (sub-template) to use|
**volley**
HTTP client: Volley 1.0.19 (default)
**httpclient**
HTTP client: Apache HttpClient 4.3.6. JSON processing: Gson 2.3.1. IMPORTANT: Android client using HttpClient is not actively maintained and will be depecreated in the next major release.
|null|
|modelPackage|package for generated models| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/apache2.md b/docs/generators/apache2.md
index cfa9756c7d..8b92e02dd1 100644
--- a/docs/generators/apache2.md
+++ b/docs/generators/apache2.md
@@ -7,6 +7,16 @@ sidebar_label: apache2
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/apex.md b/docs/generators/apex.md
index 06c54e3b97..80ac5bd24f 100644
--- a/docs/generators/apex.md
+++ b/docs/generators/apex.md
@@ -10,6 +10,16 @@ sidebar_label: apex
|buildMethod|The build method for this package.| |null|
|classPrefix|Prefix for generated classes. Set this to avoid overwriting existing classes in your org.| |null|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|namedCredential|The named credential name for the HTTP callouts| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/asciidoc.md b/docs/generators/asciidoc.md
index 66a175518b..777a62080c 100644
--- a/docs/generators/asciidoc.md
+++ b/docs/generators/asciidoc.md
@@ -16,6 +16,16 @@ sidebar_label: asciidoc
|infoEmail|an email address to contact for inquiries about the application| |null|
|infoUrl|a URL where users can get more information about the application| |null|
|invokerPackage|root package for generated code| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseInfo|a short description of the license| |null|
|licenseUrl|a URL pointing to the full license| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/avro-schema.md b/docs/generators/avro-schema.md
index 13ca849949..6f0621b747 100644
--- a/docs/generators/avro-schema.md
+++ b/docs/generators/avro-schema.md
@@ -7,6 +7,16 @@ sidebar_label: avro-schema
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|packageName|package for generated classes (where supported)| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/bash.md b/docs/generators/bash.md
index b91eb990a6..3d626eff72 100644
--- a/docs/generators/bash.md
+++ b/docs/generators/bash.md
@@ -13,6 +13,16 @@ sidebar_label: bash
|generateBashCompletion|Whether to generate the Bash completion script| |false|
|generateZshCompletion|Whether to generate the Zsh completion script| |false|
|hostEnvironmentVariable|Name of environment variable where host can be defined (e.g. PETSTORE_HOST='http://api.openapitools.org:8080')| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|processMarkdown|Convert all Markdown Markup into terminal formatting| |false|
|scriptName|The name of the script that will be generated (e.g. petstore-cli)| |null|
diff --git a/docs/generators/c.md b/docs/generators/c.md
index ee9b258669..8ebc3221fa 100644
--- a/docs/generators/c.md
+++ b/docs/generators/c.md
@@ -8,6 +8,16 @@ sidebar_label: c
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/clojure.md b/docs/generators/clojure.md
index b2f3a6a4d9..e42936d9f8 100644
--- a/docs/generators/clojure.md
+++ b/docs/generators/clojure.md
@@ -8,6 +8,16 @@ sidebar_label: clojure
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|baseNamespace|the base/top namespace (Default: generated from projectName)| |null|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|projectDescription|description of the project (Default: using info.description or "Client library of <projectName>")| |null|
|projectLicenseName|name of the license the project uses (Default: using info.license.name or not included in project.clj)| |null|
diff --git a/docs/generators/cpp-qt5-client.md b/docs/generators/cpp-qt5-client.md
index bc55db1452..9a043e5323 100644
--- a/docs/generators/cpp-qt5-client.md
+++ b/docs/generators/cpp-qt5-client.md
@@ -9,6 +9,16 @@ sidebar_label: cpp-qt5-client
|contentCompression|Enable Compressed Content Encoding for requests and responses| |false|
|cppNamespace|C++ namespace (convention: name::space::for::api).| |OpenAPI|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelNamePrefix|Prefix that will be prepended to all model names.| |OAI|
|optionalProjectFile|Generate client.pri.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/cpp-qt5-qhttpengine-server.md b/docs/generators/cpp-qt5-qhttpengine-server.md
index 2b2cd4e9f1..574a019f13 100644
--- a/docs/generators/cpp-qt5-qhttpengine-server.md
+++ b/docs/generators/cpp-qt5-qhttpengine-server.md
@@ -9,6 +9,16 @@ sidebar_label: cpp-qt5-qhttpengine-server
|contentCompression|Enable Compressed Content Encoding for requests and responses| |false|
|cppNamespace|C++ namespace (convention: name::space::for::api).| |OpenAPI|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelNamePrefix|Prefix that will be prepended to all model names.| |OAI|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_|
diff --git a/docs/generators/cpp-tizen.md b/docs/generators/cpp-tizen.md
index f805721b57..16022f8f53 100644
--- a/docs/generators/cpp-tizen.md
+++ b/docs/generators/cpp-tizen.md
@@ -7,6 +7,16 @@ sidebar_label: cpp-tizen
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/cwiki.md b/docs/generators/cwiki.md
index f2d5342f8f..bf7949015b 100644
--- a/docs/generators/cwiki.md
+++ b/docs/generators/cwiki.md
@@ -15,6 +15,16 @@ sidebar_label: cwiki
|infoEmail|an email address to contact for inquiries about the application| |null|
|infoUrl|a URL where users can get more information about the application| |null|
|invokerPackage|root package for generated code| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseInfo|a short description of the license| |null|
|licenseUrl|a URL pointing to the full license| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/dart-dio.md b/docs/generators/dart-dio.md
index 05514b9a1e..fd16331b9a 100644
--- a/docs/generators/dart-dio.md
+++ b/docs/generators/dart-dio.md
@@ -9,6 +9,16 @@ sidebar_label: dart-dio
|browserClient|Is the client browser based (for Dart 1.x only)| |null|
|dateLibrary|Option. Date library to use|
**core**
Dart core library (DateTime)
**timemachine**
Time Machine is date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.
|core|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|nullableFields|Is the null fields should be in the JSON payload| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|pubAuthor|Author name in generated pubspec| |null|
diff --git a/docs/generators/dart-jaguar.md b/docs/generators/dart-jaguar.md
index 5e81f82025..995676b9a1 100644
--- a/docs/generators/dart-jaguar.md
+++ b/docs/generators/dart-jaguar.md
@@ -8,6 +8,16 @@ sidebar_label: dart-jaguar
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|browserClient|Is the client browser based (for Dart 1.x only)| |null|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|nullableFields|Is the null fields should be in the JSON payload| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|pubAuthor|Author name in generated pubspec| |null|
diff --git a/docs/generators/dart.md b/docs/generators/dart.md
index 993c31cf44..7cad220b66 100644
--- a/docs/generators/dart.md
+++ b/docs/generators/dart.md
@@ -8,6 +8,16 @@ sidebar_label: dart
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|browserClient|Is the client browser based (for Dart 1.x only)| |null|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|pubAuthor|Author name in generated pubspec| |null|
|pubAuthorEmail|Email address of the author in generated pubspec| |null|
diff --git a/docs/generators/dynamic-html.md b/docs/generators/dynamic-html.md
index b252e414bd..6d120dd987 100644
--- a/docs/generators/dynamic-html.md
+++ b/docs/generators/dynamic-html.md
@@ -11,6 +11,16 @@ sidebar_label: dynamic-html
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|groupId|groupId in generated pom.xml| |null|
|invokerPackage|root package for generated code| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/elixir.md b/docs/generators/elixir.md
index 14afa95bc9..9dc1c27d18 100644
--- a/docs/generators/elixir.md
+++ b/docs/generators/elixir.md
@@ -8,6 +8,16 @@ sidebar_label: elixir
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|invokerPackage|The main namespace to use for all classes. e.g. Yay.Pets| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseHeader|The license header to prepend to the top of all source files.| |null|
|packageName|Elixir package name (convention: lowercase).| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/fsharp-functions.md b/docs/generators/fsharp-functions.md
index a7e28602b3..456a7daaa4 100644
--- a/docs/generators/fsharp-functions.md
+++ b/docs/generators/fsharp-functions.md
@@ -7,6 +7,16 @@ sidebar_label: fsharp-functions
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseName|The name of the license| |NoLicense|
|licenseUrl|The URL of the license| |http://localhost|
|packageAuthors|Specifies Authors property in the .NET Core project file.| |OpenAPI|
diff --git a/docs/generators/groovy.md b/docs/generators/groovy.md
index 32699d5a12..dbdec26031 100644
--- a/docs/generators/groovy.md
+++ b/docs/generators/groovy.md
@@ -25,6 +25,16 @@ sidebar_label: groovy
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model|
diff --git a/docs/generators/haskell-http-client.md b/docs/generators/haskell-http-client.md
index 41163e8fa8..9b9a848ae6 100644
--- a/docs/generators/haskell-http-client.md
+++ b/docs/generators/haskell-http-client.md
@@ -24,6 +24,16 @@ sidebar_label: haskell-http-client
|generateModelConstructors|Generate smart constructors (only supply required fields) for models| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|inlineMimeTypes|Inline (hardcode) the content-type and accept parameters on operations, when there is only 1 option| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelDeriving|Additional classes to include in the deriving() clause of Models| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|requestType|Set the name of the type used to generate requests| |null|
diff --git a/docs/generators/haskell.md b/docs/generators/haskell.md
index 2e35a073d8..6bb19ea0f8 100644
--- a/docs/generators/haskell.md
+++ b/docs/generators/haskell.md
@@ -8,6 +8,16 @@ sidebar_label: haskell
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|apiPackage|package for generated api classes| |null|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPackage|package for generated models| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|serveStatic|serve will serve files from the directory 'static'.| |true|
diff --git a/docs/generators/html.md b/docs/generators/html.md
index 78cef65b33..dd8c9fa9d6 100644
--- a/docs/generators/html.md
+++ b/docs/generators/html.md
@@ -15,6 +15,16 @@ sidebar_label: html
|infoEmail|an email address to contact for inquiries about the application| |null|
|infoUrl|a URL where users can get more information about the application| |null|
|invokerPackage|root package for generated code| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseInfo|a short description of the license| |null|
|licenseUrl|a URL pointing to the full license| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/html2.md b/docs/generators/html2.md
index 51d39c72a7..7201bdc249 100644
--- a/docs/generators/html2.md
+++ b/docs/generators/html2.md
@@ -15,6 +15,16 @@ sidebar_label: html2
|infoEmail|an email address to contact for inquiries about the application| |null|
|infoUrl|a URL where users can get more information about the application| |null|
|invokerPackage|root package for generated code| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseInfo|a short description of the license| |null|
|licenseUrl|a URL pointing to the full license| |null|
|packageName|C# package name| |null|
diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md
index f34df4d7a1..4d9c6bfe7e 100644
--- a/docs/generators/java-inflector.md
+++ b/docs/generators/java-inflector.md
@@ -27,6 +27,16 @@ sidebar_label: java-inflector
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|invokerPackage|root package for generated code| |org.openapitools.controllers|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model|
diff --git a/docs/generators/java-msf4j.md b/docs/generators/java-msf4j.md
index 27017264e1..bedc76b14d 100644
--- a/docs/generators/java-msf4j.md
+++ b/docs/generators/java-msf4j.md
@@ -28,6 +28,16 @@ sidebar_label: java-msf4j
|implFolder|folder for generated implementation code| |src/main/java|
|invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|library|library template (sub-template)|
**jersey1**
Jersey core 1.x
**jersey2**
Jersey core 2.x
|jersey2|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
diff --git a/docs/generators/java-pkmst.md b/docs/generators/java-pkmst.md
index c8df6eb887..95b92bbb11 100644
--- a/docs/generators/java-pkmst.md
+++ b/docs/generators/java-pkmst.md
@@ -29,6 +29,16 @@ sidebar_label: java-pkmst
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|invokerPackage|root package for generated code| |com.prokarma.pkmst.controller|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |com.prokarma.pkmst.model|
diff --git a/docs/generators/java-play-framework.md b/docs/generators/java-play-framework.md
index 3066a14a72..6801838e4a 100644
--- a/docs/generators/java-play-framework.md
+++ b/docs/generators/java-play-framework.md
@@ -31,6 +31,16 @@ sidebar_label: java-play-framework
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |apimodels|
diff --git a/docs/generators/java-undertow-server.md b/docs/generators/java-undertow-server.md
index 34544a236c..94bf4e39cc 100644
--- a/docs/generators/java-undertow-server.md
+++ b/docs/generators/java-undertow-server.md
@@ -27,6 +27,16 @@ sidebar_label: java-undertow-server
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|invokerPackage|root package for generated code| |org.openapitools.handler|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |null|
diff --git a/docs/generators/java-vertx-web.md b/docs/generators/java-vertx-web.md
index cd6c3ee4e9..a3fff51038 100644
--- a/docs/generators/java-vertx-web.md
+++ b/docs/generators/java-vertx-web.md
@@ -27,6 +27,16 @@ sidebar_label: java-vertx-web
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|invokerPackage|root package for generated code| |org.openapitools.vertxweb.server|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.vertxweb.server.model|
diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md
index 58c68915ad..13e7bb94c4 100644
--- a/docs/generators/java-vertx.md
+++ b/docs/generators/java-vertx.md
@@ -27,6 +27,16 @@ sidebar_label: java-vertx
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|invokerPackage|root package for generated code| |org.openapitools|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.server.api.model|
diff --git a/docs/generators/java.md b/docs/generators/java.md
index 8789be83d7..289ad44050 100644
--- a/docs/generators/java.md
+++ b/docs/generators/java.md
@@ -29,7 +29,17 @@ sidebar_label: java
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|invokerPackage|root package for generated code| |org.openapitools.client|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
-|library|library template (sub-template) to use|
**jersey1**
HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.
**jersey2**
HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x
**feign**
HTTP client: OpenFeign 9.x (deprecated) or 10.x (default). JSON processing: Jackson 2.9.x.
**okhttp-gson**
[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**retrofit**
HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.
**retrofit2**
HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)
**resttemplate**
HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x
**webclient**
HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x
**resteasy**
HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x
**vertx**
HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x
**google-api-client**
HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x
**rest-assured**
HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8
**native**
HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+
**microprofile**
HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x
|okhttp-gson|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
+|library|library template (sub-template) to use|
**jersey1**
HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.
**jersey2**
HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x
**jersey2-experimental**
HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x
**feign**
HTTP client: OpenFeign 9.x (deprecated) or 10.x (default). JSON processing: Jackson 2.9.x.
**okhttp-gson**
[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**retrofit**
HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.
**retrofit2**
HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)
**resttemplate**
HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x
**webclient**
HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x
**resteasy**
HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x
**vertx**
HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x
**google-api-client**
HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x
**rest-assured**
HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8
**native**
HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+
**microprofile**
HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x
|okhttp-gson|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.client.model|
diff --git a/docs/generators/javascript-apollo.md b/docs/generators/javascript-apollo.md
index 44cad073fd..51a0421dcd 100644
--- a/docs/generators/javascript-apollo.md
+++ b/docs/generators/javascript-apollo.md
@@ -11,6 +11,16 @@ sidebar_label: javascript-apollo
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|invokerPackage|root package for generated code| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseName|name of the license the project uses (Default: using info.license.name)| |null|
|modelPackage|package for generated models| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
diff --git a/docs/generators/javascript-closure-angular.md b/docs/generators/javascript-closure-angular.md
index 89b3bd9b0f..4cf42f33a9 100644
--- a/docs/generators/javascript-closure-angular.md
+++ b/docs/generators/javascript-closure-angular.md
@@ -8,6 +8,16 @@ sidebar_label: javascript-closure-angular
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/javascript-flowtyped.md b/docs/generators/javascript-flowtyped.md
index 6ecd6654d1..8efe8bba9b 100644
--- a/docs/generators/javascript-flowtyped.md
+++ b/docs/generators/javascript-flowtyped.md
@@ -9,6 +9,16 @@ sidebar_label: javascript-flowtyped
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumNameSuffix|Suffix that will be appended to all enum names. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
diff --git a/docs/generators/javascript.md b/docs/generators/javascript.md
index 1181fffa50..139499823d 100644
--- a/docs/generators/javascript.md
+++ b/docs/generators/javascript.md
@@ -12,6 +12,16 @@ sidebar_label: javascript
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|invokerPackage|root package for generated code| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseName|name of the license the project uses (Default: using info.license.name)| |null|
|modelPackage|package for generated models| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md
index ccd6d823c1..13378c2144 100644
--- a/docs/generators/jaxrs-cxf-cdi.md
+++ b/docs/generators/jaxrs-cxf-cdi.md
@@ -31,6 +31,16 @@ sidebar_label: jaxrs-cxf-cdi
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
|invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|library|library template (sub-template)|
**<default>**
JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)
**quarkus**
Server using Quarkus
**thorntail**
Server using Thorntail
**openliberty**
Server using Open Liberty
**helidon**
Server using Helidon
|<default>|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
diff --git a/docs/generators/jaxrs-cxf-client.md b/docs/generators/jaxrs-cxf-client.md
index 0d1c841f15..052caa1f29 100644
--- a/docs/generators/jaxrs-cxf-client.md
+++ b/docs/generators/jaxrs-cxf-client.md
@@ -27,6 +27,16 @@ sidebar_label: jaxrs-cxf-client
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model|
diff --git a/docs/generators/jaxrs-cxf-extended.md b/docs/generators/jaxrs-cxf-extended.md
index b83a1d55e4..28756d164f 100644
--- a/docs/generators/jaxrs-cxf-extended.md
+++ b/docs/generators/jaxrs-cxf-extended.md
@@ -34,6 +34,16 @@ sidebar_label: jaxrs-cxf-extended
|implFolder|folder for generated implementation code| |src/main/java|
|invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|loadTestDataFromFile|Load test data from a generated JSON file| |false|
diff --git a/docs/generators/jaxrs-cxf.md b/docs/generators/jaxrs-cxf.md
index d3dd5e4482..343374b3c2 100644
--- a/docs/generators/jaxrs-cxf.md
+++ b/docs/generators/jaxrs-cxf.md
@@ -33,6 +33,16 @@ sidebar_label: jaxrs-cxf
|implFolder|folder for generated implementation code| |src/main/java|
|invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model|
diff --git a/docs/generators/jaxrs-jersey.md b/docs/generators/jaxrs-jersey.md
index 9183a75d65..ef5a852acf 100644
--- a/docs/generators/jaxrs-jersey.md
+++ b/docs/generators/jaxrs-jersey.md
@@ -28,6 +28,16 @@ sidebar_label: jaxrs-jersey
|implFolder|folder for generated implementation code| |src/main/java|
|invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|library|library template (sub-template)|
**jersey1**
Jersey core 1.x
**jersey2**
Jersey core 2.x
|jersey2|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
diff --git a/docs/generators/jaxrs-resteasy-eap.md b/docs/generators/jaxrs-resteasy-eap.md
index 3a7623db67..1d5f312382 100644
--- a/docs/generators/jaxrs-resteasy-eap.md
+++ b/docs/generators/jaxrs-resteasy-eap.md
@@ -29,6 +29,16 @@ sidebar_label: jaxrs-resteasy-eap
|implFolder|folder for generated implementation code| |src/main/java|
|invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model|
diff --git a/docs/generators/jaxrs-resteasy.md b/docs/generators/jaxrs-resteasy.md
index 724c15e928..60e52043dc 100644
--- a/docs/generators/jaxrs-resteasy.md
+++ b/docs/generators/jaxrs-resteasy.md
@@ -29,6 +29,16 @@ sidebar_label: jaxrs-resteasy
|implFolder|folder for generated implementation code| |src/main/java|
|invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model|
diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md
index 3bd0accada..98cbb0c96c 100644
--- a/docs/generators/jaxrs-spec.md
+++ b/docs/generators/jaxrs-spec.md
@@ -31,6 +31,16 @@ sidebar_label: jaxrs-spec
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
|invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|library|library template (sub-template)|
**<default>**
JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)
**quarkus**
Server using Quarkus
**thorntail**
Server using Thorntail
**openliberty**
Server using Open Liberty
**helidon**
Server using Helidon
|<default>|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
diff --git a/docs/generators/jmeter.md b/docs/generators/jmeter.md
index 142f826d79..e8cbb38e5f 100644
--- a/docs/generators/jmeter.md
+++ b/docs/generators/jmeter.md
@@ -7,6 +7,16 @@ sidebar_label: jmeter
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/k6.md b/docs/generators/k6.md
index 4ff51c7527..2f6d321b14 100644
--- a/docs/generators/k6.md
+++ b/docs/generators/k6.md
@@ -7,6 +7,16 @@ sidebar_label: k6
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/markdown.md b/docs/generators/markdown.md
index 2cba7bc698..465504f694 100644
--- a/docs/generators/markdown.md
+++ b/docs/generators/markdown.md
@@ -7,6 +7,16 @@ sidebar_label: markdown
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/nim.md b/docs/generators/nim.md
index 61ba1d00f1..0340561b62 100644
--- a/docs/generators/nim.md
+++ b/docs/generators/nim.md
@@ -7,6 +7,16 @@ sidebar_label: nim
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/nodejs-express-server.md b/docs/generators/nodejs-express-server.md
index 76b0893f9a..8cc7b8af1f 100644
--- a/docs/generators/nodejs-express-server.md
+++ b/docs/generators/nodejs-express-server.md
@@ -7,6 +7,16 @@ sidebar_label: nodejs-express-server
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|serverPort|TCP port to listen on.| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/nodejs-server-deprecated.md b/docs/generators/nodejs-server-deprecated.md
index 84a3b13194..b2b09ce303 100644
--- a/docs/generators/nodejs-server-deprecated.md
+++ b/docs/generators/nodejs-server-deprecated.md
@@ -9,6 +9,16 @@ sidebar_label: nodejs-server-deprecated
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|exportedName|When the generated code will be deployed to Google Cloud Functions, this option can be used to update the name of the exported function. By default, it refers to the basePath. This does not affect normal standalone nodejs server code.| |null|
|googleCloudFunctions|When specified, it will generate the code which runs within Google Cloud Functions instead of standalone Node.JS server. See https://cloud.google.com/functions/docs/quickstart for the details of how to deploy the generated code.| |false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|serverPort|TCP port to listen on.| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/ocaml.md b/docs/generators/ocaml.md
index d8cda30ed8..ab9a3bd7fd 100644
--- a/docs/generators/ocaml.md
+++ b/docs/generators/ocaml.md
@@ -7,6 +7,16 @@ sidebar_label: ocaml
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/openapi-yaml.md b/docs/generators/openapi-yaml.md
index 7eda9d44be..3d7b5af160 100644
--- a/docs/generators/openapi-yaml.md
+++ b/docs/generators/openapi-yaml.md
@@ -7,6 +7,16 @@ sidebar_label: openapi-yaml
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|outputFile|Output filename| |openapi/openapi.yaml|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/openapi.md b/docs/generators/openapi.md
index 5d46dccf4f..7625d70cb8 100644
--- a/docs/generators/openapi.md
+++ b/docs/generators/openapi.md
@@ -7,6 +7,16 @@ sidebar_label: openapi
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/php-laravel.md b/docs/generators/php-laravel.md
index 57b9191b60..e2bbcaaab0 100644
--- a/docs/generators/php-laravel.md
+++ b/docs/generators/php-laravel.md
@@ -10,6 +10,16 @@ sidebar_label: php-laravel
|artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPackage|package for generated models| |null|
|packageName|The main package name for classes. e.g. GeneratedPetstore| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/php-lumen.md b/docs/generators/php-lumen.md
index 2414dda65c..1e69867a13 100644
--- a/docs/generators/php-lumen.md
+++ b/docs/generators/php-lumen.md
@@ -10,6 +10,16 @@ sidebar_label: php-lumen
|artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPackage|package for generated models| |null|
|packageName|The main package name for classes. e.g. GeneratedPetstore| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/php-silex.md b/docs/generators/php-silex.md
index 81f5e6cb38..2557c8f151 100644
--- a/docs/generators/php-silex.md
+++ b/docs/generators/php-silex.md
@@ -7,6 +7,16 @@ sidebar_label: php-silex
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
diff --git a/docs/generators/php-slim-deprecated.md b/docs/generators/php-slim-deprecated.md
index 98381616b9..16b5a34e76 100644
--- a/docs/generators/php-slim-deprecated.md
+++ b/docs/generators/php-slim-deprecated.md
@@ -10,6 +10,16 @@ sidebar_label: php-slim-deprecated
|artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPackage|package for generated models| |null|
|packageName|The main package name for classes. e.g. GeneratedPetstore| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/php-slim4.md b/docs/generators/php-slim4.md
index b0e79e02ae..86f9a6efbc 100644
--- a/docs/generators/php-slim4.md
+++ b/docs/generators/php-slim4.md
@@ -10,6 +10,16 @@ sidebar_label: php-slim4
|artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPackage|package for generated models| |null|
|packageName|The main package name for classes. e.g. GeneratedPetstore| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/php-symfony.md b/docs/generators/php-symfony.md
index 1d3e71d392..e645d1c0a2 100644
--- a/docs/generators/php-symfony.md
+++ b/docs/generators/php-symfony.md
@@ -15,6 +15,16 @@ sidebar_label: php-symfony
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPackage|package for generated models| |null|
|packageName|The main package name for classes. e.g. GeneratedPetstore| |null|
|phpLegacySupport|Should the generated code be compatible with PHP 5.x?| |true|
diff --git a/docs/generators/php-ze-ph.md b/docs/generators/php-ze-ph.md
index 93a1d3f6ad..6afc5d2a29 100644
--- a/docs/generators/php-ze-ph.md
+++ b/docs/generators/php-ze-ph.md
@@ -10,6 +10,16 @@ sidebar_label: php-ze-ph
|artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPackage|package for generated models| |null|
|packageName|The main package name for classes. e.g. GeneratedPetstore| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/php.md b/docs/generators/php.md
index 413996804e..ba90aa92d7 100644
--- a/docs/generators/php.md
+++ b/docs/generators/php.md
@@ -11,6 +11,16 @@ sidebar_label: php
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |true|
|invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPackage|package for generated models| |null|
|packageName|The main package name for classes. e.g. GeneratedPetstore| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/python-aiohttp.md b/docs/generators/python-aiohttp.md
index ee337d2e5b..0904e15e29 100644
--- a/docs/generators/python-aiohttp.md
+++ b/docs/generators/python-aiohttp.md
@@ -9,6 +9,16 @@ sidebar_label: python-aiohttp
|controllerPackage|controller package| |controllers|
|defaultController|default controller| |default_controller|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|packageName|python package name (convention: snake_case).| |openapi_server|
|packageVersion|python package version.| |1.0.0|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/python-blueplanet.md b/docs/generators/python-blueplanet.md
index 0382237eef..ba1613ebe2 100644
--- a/docs/generators/python-blueplanet.md
+++ b/docs/generators/python-blueplanet.md
@@ -9,6 +9,16 @@ sidebar_label: python-blueplanet
|controllerPackage|controller package| |controllers|
|defaultController|default controller| |default_controller|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|packageName|python package name (convention: snake_case).| |openapi_server|
|packageVersion|python package version.| |1.0.0|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/python-experimental.md b/docs/generators/python-experimental.md
index 8f3b02c7e5..546dcc2254 100644
--- a/docs/generators/python-experimental.md
+++ b/docs/generators/python-experimental.md
@@ -31,6 +31,7 @@ sidebar_label: python-experimental
bool
+
bytes
date
datetime
dict
diff --git a/docs/generators/python-flask.md b/docs/generators/python-flask.md
index c8ab554ade..a09e1dd889 100644
--- a/docs/generators/python-flask.md
+++ b/docs/generators/python-flask.md
@@ -9,6 +9,16 @@ sidebar_label: python-flask
|controllerPackage|controller package| |controllers|
|defaultController|default controller| |default_controller|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|packageName|python package name (convention: snake_case).| |openapi_server|
|packageVersion|python package version.| |1.0.0|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/python.md b/docs/generators/python.md
index 3bd96b865b..7c4ff80016 100644
--- a/docs/generators/python.md
+++ b/docs/generators/python.md
@@ -31,6 +31,7 @@ sidebar_label: python
bool
+
bytes
date
datetime
dict
diff --git a/docs/generators/ruby.md b/docs/generators/ruby.md
index 2475a797ec..9bc917daa9 100644
--- a/docs/generators/ruby.md
+++ b/docs/generators/ruby.md
@@ -17,6 +17,16 @@ sidebar_label: ruby
|gemSummary|gem summary. | |A ruby wrapper for the REST APIs|
|gemVersion|gem version.| |1.0.0|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|library|HTTP library template (sub-template) to use|
|typhoeus|
|moduleName|top module name (convention: CamelCase, usually corresponding to gem name).| |OpenAPIClient|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/scala-akka-http-server.md b/docs/generators/scala-akka-http-server.md
index ecd656979e..5b293ffbc3 100644
--- a/docs/generators/scala-akka-http-server.md
+++ b/docs/generators/scala-akka-http-server.md
@@ -14,6 +14,16 @@ sidebar_label: scala-akka-http-server
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|groupId|groupId in generated pom.xml| |org.openapitools|
|invokerPackage|root package for generated code| |org.openapitools.server|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPackage|package for generated models| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/scala-akka.md b/docs/generators/scala-akka.md
index ad8c5d485c..d023156775 100644
--- a/docs/generators/scala-akka.md
+++ b/docs/generators/scala-akka.md
@@ -9,6 +9,16 @@ sidebar_label: scala-akka
|apiPackage|package for generated api classes| |null|
|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (prefered for JDK 1.8+)
|java8|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|mainPackage|Top-level package name, which defines 'apiPackage', 'modelPackage', 'invokerPackage'| |org.openapitools.client|
|modelPackage|package for generated models| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
diff --git a/docs/generators/scala-gatling.md b/docs/generators/scala-gatling.md
index 0e1e748245..1b711480df 100644
--- a/docs/generators/scala-gatling.md
+++ b/docs/generators/scala-gatling.md
@@ -9,6 +9,16 @@ sidebar_label: scala-gatling
|apiPackage|package for generated api classes| |null|
|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (prefered for JDK 1.8+)
|java8|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPackage|package for generated models| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/scala-httpclient-deprecated.md b/docs/generators/scala-httpclient-deprecated.md
index febeca9a69..a6ee24cc44 100644
--- a/docs/generators/scala-httpclient-deprecated.md
+++ b/docs/generators/scala-httpclient-deprecated.md
@@ -9,6 +9,16 @@ sidebar_label: scala-httpclient-deprecated
|apiPackage|package for generated api classes| |null|
|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (prefered for JDK 1.8+)
|java8|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPackage|package for generated models| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/scala-lagom-server.md b/docs/generators/scala-lagom-server.md
index 99b43af7d5..da97ad1ee7 100644
--- a/docs/generators/scala-lagom-server.md
+++ b/docs/generators/scala-lagom-server.md
@@ -9,6 +9,16 @@ sidebar_label: scala-lagom-server
|apiPackage|package for generated api classes| |null|
|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (prefered for JDK 1.8+)
|java8|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPackage|package for generated models| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/scala-play-server.md b/docs/generators/scala-play-server.md
index 57bdf5d70e..ef8b2db4e7 100644
--- a/docs/generators/scala-play-server.md
+++ b/docs/generators/scala-play-server.md
@@ -10,6 +10,16 @@ sidebar_label: scala-play-server
|basePackage|Base package in which supporting classes are generated.| |org.openapitools|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|generateCustomExceptions|If set, generates custom exception types.| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPackage|package for generated models| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/scala-sttp.md b/docs/generators/scala-sttp.md
index 5c277bf9dc..2d1584633b 100644
--- a/docs/generators/scala-sttp.md
+++ b/docs/generators/scala-sttp.md
@@ -9,6 +9,16 @@ sidebar_label: scala-sttp
|apiPackage|package for generated api classes| |null|
|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (prefered for JDK 1.8+)
|java8|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|mainPackage|Top-level package name, which defines 'apiPackage', 'modelPackage', 'invokerPackage'| |org.openapitools.client|
|modelPackage|package for generated models| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
diff --git a/docs/generators/scalatra.md b/docs/generators/scalatra.md
index af71e32aa4..bb05a8f35e 100644
--- a/docs/generators/scalatra.md
+++ b/docs/generators/scalatra.md
@@ -9,6 +9,16 @@ sidebar_label: scalatra
|apiPackage|package for generated api classes| |null|
|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (prefered for JDK 1.8+)
|java8|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPackage|package for generated models| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/scalaz.md b/docs/generators/scalaz.md
index aa2f6121ca..48ecb1bdfa 100644
--- a/docs/generators/scalaz.md
+++ b/docs/generators/scalaz.md
@@ -9,6 +9,16 @@ sidebar_label: scalaz
|apiPackage|package for generated api classes| |null|
|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (prefered for JDK 1.8+)
|java8|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPackage|package for generated models| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/spring.md b/docs/generators/spring.md
index 98b896d8f2..c2a43de8ce 100644
--- a/docs/generators/spring.md
+++ b/docs/generators/spring.md
@@ -35,6 +35,16 @@ sidebar_label: spring
|interfaceOnly|Whether to generate only API interface stubs without the server files.| |false|
|invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64. Use java8 default interface when a responseWrapper is used
**false**
Various third party libraries as needed
|false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|library|library template (sub-template)|
**spring-boot**
Spring-boot Server application using the SpringFox integration.
**spring-mvc**
Spring-MVC Server application using the SpringFox integration.
**spring-cloud**
Spring-Cloud-Feign client with Spring-Boot auto-configured settings.
|spring-boot|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
diff --git a/docs/generators/swift2-deprecated.md b/docs/generators/swift2-deprecated.md
index fe739bc109..34894b8930 100644
--- a/docs/generators/swift2-deprecated.md
+++ b/docs/generators/swift2-deprecated.md
@@ -8,6 +8,16 @@ sidebar_label: swift2-deprecated
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|podAuthors|Authors used for Podspec| |null|
|podDescription|Description used for Podspec| |null|
|podDocsetURL|Docset URL used for Podspec| |null|
diff --git a/docs/generators/swift3-deprecated.md b/docs/generators/swift3-deprecated.md
index 7f1997eaef..ed484208b2 100644
--- a/docs/generators/swift3-deprecated.md
+++ b/docs/generators/swift3-deprecated.md
@@ -8,6 +8,16 @@ sidebar_label: swift3-deprecated
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|lenientTypeCast|Accept and cast values for simple types (string->bool, string->int, int->string)| |false|
|objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null|
|podAuthors|Authors used for Podspec| |null|
diff --git a/docs/generators/swift4.md b/docs/generators/swift4.md
index f4c589c02e..4030c9a11f 100644
--- a/docs/generators/swift4.md
+++ b/docs/generators/swift4.md
@@ -8,6 +8,16 @@ sidebar_label: swift4
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|lenientTypeCast|Accept and cast values for simple types (string->bool, string->int, int->string)| |false|
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |null|
|objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null|
diff --git a/docs/generators/swift5.md b/docs/generators/swift5.md
index 52a75bd93b..c7beb3e39a 100644
--- a/docs/generators/swift5.md
+++ b/docs/generators/swift5.md
@@ -9,6 +9,16 @@ sidebar_label: swift5
|apiNamePrefix|Prefix that will be appended to all API names ('tags'). Default: empty string. e.g. Pet => Pet.| |null|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|lenientTypeCast|Accept and cast values for simple types (string->bool, string->int, int->string)| |false|
|library|Library template (sub-template) to use|
**urlsession**
[DEFAULT] HTTP client: URLSession
**alamofire**
HTTP client: Alamofire
|urlsession|
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |null|
diff --git a/docs/generators/typescript-angular.md b/docs/generators/typescript-angular.md
index f382194df4..4d9191a91f 100644
--- a/docs/generators/typescript-angular.md
+++ b/docs/generators/typescript-angular.md
@@ -11,6 +11,16 @@ sidebar_label: typescript-angular
|enumNameSuffix|Suffix that will be appended to all enum names. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
|fileNaming|Naming convention for the output files: 'camelCase', 'kebab-case'.| |camelCase|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelFileSuffix|The suffix of the file of the generated model (model<suffix>.ts).| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|modelSuffix|The suffix of the generated model.| |null|
diff --git a/docs/generators/typescript-angularjs.md b/docs/generators/typescript-angularjs.md
index fbfd828ba3..0c5f755640 100644
--- a/docs/generators/typescript-angularjs.md
+++ b/docs/generators/typescript-angularjs.md
@@ -9,6 +9,16 @@ sidebar_label: typescript-angularjs
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumNameSuffix|Suffix that will be appended to all enum names. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/typescript-aurelia.md b/docs/generators/typescript-aurelia.md
index 955079117b..f5f0e764b6 100644
--- a/docs/generators/typescript-aurelia.md
+++ b/docs/generators/typescript-aurelia.md
@@ -9,6 +9,16 @@ sidebar_label: typescript-aurelia
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumNameSuffix|Suffix that will be appended to all enum names. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
diff --git a/docs/generators/typescript-axios.md b/docs/generators/typescript-axios.md
index 5e65684a0e..575d2e17bb 100644
--- a/docs/generators/typescript-axios.md
+++ b/docs/generators/typescript-axios.md
@@ -9,6 +9,16 @@ sidebar_label: typescript-axios
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumNameSuffix|Suffix that will be appended to all enum names. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url of your private npmRepo in the package.json| |null|
diff --git a/docs/generators/typescript-fetch.md b/docs/generators/typescript-fetch.md
index af3dd91626..2662e2adef 100644
--- a/docs/generators/typescript-fetch.md
+++ b/docs/generators/typescript-fetch.md
@@ -9,6 +9,16 @@ sidebar_label: typescript-fetch
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumNameSuffix|Suffix that will be appended to all enum names. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
@@ -76,6 +86,7 @@ sidebar_label: typescript-fetch
HTTPHeaders
HTTPMethod
HTTPQuery
+
Index
JSONApiResponse
Middleware
ModelPropertyNaming
diff --git a/docs/generators/typescript-inversify.md b/docs/generators/typescript-inversify.md
index 5d68c9f083..6829b64eee 100644
--- a/docs/generators/typescript-inversify.md
+++ b/docs/generators/typescript-inversify.md
@@ -9,6 +9,16 @@ sidebar_label: typescript-inversify
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumNameSuffix|Suffix that will be appended to all enum names. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
diff --git a/docs/generators/typescript-jquery.md b/docs/generators/typescript-jquery.md
index 91d61cf31e..262578ce20 100644
--- a/docs/generators/typescript-jquery.md
+++ b/docs/generators/typescript-jquery.md
@@ -10,6 +10,16 @@ sidebar_label: typescript-jquery
|enumNameSuffix|Suffix that will be appended to all enum names. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
|jqueryAlreadyImported|When using this in legacy app using mix of typescript and javascript, this will only declare jquery and not import it| |false|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
diff --git a/docs/generators/typescript-node.md b/docs/generators/typescript-node.md
index d4bdee29bc..06a4853986 100644
--- a/docs/generators/typescript-node.md
+++ b/docs/generators/typescript-node.md
@@ -9,6 +9,16 @@ sidebar_label: typescript-node
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumNameSuffix|Suffix that will be appended to all enum names. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
diff --git a/docs/generators/typescript-redux-query.md b/docs/generators/typescript-redux-query.md
index e5674a4c30..14fbe4c854 100644
--- a/docs/generators/typescript-redux-query.md
+++ b/docs/generators/typescript-redux-query.md
@@ -9,6 +9,16 @@ sidebar_label: typescript-redux-query
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumNameSuffix|Suffix that will be appended to all enum names. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
diff --git a/docs/generators/typescript-rxjs.md b/docs/generators/typescript-rxjs.md
index 9a210f4934..e9638e2fbd 100644
--- a/docs/generators/typescript-rxjs.md
+++ b/docs/generators/typescript-rxjs.md
@@ -9,6 +9,16 @@ sidebar_label: typescript-rxjs
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumNameSuffix|Suffix that will be appended to all enum names. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
+|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.
+
+When this flag is set to 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.
+- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
+When this flag is set to true:
+
+- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
+Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java
index e40f3c624a..084026f555 100644
--- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java
+++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java
@@ -240,6 +240,9 @@ public class Generate extends OpenApiGeneratorCommand {
@Option(name = {"--generate-alias-as-model"}, title = "generate alias (array, map) as model", description = CodegenConstants.GENERATE_ALIAS_AS_MODEL_DESC)
private Boolean generateAliasAsModel;
+ @Option(name = {"--legacy-discriminator-behavior"}, title = "Support legacy logic for evaluating discriminators", description = CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR_DESC)
+ private Boolean legacyDiscriminatorBehavior;
+
@Option(name = {"--minimal-update"},
title = "Minimal update",
description = "Only write output files that have changed.")
diff --git a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt
index f273d12427..d0c207711a 100644
--- a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt
+++ b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt
@@ -21,6 +21,7 @@ import org.gradle.api.GradleException
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.TaskAction
+import org.gradle.api.tasks.options.Option
import org.gradle.internal.logging.text.StyledTextOutput
import org.gradle.internal.logging.text.StyledTextOutputFactory
import org.gradle.kotlin.dsl.listProperty
@@ -37,7 +38,7 @@ import org.openapitools.codegen.config.GlobalSettings
*
* Example (CLI):
*
- * ./gradlew -q openApiGenerate
+ * ./gradlew -q openApiGenerate --input=/path/to/file
*
* @author Jim Schubert
*/
@@ -68,6 +69,14 @@ open class GenerateTask : DefaultTask() {
@get:Internal
val outputDir = project.objects.property()
+ @Suppress("unused")
+ @get:Internal
+ @set:Option(option = "input", description = "The input specification.")
+ var input: String? = null
+ set(value) {
+ inputSpec.set(value)
+ }
+
/**
* The Open API 2.0/3.x specification location.
*/
diff --git a/modules/openapi-generator-maven-plugin/examples/spring.xml b/modules/openapi-generator-maven-plugin/examples/spring.xml
index dda872981b..a0654ffe26 100644
--- a/modules/openapi-generator-maven-plugin/examples/spring.xml
+++ b/modules/openapi-generator-maven-plugin/examples/spring.xml
@@ -20,7 +20,7 @@
org.openapitoolsopenapi-generator-maven-plugin
- 4.2.2-SNAPSHOT
+ 4.3.1-SNAPSHOT
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java
index 14e1fe5fce..5b2cc91645 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java
@@ -351,4 +351,17 @@ public class CodegenConstants {
public static final String REMOVE_ENUM_VALUE_PREFIX = "removeEnumValuePrefix";
public static final String REMOVE_ENUM_VALUE_PREFIX_DESC = "Remove the common prefix of enum values";
+
+ public static final String LEGACY_DISCRIMINATOR_BEHAVIOR = "legacyDiscriminatorBehavior";
+ public static final String LEGACY_DISCRIMINATOR_BEHAVIOR_DESC = "This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.\n" +
+ "\n" +
+ "When this flag is set to false:\n" +
+ "\n" +
+ "- 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.\n" +
+ "- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.\n" +
+ "When this flag is set to true:\n" +
+ "\n" +
+ "- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.\n" +
+ "Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.";
+
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java
index 73d85052e7..4e30df0c9e 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java
@@ -7,12 +7,39 @@ import java.util.Map;
import java.util.Objects;
import java.util.Set;
+/**
+ * This class encapsulates the OpenAPI discriminator construct, as specified at
+ * https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#discriminatorObject.
+ *
+ * When request bodies or response payloads may be one of a number of different schemas,
+ * a discriminator object can be used to aid in serialization, deserialization, and validation.
+ * The discriminator is a specific object in a schema which is used to inform the consumer of
+ * the specification of an alternative schema based on the value associated with it.
+ */
public class CodegenDiscriminator {
+ // The name of the property in the payload that will hold the discriminator value.
+ // This is the propertyName as specified in the OpenAPI discriminator object.
private String propertyName;
private String propertyBaseName;
private String propertyGetter;
private String propertyType;
private Map mapping;
+
+ // mappedModels is populated differently if discriminatorExplicitMappingVerbose is
+ // True or False. When:
+ //
+ // discriminatorExplicitMappingVerbose == False, this contains:
+ // - the name to schema map info in the discriminator mapping entry in your openapi spec OR
+ // - child schemas that allOf inherit self schema
+ //
+ // discriminatorExplicitMappingVerbose == True, this contains:
+ // - the name to schema map info in the discriminMappedModelator mapping entry in your openapi spec AND
+ // - x-discriminator-value mappings in child oneOf + anyOf schemas + descendant schemas that allOf inherit self schema AND
+ // - descendant schemas that allOf inherit self schema AND
+ // - child oneOf + anyOf schemas
+ //
+ // see the method createDiscriminator in DefaultCodegen.java
+
private Set mappedModels = new LinkedHashSet<>();
public String getPropertyName() {
@@ -63,8 +90,21 @@ public class CodegenDiscriminator {
this.mappedModels = mappedModels;
}
- public static class MappedModel {
+ /**
+ * An object to hold discriminator mappings between payload values and schema names or
+ * references.
+ *
+ * In the OpenAPI document, the discriminator "mapping" attribute is optional.
+ * In scenarios where the value of the discriminator field does not match the schema name
+ * or implicit mapping is not possible, an optional mapping definition MAY be used.
+ * In OpenAPITools codegen, the MappedModel is the union of all the discriminator mappings,
+ * both explicitly defined in the OpenAPI document and inherited from oneOf/allOf/anyOf.
+ */
+ public static class MappedModel implements Comparable{
+ // The value of the discriminator property in the payload.
private String mappingName;
+ // The OAS schema name. It is obtained from the OAS document, and the string value
+ // is converted to a sanitized, internal representation within codegen.
private String modelName;
public MappedModel(String mappingName, String modelName) {
@@ -72,6 +112,18 @@ public class CodegenDiscriminator {
this.modelName = modelName;
}
+ @Override
+ public int compareTo(MappedModel other) {
+ if (getMappingName() == null && other.getMappingName() == null) {
+ return 0;
+ } else if (getMappingName() == null) {
+ return 1;
+ } else if (other.getMappingName() == null) {
+ return -1;
+ }
+ return getMappingName().compareTo(other.getMappingName());
+ }
+
public String getMappingName() {
return mappingName;
}
@@ -130,4 +182,4 @@ public class CodegenDiscriminator {
sb.append('}');
return sb.toString();
}
-}
+}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
index 16a296f84e..e9d25fd5ca 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
@@ -696,6 +696,17 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
return sb.toString();
}
+ public void addDiscriminatorMappedModelsImports(){
+ if (discriminator == null || discriminator.getMappedModels() == null) {
+ return;
+ }
+ for (CodegenDiscriminator.MappedModel mm : discriminator.getMappedModels()) {
+ if (!"".equals(mm.getModelName())) {
+ imports.add(mm.getModelName());
+ }
+ }
+ }
+
public boolean isEmptyVars() {
return emptyVars;
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
index 407e418067..8631b2cbae 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
@@ -150,6 +150,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
public boolean isNullable;
public boolean isSelfReference;
public boolean isCircularReference;
+ public boolean isDiscriminator;
public List _enum;
public Map allowableValues;
public CodegenProperty items;
@@ -660,6 +661,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
sb.append(", isNullable=").append(isNullable);
sb.append(", isSelfReference=").append(isSelfReference);
sb.append(", isCircularReference=").append(isCircularReference);
+ sb.append(", isDiscriminator=").append(isDiscriminator);
sb.append(", _enum=").append(_enum);
sb.append(", allowableValues=").append(allowableValues);
sb.append(", items=").append(items);
@@ -726,6 +728,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
isNullable == that.isNullable &&
isSelfReference == that.isSelfReference &&
isCircularReference == that.isCircularReference &&
+ isDiscriminator == that.isDiscriminator &&
hasValidation == that.hasValidation &&
isInherited == that.isInherited &&
isXmlAttribute == that.isXmlAttribute &&
@@ -784,7 +787,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isFile,
isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject,
isListContainer, isMapContainer, isEnum, isReadOnly, isWriteOnly, isNullable,
- isSelfReference, isCircularReference, _enum, allowableValues, items, mostInnerItems,
+ isSelfReference, isCircularReference, isDiscriminator, _enum, allowableValues, items, mostInnerItems,
vendorExtensions, hasValidation, isInherited, discriminatorValue, nameInCamelCase,
nameInSnakeCase, enumName, maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName,
xmlNamespace, isXmlWrapped);
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 cf2e8d2e93..d40ef68045 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
@@ -215,6 +215,9 @@ public class DefaultCodegen implements CodegenConfig {
// flag to indicate whether enum value prefixes are removed
protected boolean removeEnumValuePrefix = true;
+ // Support legacy logic for evaluating discriminators
+ protected boolean legacyDiscriminatorBehavior = true;
+
// make openapi available to all methods
protected OpenAPI openAPI;
@@ -306,6 +309,11 @@ public class DefaultCodegen implements CodegenConfig {
this.setRemoveEnumValuePrefix(Boolean.valueOf(additionalProperties
.get(CodegenConstants.REMOVE_ENUM_VALUE_PREFIX).toString()));
}
+
+ if (additionalProperties.containsKey(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR)) {
+ this.setLegacyDiscriminatorBehavior(Boolean.valueOf(additionalProperties
+ .get(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR).toString()));
+ }
}
/***
@@ -468,7 +476,8 @@ public class DefaultCodegen implements CodegenConfig {
}
parent.getChildren().add(cm);
parent.hasChildren = true;
- if (parent.getDiscriminator() == null) {
+ Schema parentSchema = this.openAPI.getComponents().getSchemas().get(parent.name);
+ if (parentSchema.getDiscriminator() == null) {
parent = allModels.get(parent.getParent());
} else {
parent = null;
@@ -765,7 +774,7 @@ public class DefaultCodegen implements CodegenConfig {
if (e.getKey().contains("/")) {
// if this is property schema, we also need to generate the oneOf interface model
addOneOfNameExtension((ComposedSchema) s, nOneOf);
- addOneOfInterfaceModel((ComposedSchema) s, nOneOf);
+ addOneOfInterfaceModel((ComposedSchema) s, nOneOf, openAPI);
} else {
// else this is a component schema, so we will just use that as the oneOf interface model
addOneOfNameExtension((ComposedSchema) s, n);
@@ -774,13 +783,13 @@ public class DefaultCodegen implements CodegenConfig {
Schema items = ((ArraySchema) s).getItems();
if (ModelUtils.isComposedSchema(items)) {
addOneOfNameExtension((ComposedSchema) items, nOneOf);
- addOneOfInterfaceModel((ComposedSchema) items, nOneOf);
+ addOneOfInterfaceModel((ComposedSchema) items, nOneOf, openAPI);
}
} else if (ModelUtils.isMapSchema(s)) {
Schema addProps = ModelUtils.getAdditionalProperties(s);
if (addProps != null && ModelUtils.isComposedSchema(addProps)) {
addOneOfNameExtension((ComposedSchema) addProps, nOneOf);
- addOneOfInterfaceModel((ComposedSchema) addProps, nOneOf);
+ addOneOfInterfaceModel((ComposedSchema) addProps, nOneOf, openAPI);
}
}
}
@@ -1109,6 +1118,14 @@ public class DefaultCodegen implements CodegenConfig {
this.ensureUniqueParams = ensureUniqueParams;
}
+ public Boolean getLegacyDiscriminatorBehavior() {
+ return legacyDiscriminatorBehavior;
+ }
+
+ public void setLegacyDiscriminatorBehavior(boolean val){
+ this.legacyDiscriminatorBehavior = val;
+ }
+
public Boolean getAllowUnicodeIdentifiers() {
return allowUnicodeIdentifiers;
}
@@ -1423,6 +1440,9 @@ public class DefaultCodegen implements CodegenConfig {
// option to change the order of form/body parameter
cliOptions.add(CliOption.newBoolean(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS,
CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS_DESC).defaultValue(Boolean.FALSE.toString()));
+ cliOptions.add(CliOption.newBoolean(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR,
+ CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR_DESC).defaultValue(Boolean.TRUE.toString()));
+
// initialize special character mapping
initalizeSpecialCharacterMapping();
@@ -1854,7 +1874,13 @@ public class DefaultCodegen implements CodegenConfig {
}
/**
- * Return the name of the oneOf schema
+ * Return the name of the oneOf schema.
+ *
+ * This name is used to set the value of CodegenProperty.openApiType.
+ *
+ * If the 'x-one-of-name' extension is specified in the OAS document, return that value.
+ * Otherwise, a name is constructed by creating a comma-separated list of all the names
+ * of the oneOf schemas.
*
* @param names List of names
* @param composedSchema composed schema
@@ -1863,8 +1889,8 @@ public class DefaultCodegen implements CodegenConfig {
@SuppressWarnings("static-method")
public String toOneOfName(List names, ComposedSchema composedSchema) {
Map exts = composedSchema.getExtensions();
- if (exts != null && exts.containsKey("x-oneOf-name")) {
- return (String) exts.get("x-oneOf-name");
+ if (exts != null && exts.containsKey("x-one-of-name")) {
+ return (String) exts.get("x-one-of-name");
}
return "oneOf<" + String.join(",", names) + ">";
}
@@ -2132,7 +2158,10 @@ public class DefaultCodegen implements CodegenConfig {
}
m.isAlias = (typeAliases.containsKey(name)
|| isAliasOfSimpleTypes(schema)); // check if the unaliased schema is an alias of simple OAS types
- m.discriminator = createDiscriminator(name, schema);
+ m.discriminator = createDiscriminator(name, schema, this.openAPI);
+ if (!this.getLegacyDiscriminatorBehavior()) {
+ m.addDiscriminatorMappedModelsImports();
+ }
if (schema.getDeprecated() != null) {
m.isDeprecated = schema.getDeprecated();
@@ -2178,7 +2207,10 @@ public class DefaultCodegen implements CodegenConfig {
for (Schema innerSchema : composed.getAllOf()) { // TODO need to work with anyOf, oneOf as well
if (m.discriminator == null && innerSchema.getDiscriminator() != null) {
LOGGER.debug("discriminator is set to null (not correctly set earlier): {}", name);
- m.discriminator = createDiscriminator(name, innerSchema);
+ m.discriminator = createDiscriminator(name, innerSchema, this.openAPI);
+ if (!this.getLegacyDiscriminatorBehavior()) {
+ m.addDiscriminatorMappedModelsImports();
+ }
modelDiscriminators++;
}
@@ -2207,9 +2239,33 @@ public class DefaultCodegen implements CodegenConfig {
m.interfaces = new ArrayList();
for (Schema interfaceSchema : interfaces) {
+ interfaceSchema = ModelUtils.unaliasSchema(this.openAPI, interfaceSchema, importMapping);
+
if (StringUtils.isBlank(interfaceSchema.get$ref())) {
+ // primitive type
+ String languageType = getTypeDeclaration(interfaceSchema);
+
+ if (composed.getAnyOf() != null) {
+ if (m.anyOf.contains(languageType)) {
+ LOGGER.warn("{} (anyOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType);
+ } else {
+ m.anyOf.add(languageType);
+ }
+ } else if (composed.getOneOf() != null) {
+ if (m.oneOf.contains(languageType)) {
+ LOGGER.warn("{} (oneOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType);
+ } else {
+ m.oneOf.add(languageType);
+ }
+ } else if (composed.getAllOf() != null) {
+ // no need to add primitive type to allOf, which should comprise of schemas (models) only
+ } else {
+ LOGGER.error("Composed schema has incorrect anyOf, allOf, oneOf defined: {}", composed);
+ }
continue;
}
+
+ // the rest of the section is for model
Schema refSchema = null;
String ref = ModelUtils.getSimpleRef(interfaceSchema.get$ref());
if (allDefinitions != null) {
@@ -2278,6 +2334,7 @@ public class DefaultCodegen implements CodegenConfig {
required.addAll(composed.getRequired());
allRequired.addAll(composed.getRequired());
}
+
addVars(m, unaliasPropertySchema(properties), required, unaliasPropertySchema(allProperties), allRequired);
// end of code block for composed schema
@@ -2346,6 +2403,22 @@ public class DefaultCodegen implements CodegenConfig {
}
}
+ // set isDiscriminator on the discriminator property
+ if (m.discriminator != null) {
+ String discPropName = m.discriminator.getPropertyBaseName();
+ List> listOLists = new ArrayList>();
+ listOLists.add(m.requiredVars);
+ listOLists.add(m.vars);
+ listOLists.add(m.allVars);
+ for (List theseVars: listOLists) {
+ for (CodegenProperty requiredVar: theseVars) {
+ if (discPropName.equals(requiredVar.baseName)) {
+ requiredVar.isDiscriminator = true;
+ }
+ }
+ }
+ }
+
if (sortModelPropertiesByRequiredFlag) {
Comparator comparator = new Comparator() {
@Override
@@ -2362,36 +2435,316 @@ public class DefaultCodegen implements CodegenConfig {
return m;
}
- protected CodegenDiscriminator createDiscriminator(String schemaName, Schema schema) {
- if (schema.getDiscriminator() == null) {
+ /**
+ * Recursively look in Schema sc for the discriminator discPropName
+ * and return a CodegenProperty with the dataType and required params set
+ * the returned CodegenProperty may not be required and it may not be of type string
+ * @param composedSchemaName The name of the sc Schema
+ * @param sc The Schema that may contain the discriminator
+ * @param discPropName The String that is the discriminator propertyName in the schema
+ */
+ private CodegenProperty discriminatorFound(String composedSchemaName, Schema sc, String discPropName, OpenAPI openAPI) {
+ Schema refSchema = ModelUtils.getReferencedSchema(openAPI, sc);
+ if (refSchema.getProperties() != null && refSchema.getProperties().get(discPropName) != null) {
+ Schema discSchema = (Schema) refSchema.getProperties().get(discPropName);
+ CodegenProperty cp = new CodegenProperty();
+ if (ModelUtils.isStringSchema(discSchema)) {
+ cp.isString = true;
+ }
+ cp.setRequired(false);
+ if (refSchema.getRequired() != null && refSchema.getRequired().contains(discPropName)) {
+ cp.setRequired(true);
+ }
+ return cp;
+ }
+ if (ModelUtils.isComposedSchema(refSchema)) {
+ ComposedSchema composedSchema = (ComposedSchema) refSchema;
+ if (composedSchema.getAllOf() != null) {
+ // If our discriminator is in one of the allOf schemas break when we find it
+ for (Schema allOf: composedSchema.getAllOf()) {
+ CodegenProperty cp = discriminatorFound(composedSchemaName, allOf, discPropName, openAPI);
+ if (cp != null) {
+ return cp;
+ }
+ }
+ }
+ if (composedSchema.getOneOf() != null && composedSchema.getOneOf().size() != 0) {
+ // All oneOf definitions must contain the discriminator
+ CodegenProperty cp = new CodegenProperty();
+ for (Schema oneOf: composedSchema.getOneOf()) {
+ String modelName = ModelUtils.getSimpleRef(oneOf.get$ref());
+ CodegenProperty thisCp = discriminatorFound(composedSchemaName, oneOf, discPropName, openAPI);
+ if (thisCp == null) {
+ throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced OneOf schema '" + modelName + "' is missing "+discPropName);
+ }
+ if (cp.dataType == null) {
+ cp = thisCp;
+ continue;
+ }
+ if (cp != thisCp) {
+ throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the OneOf schema '" + modelName + "' has a different "+discPropName+" definition than the prior OneOf schema's. Make sure the "+discPropName+" type and required values are the same");
+ }
+ }
+ return cp;
+ }
+ if (composedSchema.getAnyOf() != null && composedSchema.getAnyOf().size() != 0) {
+ // All anyOf definitions must contain the discriminator because a min of one must be selected
+ CodegenProperty cp = new CodegenProperty();
+ for (Schema anyOf: composedSchema.getAnyOf()) {
+ String modelName = ModelUtils.getSimpleRef(anyOf.get$ref());
+ CodegenProperty thisCp = discriminatorFound(composedSchemaName, anyOf, discPropName, openAPI);
+ if (thisCp == null) {
+ throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced AnyOf schema '" + modelName + "' is missing "+discPropName);
+ }
+ if (cp.dataType == null) {
+ cp = thisCp;
+ continue;
+ }
+ if (cp != thisCp) {
+ throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the AnyOf schema '" + modelName + "' has a different "+discPropName+" definition than the prior AnyOf schema's. Make sure the "+discPropName+" type and required values are the same");
+ }
+ }
+ return cp;
+
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Recursively look in Schema sc for the discriminator and return it
+ * Schema sc location
+ * OpenAPI openAPI the spec where we are searching for the discriminator
+ * @param sc The Schema that may contain the discriminator
+ */
+ private Discriminator recursiveGetDiscriminator(Schema sc, OpenAPI openAPI) {
+ Schema refSchema = ModelUtils.getReferencedSchema(openAPI, sc);
+ Discriminator foundDisc = refSchema.getDiscriminator();
+ if (foundDisc != null) {
+ return foundDisc;
+ }
+ if (!!this.getLegacyDiscriminatorBehavior()) {
+ return null;
+ }
+ Discriminator disc = new Discriminator();
+ if (ModelUtils.isComposedSchema(refSchema)) {
+ ComposedSchema composedSchema = (ComposedSchema) refSchema;
+ if (composedSchema.getAllOf() != null) {
+ // If our discriminator is in one of the allOf schemas break when we find it
+ for (Schema allOf: composedSchema.getAllOf()) {
+ foundDisc = recursiveGetDiscriminator(allOf, openAPI);
+ if (foundDisc != null) {
+ disc.setPropertyName(foundDisc.getPropertyName());
+ disc.setMapping(foundDisc.getMapping());
+ return disc;
+ }
+ }
+ }
+ if (composedSchema.getOneOf() != null && composedSchema.getOneOf().size() != 0) {
+ // All oneOf definitions must contain the discriminator
+ Integer hasDiscriminatorCnt = 0;
+ Set discriminatorsPropNames = new HashSet<>();
+ for (Schema oneOf: composedSchema.getOneOf()) {
+ foundDisc = recursiveGetDiscriminator(oneOf, openAPI);
+ if (foundDisc != null) {
+ discriminatorsPropNames.add(foundDisc.getPropertyName());
+ hasDiscriminatorCnt++;
+ }
+ }
+ if (hasDiscriminatorCnt == composedSchema.getOneOf().size() && discriminatorsPropNames.size() == 1) {
+ disc.setPropertyName(foundDisc.getPropertyName());
+ disc.setMapping(foundDisc.getMapping());
+ return disc;
+ }
+ }
+ if (composedSchema.getAnyOf() != null && composedSchema.getAnyOf().size() != 0) {
+ // All anyOf definitions must contain the discriminator because a min of one must be selected
+ Integer hasDiscriminatorCnt = 0;
+ Set discriminatorsPropNames = new HashSet<>();
+ for (Schema anyOf: composedSchema.getAnyOf()) {
+ foundDisc = recursiveGetDiscriminator(anyOf, openAPI);
+ if (foundDisc != null) {
+ discriminatorsPropNames.add(foundDisc.getPropertyName());
+ hasDiscriminatorCnt++;
+ }
+ }
+ if (hasDiscriminatorCnt == composedSchema.getAnyOf().size() && discriminatorsPropNames.size() == 1) {
+ disc.setPropertyName(foundDisc.getPropertyName());
+ disc.setMapping(foundDisc.getMapping());
+ return disc;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * This function is only used for composed schemas which have a discriminator
+ * Process oneOf and anyOf models in a composed schema and adds them into
+ * a list if the oneOf and anyOf models contain
+ * the required discriminator. If they don't contain the required
+ * discriminator or the discriminator is the wrong type then an error is
+ * thrown
+ * @param composedSchemaName The String model name of the composed schema where we are setting the discriminator map
+ * @param discPropName The String that is the discriminator propertyName in the schema
+ * @param c The ComposedSchema that contains the discriminator and oneOf/anyOf schemas
+ * @param openAPI The OpenAPI spec that we are using
+ * @return the list of oneOf and anyOf MappedModel that need to be added to the discriminator map
+ */
+ protected List getOneOfAnyOfDescendants(String composedSchemaName, String discPropName, ComposedSchema c, OpenAPI openAPI) {
+ ArrayList> listOLists = new ArrayList>();
+ listOLists.add(c.getOneOf());
+ listOLists.add(c.getAnyOf());
+ List descendentSchemas = new ArrayList();
+ for (List schemaList: listOLists) {
+ if (schemaList == null) {
+ continue;
+ }
+ for (Schema sc: schemaList) {
+ String ref = sc.get$ref();
+ if (ref == null) {
+ // for schemas with no ref, it is not possible to build the discriminator map
+ // because ref is how we get the model name
+ // we only hit this use case for a schema with inline composed schemas, and one of those
+ // schemas also has inline composed schemas
+ // Note: if it is only inline one level, then the inline model resolver will move it into its own
+ // schema and make it a $ref schema in the oneOf/anyOf location
+ throw new RuntimeException("Invalid inline schema defined in oneOf/anyOf in '" + composedSchemaName + "'. Per the OpenApi spec, for this case when a composed schema defines a discriminator, the oneOf/anyOf schemas must use $ref. Change this inline definition to a $ref definition");
+ }
+ CodegenProperty df = discriminatorFound(composedSchemaName, sc, discPropName, openAPI);
+ String modelName = ModelUtils.getSimpleRef(ref);
+ if (df == null || !df.isString || df.required != true) {
+ String msgSuffix = "";
+ if (df == null) {
+ msgSuffix += discPropName+" is missing from the schema, define it as required and type string";
+ } else {
+ if (!df.isString) {
+ msgSuffix += "invalid type for "+discPropName+", set it to string";
+ }
+ if (df.required != true) {
+ String spacer = "";
+ if (msgSuffix.length() != 0) {
+ spacer = ". ";
+ }
+ msgSuffix += spacer+"invalid optional definition of "+discPropName+", include it in required";
+ }
+ }
+ throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced schema '" + modelName + "' is incorrect. "+msgSuffix);
+ }
+ MappedModel mm = new MappedModel(modelName, toModelName(modelName));
+ descendentSchemas.add(mm);
+ Schema cs = ModelUtils.getSchema(openAPI, modelName);
+ Map vendorExtensions = cs.getExtensions();
+ if (vendorExtensions != null && !vendorExtensions.isEmpty() && vendorExtensions.containsKey("x-discriminator-value")) {
+ String xDiscriminatorValue = (String) vendorExtensions.get("x-discriminator-value");
+ mm = new MappedModel(xDiscriminatorValue, toModelName(modelName));
+ descendentSchemas.add(mm);
+ }
+
+ }
+ }
+ return descendentSchemas;
+ }
+
+ protected List getAllOfDescendants(String thisSchemaName, OpenAPI openAPI) {
+ ArrayList queue = new ArrayList();;
+ List descendentSchemas = new ArrayList();
+ Map schemas = ModelUtils.getSchemas(openAPI);
+ String currentSchemaName = thisSchemaName;
+ while (true) {
+ for (String childName : schemas.keySet()) {
+ if (childName == thisSchemaName) {
+ continue;
+ }
+ Schema child = schemas.get(childName);
+ if (ModelUtils.isComposedSchema(child)) {
+ ComposedSchema composedChild = (ComposedSchema) child;
+ List parents = composedChild.getAllOf();
+ if (parents != null) {
+ for (Schema parent: parents) {
+ String ref = parent.get$ref();
+ if (ref == null) {
+ // for schemas with no ref, it is not possible to build the discriminator map
+ // because ref is how we get the model name
+ // we only hit this use case for a schema with inline composed schemas, and one of those
+ // schemas also has inline composed schemas
+ throw new RuntimeException("Invalid inline schema defined in allOf in '" + childName + "'. Per the OpenApi spec, for this case when a composed schema defines a discriminator, the allOf schemas must use $ref. Change this inline definition to a $ref definition");
+ }
+ String parentName = ModelUtils.getSimpleRef(ref);
+ if (parentName.equals(currentSchemaName)) {
+ if (queue.contains(childName) || descendentSchemas.contains(childName)) {
+ throw new RuntimeException("Stack overflow hit when looking for "+thisSchemaName+" an infinite loop starting and ending at "+childName+" was seen");
+ }
+ queue.add(childName);
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (queue.size() == 0) {
+ break;
+ }
+ currentSchemaName = queue.remove(0);
+ MappedModel mm = new MappedModel(currentSchemaName, toModelName(currentSchemaName));
+ descendentSchemas.add(mm);
+ Schema cs = schemas.get(currentSchemaName);
+ Map vendorExtensions = cs.getExtensions();
+ if (vendorExtensions != null && !vendorExtensions.isEmpty() && vendorExtensions.containsKey("x-discriminator-value")) {
+ String xDiscriminatorValue = (String) vendorExtensions.get("x-discriminator-value");
+ mm = new MappedModel(xDiscriminatorValue, toModelName(currentSchemaName));
+ descendentSchemas.add(mm);
+ }
+ }
+ return descendentSchemas;
+ }
+
+ protected CodegenDiscriminator createDiscriminator(String schemaName, Schema schema, OpenAPI openAPI) {
+ Discriminator sourceDiscriminator = recursiveGetDiscriminator(schema, openAPI);
+ if (sourceDiscriminator == null) {
return null;
}
CodegenDiscriminator discriminator = new CodegenDiscriminator();
- discriminator.setPropertyName(toVarName(schema.getDiscriminator().getPropertyName()));
- discriminator.setPropertyBaseName(schema.getDiscriminator().getPropertyName());
+ String discPropName = sourceDiscriminator.getPropertyName();
+ discriminator.setPropertyName(toVarName(discPropName));
+ discriminator.setPropertyBaseName(sourceDiscriminator.getPropertyName());
discriminator.setPropertyGetter(toGetter(discriminator.getPropertyName()));
// FIXME: for now, we assume that the discriminator property is String
discriminator.setPropertyType(typeMapping.get("string"));
- discriminator.setMapping(schema.getDiscriminator().getMapping());
- if (schema.getDiscriminator().getMapping() != null && !schema.getDiscriminator().getMapping().isEmpty()) {
- for (Entry e : schema.getDiscriminator().getMapping().entrySet()) {
+ discriminator.setMapping(sourceDiscriminator.getMapping());
+ List uniqueDescendants = new ArrayList();
+ if (sourceDiscriminator.getMapping() != null && !sourceDiscriminator.getMapping().isEmpty()) {
+ for (Entry e : sourceDiscriminator.getMapping().entrySet()) {
String nameOrRef = e.getValue();
String name = nameOrRef.indexOf('/') >= 0 ? ModelUtils.getSimpleRef(nameOrRef) : nameOrRef;
String modelName = toModelName(name);
- discriminator.getMappedModels().add(new MappedModel(e.getKey(), modelName));
+ uniqueDescendants.add(new MappedModel(e.getKey(), modelName));
}
- } else {
- Map allDefinitions = ModelUtils.getSchemas(this.openAPI);
- allDefinitions.forEach((childName, child) -> {
- if (child instanceof ComposedSchema && ((ComposedSchema) child).getAllOf() != null) {
-
- final List parentSchemas = ModelUtils.getAllParentsName((ComposedSchema) child, allDefinitions, true);
- if (parentSchemas.contains(schemaName)) {
- discriminator.getMappedModels().add(new MappedModel(childName, toModelName(childName)));
- }
- }
- });
}
+
+ boolean legacyUseCase = (this.getLegacyDiscriminatorBehavior() && uniqueDescendants.isEmpty());
+ if (!this.getLegacyDiscriminatorBehavior() || legacyUseCase) {
+ // for schemas that allOf inherit from this schema, add those descendants to this discriminator map
+ List otherDescendants = getAllOfDescendants(schemaName, openAPI);
+ for (MappedModel otherDescendant: otherDescendants) {
+ if (!uniqueDescendants.contains(otherDescendant)) {
+ uniqueDescendants.add(otherDescendant);
+ }
+ }
+ }
+ // if there are composed oneOf/anyOf schemas, add them to this discriminator
+ if (ModelUtils.isComposedSchema(schema) && !this.getLegacyDiscriminatorBehavior()) {
+ List otherDescendants = getOneOfAnyOfDescendants(schemaName, discPropName, (ComposedSchema) schema, openAPI);
+ for (MappedModel otherDescendant: otherDescendants) {
+ if (!uniqueDescendants.contains(otherDescendant)) {
+ uniqueDescendants.add(otherDescendant);
+ }
+ }
+ }
+ if (!this.getLegacyDiscriminatorBehavior()) {
+ Collections.sort(uniqueDescendants);
+ }
+ discriminator.getMappedModels().addAll(uniqueDescendants);
return discriminator;
}
@@ -2410,8 +2763,10 @@ public class DefaultCodegen implements CodegenConfig {
if (schema instanceof ComposedSchema) {
ComposedSchema composedSchema = (ComposedSchema) schema;
- for (Schema component : composedSchema.getAllOf()) {
- addProperties(properties, required, component);
+ if (composedSchema.getAllOf() != null) {
+ for (Schema component : composedSchema.getAllOf()) {
+ addProperties(properties, required, component);
+ }
}
if (schema.getRequired() != null) {
@@ -2419,11 +2774,15 @@ public class DefaultCodegen implements CodegenConfig {
}
if (composedSchema.getOneOf() != null) {
- throw new RuntimeException("Please report the issue: Cannot process oneOf (Composed Scheme) in addProperties: " + schema);
+ for (Schema component : composedSchema.getOneOf()) {
+ addProperties(properties, required, component);
+ }
}
if (composedSchema.getAnyOf() != null) {
- throw new RuntimeException("Please report the issue: Cannot process anyOf (Composed Schema) in addProperties: " + schema);
+ for (Schema component : composedSchema.getAnyOf()) {
+ addProperties(properties, required, component);
+ }
}
return;
@@ -5784,14 +6143,14 @@ public class DefaultCodegen implements CodegenConfig {
//// Following methods are related to the "useOneOfInterfaces" feature
/**
- * Add "x-oneOf-name" extension to a given oneOf schema (assuming it has at least 1 oneOf elements)
+ * Add "x-one-of-name" extension to a given oneOf schema (assuming it has at least 1 oneOf elements)
*
* @param s schema to add the extension to
* @param name name of the parent oneOf schema
*/
public void addOneOfNameExtension(ComposedSchema s, String name) {
if (s.getOneOf() != null && s.getOneOf().size() > 0) {
- s.addExtension("x-oneOf-name", name);
+ s.addExtension("x-one-of-name", name);
}
}
@@ -5800,15 +6159,19 @@ public class DefaultCodegen implements CodegenConfig {
*
* @param cs ComposedSchema object to create as interface model
* @param type name to use for the generated interface model
+ * @param openAPI OpenAPI spec that we are using
*/
- public void addOneOfInterfaceModel(ComposedSchema cs, String type) {
+ public void addOneOfInterfaceModel(ComposedSchema cs, String type, OpenAPI openAPI) {
if (cs.getOneOf() == null) {
return;
}
+
CodegenModel cm = new CodegenModel();
- cm.discriminator = createDiscriminator("", (Schema) cs);
-
+ cm.discriminator = createDiscriminator("", (Schema) cs, openAPI);
+ if (!this.getLegacyDiscriminatorBehavior()) {
+ cm.addDiscriminatorMappedModelsImports();
+ }
for (Schema o : Optional.ofNullable(cs.getOneOf()).orElse(Collections.emptyList())) {
if (o.get$ref() == null) {
if (cm.discriminator != null && o.get$ref() == null) {
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 8b09b893e2..70a42907c9 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
@@ -156,7 +156,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
return defaultValue;
}
- private void configureGeneratorProperties() {
+ void configureGeneratorProperties() {
// allows generating only models by specifying a CSV of models to generate, or empty for all
// NOTE: Boolean.TRUE is required below rather than `true` because of JVM boxing constraints and type inference.
generateApis = GlobalSettings.getProperty(CodegenConstants.APIS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.APIS, null);
@@ -394,7 +394,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
}
@SuppressWarnings("unchecked")
- private void generateModels(List files, List
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ 1.8
+ 1.8
+ true
+ 128m
+ 512m
+
+ -Xlint:all
+ -J-Xss4m
+
+
+ org.apache.maven.pluginsmaven-javadoc-plugin
@@ -314,8 +330,8 @@
{{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/supportJava6}}${java.version}${java.version}
- 1.5.21
- {{#useFeign10}}10.7.4{{/useFeign10}}{{^useFeign10}}9.7.0{{/useFeign10}}
+ 1.5.24
+ {{#useFeign10}}11.0{{/useFeign10}}{{^useFeign10}}9.7.0{{/useFeign10}}{{#useFeign10}}3.8.0{{/useFeign10}}{{^useFeign10}}2.1.0{{/useFeign10}}2.10.30.2.1
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/AbstractOpenApiSchema.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/AbstractOpenApiSchema.mustache
new file mode 100644
index 0000000000..607c223aa2
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/AbstractOpenApiSchema.mustache
@@ -0,0 +1,30 @@
+{{>licenseInfo}}
+
+package {{invokerPackage}}.model;
+
+import org.openapitools.client.ApiException;
+import java.lang.reflect.Type;
+import java.util.Map;
+import javax.ws.rs.core.GenericType;
+
+{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}
+public abstract class AbstractOpenApiSchema {
+
+ private Object instance;
+
+ public final String schemaType;
+
+ public AbstractOpenApiSchema(String schemaType) {
+ this.schemaType = schemaType;
+ }
+
+ public abstract Map getSchemas();
+
+ public Object getActualInstance() {return instance;}
+
+ public void setActualInstance(Object instance) {this.instance = instance;}
+
+ public String getSchemaType() {
+ return schemaType;
+ }
+}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiClient.mustache
new file mode 100644
index 0000000000..10a976f6d7
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiClient.mustache
@@ -0,0 +1,1133 @@
+package {{invokerPackage}};
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.Form;
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
+import org.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.client.ClientProperties;
+import org.glassfish.jersey.client.HttpUrlConnectorProvider;
+import org.glassfish.jersey.jackson.JacksonFeature;
+import org.glassfish.jersey.media.multipart.FormDataBodyPart;
+import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
+import org.glassfish.jersey.media.multipart.MultiPart;
+import org.glassfish.jersey.media.multipart.MultiPartFeature;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.net.URI;
+{{^supportJava6}}
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
+import org.glassfish.jersey.logging.LoggingFeature;
+{{/supportJava6}}
+{{#supportJava6}}
+import org.apache.commons.io.FileUtils;
+import org.glassfish.jersey.filter.LoggingFilter;
+{{/supportJava6}}
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.TimeZone;
+
+import java.net.URLEncoder;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+
+import java.text.DateFormat;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import {{invokerPackage}}.auth.Authentication;
+import {{invokerPackage}}.auth.HttpBasicAuth;
+import {{invokerPackage}}.auth.HttpBearerAuth;
+import {{invokerPackage}}.auth.HttpSignatureAuth;
+import {{invokerPackage}}.auth.ApiKeyAuth;
+import {{invokerPackage}}.model.AbstractOpenApiSchema;
+
+{{#hasOAuthMethods}}
+import {{invokerPackage}}.auth.OAuth;
+{{/hasOAuthMethods}}
+
+{{>generatedAnnotation}}
+public class ApiClient {
+ protected Map defaultHeaderMap = new HashMap();
+ protected Map defaultCookieMap = new HashMap();
+ protected String basePath = "{{{basePath}}}";
+ protected List servers = new ArrayList({{#servers}}{{#-first}}Arrays.asList(
+{{/-first}} new ServerConfiguration(
+ "{{{url}}}",
+ "{{{description}}}{{^description}}No description provided{{/description}}",
+ new HashMap(){{#variables}}{{#-first}} {{
+{{/-first}} put("{{{name}}}", new ServerVariable(
+ "{{{description}}}{{^description}}No description provided{{/description}}",
+ "{{{defaultValue}}}",
+ new HashSet(
+ {{#enumValues}}
+ {{#-first}}
+ Arrays.asList(
+ {{/-first}}
+ "{{{.}}}"{{^-last}},{{/-last}}
+ {{#-last}}
+ )
+ {{/-last}}
+ {{/enumValues}}
+ )
+ ));
+ {{#-last}}
+ }}{{/-last}}{{/variables}}
+ ){{^-last}},{{/-last}}
+ {{#-last}}
+ ){{/-last}}{{/servers}});
+ protected Integer serverIndex = 0;
+ protected Map serverVariables = null;
+ protected Map> operationServers = new HashMap>() {{
+ {{#apiInfo}}
+ {{#apis}}
+ {{#operations}}
+ {{#operation}}
+ {{#servers}}
+ {{#-first}}
+ put("{{{classname}}}.{{{operationId}}}", new ArrayList(Arrays.asList(
+ {{/-first}}
+ new ServerConfiguration(
+ "{{{url}}}",
+ "{{{description}}}{{^description}}No description provided{{/description}}",
+ new HashMap(){{#variables}}{{#-first}} {{
+{{/-first}} put("{{{name}}}", new ServerVariable(
+ "{{{description}}}{{^description}}No description provided{{/description}}",
+ "{{{defaultValue}}}",
+ new HashSet(
+ {{#enumValues}}
+ {{#-first}}
+ Arrays.asList(
+ {{/-first}}
+ "{{{.}}}"{{^-last}},{{/-last}}
+ {{#-last}}
+ )
+ {{/-last}}
+ {{/enumValues}}
+ )
+ ));
+ {{#-last}}
+ }}{{/-last}}{{/variables}}
+ ){{^-last}},{{/-last}}
+ {{#-last}}
+ )));{{/-last}}
+ {{/servers}}
+ {{/operation}}
+ {{/operations}}
+ {{/apis}}
+ {{/apiInfo}}
+ }};
+ protected Map operationServerIndex = new HashMap();
+ protected Map> operationServerVariables = new HashMap>();
+ protected boolean debugging = false;
+ protected int connectionTimeout = 0;
+ private int readTimeout = 0;
+
+ protected Client httpClient;
+ protected JSON json;
+ protected String tempFolderPath = null;
+
+ protected Map authentications;
+ protected Map authenticationLookup;
+
+ protected DateFormat dateFormat;
+
+ public ApiClient() {
+ json = new JSON();
+ httpClient = buildHttpClient(debugging);
+
+ this.dateFormat = new RFC3339DateFormat();
+
+ // Set default User-Agent.
+ setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}");
+
+ // Setup authentications (key: authentication name, value: authentication).
+ authentications = new HashMap();
+ {{#authMethods}}
+ {{#isBasic}}
+ {{#isBasicBasic}}
+ authentications.put("{{name}}", new HttpBasicAuth());
+ {{/isBasicBasic}}
+ {{#isBasicBearer}}
+ authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));
+ {{/isBasicBearer}}
+ {{#isHttpSignature}}
+ authentications.put("{{name}}", new HttpSignatureAuth("{{name}}", null, null));
+ {{/isHttpSignature}}
+ {{/isBasic}}
+ {{#isApiKey}}
+ authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));
+ {{/isApiKey}}
+ {{#isOAuth}}
+ authentications.put("{{name}}", new OAuth());
+ {{/isOAuth}}
+ {{/authMethods}}
+ // Prevent the authentications from being modified.
+ authentications = Collections.unmodifiableMap(authentications);
+
+ // Setup authentication lookup (key: authentication alias, value: authentication name)
+ authenticationLookup = new HashMap();{{#authMethods}}{{#vendorExtensions.x-auth-id-alias}}
+ authenticationLookup.put("{{name}}", "{{.}}");{{/vendorExtensions.x-auth-id-alias}}{{/authMethods}}
+ }
+
+ /**
+ * Gets the JSON instance to do JSON serialization and deserialization.
+ * @return JSON
+ */
+ public JSON getJSON() {
+ return json;
+ }
+
+ public Client getHttpClient() {
+ return httpClient;
+ }
+
+ public ApiClient setHttpClient(Client httpClient) {
+ this.httpClient = httpClient;
+ return this;
+ }
+
+ public String getBasePath() {
+ return basePath;
+ }
+
+ public ApiClient setBasePath(String basePath) {
+ this.basePath = basePath;
+ return this;
+ }
+
+ public List getServers() {
+ return servers;
+ }
+
+ public ApiClient setServers(List servers) {
+ this.servers = servers;
+ return this;
+ }
+
+ public Integer getServerIndex() {
+ return serverIndex;
+ }
+
+ public ApiClient setServerIndex(Integer serverIndex) {
+ this.serverIndex = serverIndex;
+ return this;
+ }
+
+ public Map getServerVariables() {
+ return serverVariables;
+ }
+
+ public ApiClient setServerVariables(Map serverVariables) {
+ this.serverVariables = serverVariables;
+ return this;
+ }
+
+ /**
+ * Get authentications (key: authentication name, value: authentication).
+ * @return Map of authentication object
+ */
+ public Map getAuthentications() {
+ return authentications;
+ }
+
+ /**
+ * Get authentication for the given name.
+ *
+ * @param authName The authentication name
+ * @return The authentication, null if not found
+ */
+ public Authentication getAuthentication(String authName) {
+ return authentications.get(authName);
+ }
+
+ /**
+ * Helper method to set username for the first HTTP basic authentication.
+ * @param username Username
+ */
+ public void setUsername(String username) {
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof HttpBasicAuth) {
+ ((HttpBasicAuth) auth).setUsername(username);
+ return;
+ }
+ }
+ throw new RuntimeException("No HTTP basic authentication configured!");
+ }
+
+ /**
+ * Helper method to set password for the first HTTP basic authentication.
+ * @param password Password
+ */
+ public void setPassword(String password) {
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof HttpBasicAuth) {
+ ((HttpBasicAuth) auth).setPassword(password);
+ return;
+ }
+ }
+ throw new RuntimeException("No HTTP basic authentication configured!");
+ }
+
+ /**
+ * Helper method to set API key value for the first API key authentication.
+ * @param apiKey API key
+ */
+ public void setApiKey(String apiKey) {
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof ApiKeyAuth) {
+ ((ApiKeyAuth) auth).setApiKey(apiKey);
+ return;
+ }
+ }
+ throw new RuntimeException("No API key authentication configured!");
+ }
+
+ /**
+ * Helper method to configure authentications which respects aliases of API keys.
+ *
+ * @param secrets Hash map from authentication name to its secret.
+ */
+ public void configureApiKeys(HashMap secrets) {
+ for (Map.Entry authEntry : authentications.entrySet()) {
+ Authentication auth = authEntry.getValue();
+ if (auth instanceof ApiKeyAuth) {
+ String name = authEntry.getKey();
+ // respect x-auth-id-alias property
+ name = authenticationLookup.getOrDefault(name, name);
+ if (secrets.containsKey(name)) {
+ ((ApiKeyAuth) auth).setApiKey(secrets.get(name));
+ }
+ }
+ }
+ }
+
+ /**
+ * Helper method to set API key prefix for the first API key authentication.
+ * @param apiKeyPrefix API key prefix
+ */
+ public void setApiKeyPrefix(String apiKeyPrefix) {
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof ApiKeyAuth) {
+ ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);
+ return;
+ }
+ }
+ throw new RuntimeException("No API key authentication configured!");
+ }
+
+ /**
+ * Helper method to set bearer token for the first Bearer authentication.
+ * @param bearerToken Bearer token
+ */
+ public void setBearerToken(String bearerToken) {
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof HttpBearerAuth) {
+ ((HttpBearerAuth) auth).setBearerToken(bearerToken);
+ return;
+ }
+ }
+ throw new RuntimeException("No Bearer authentication configured!");
+ }
+
+ {{#hasOAuthMethods}}
+ /**
+ * Helper method to set access token for the first OAuth2 authentication.
+ * @param accessToken Access token
+ */
+ public void setAccessToken(String accessToken) {
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof OAuth) {
+ ((OAuth) auth).setAccessToken(accessToken);
+ return;
+ }
+ }
+ throw new RuntimeException("No OAuth2 authentication configured!");
+ }
+
+ {{/hasOAuthMethods}}
+ /**
+ * Set the User-Agent header's value (by adding to the default header map).
+ * @param userAgent Http user agent
+ * @return API client
+ */
+ public ApiClient setUserAgent(String userAgent) {
+ addDefaultHeader("User-Agent", userAgent);
+ return this;
+ }
+
+ /**
+ * Add a default header.
+ *
+ * @param key The header's key
+ * @param value The header's value
+ * @return API client
+ */
+ public ApiClient addDefaultHeader(String key, String value) {
+ defaultHeaderMap.put(key, value);
+ return this;
+ }
+
+ /**
+ * Add a default cookie.
+ *
+ * @param key The cookie's key
+ * @param value The cookie's value
+ * @return API client
+ */
+ public ApiClient addDefaultCookie(String key, String value) {
+ defaultCookieMap.put(key, value);
+ return this;
+ }
+
+ /**
+ * Check that whether debugging is enabled for this API client.
+ * @return True if debugging is switched on
+ */
+ public boolean isDebugging() {
+ return debugging;
+ }
+
+ /**
+ * Enable/disable debugging for this API client.
+ *
+ * @param debugging To enable (true) or disable (false) debugging
+ * @return API client
+ */
+ public ApiClient setDebugging(boolean debugging) {
+ this.debugging = debugging;
+ // Rebuild HTTP Client according to the new "debugging" value.
+ this.httpClient = buildHttpClient(debugging);
+ return this;
+ }
+
+ /**
+ * The path of temporary folder used to store downloaded files from endpoints
+ * with file response. The default value is null, i.e. using
+ * the system's default tempopary folder.
+ *
+ * @return Temp folder path
+ */
+ public String getTempFolderPath() {
+ return tempFolderPath;
+ }
+
+ /**
+ * Set temp folder path
+ * @param tempFolderPath Temp folder path
+ * @return API client
+ */
+ public ApiClient setTempFolderPath(String tempFolderPath) {
+ this.tempFolderPath = tempFolderPath;
+ return this;
+ }
+
+ /**
+ * Connect timeout (in milliseconds).
+ * @return Connection timeout
+ */
+ public int getConnectTimeout() {
+ return connectionTimeout;
+ }
+
+ /**
+ * Set the connect timeout (in milliseconds).
+ * A value of 0 means no timeout, otherwise values must be between 1 and
+ * {@link Integer#MAX_VALUE}.
+ * @param connectionTimeout Connection timeout in milliseconds
+ * @return API client
+ */
+ public ApiClient setConnectTimeout(int connectionTimeout) {
+ this.connectionTimeout = connectionTimeout;
+ httpClient.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout);
+ return this;
+ }
+
+ /**
+ * read timeout (in milliseconds).
+ * @return Read timeout
+ */
+ public int getReadTimeout() {
+ return readTimeout;
+ }
+
+ /**
+ * Set the read timeout (in milliseconds).
+ * A value of 0 means no timeout, otherwise values must be between 1 and
+ * {@link Integer#MAX_VALUE}.
+ * @param readTimeout Read timeout in milliseconds
+ * @return API client
+ */
+ public ApiClient setReadTimeout(int readTimeout) {
+ this.readTimeout = readTimeout;
+ httpClient.property(ClientProperties.READ_TIMEOUT, readTimeout);
+ return this;
+ }
+
+ /**
+ * Get the date format used to parse/format date parameters.
+ * @return Date format
+ */
+ public DateFormat getDateFormat() {
+ return dateFormat;
+ }
+
+ /**
+ * Set the date format used to parse/format date parameters.
+ * @param dateFormat Date format
+ * @return API client
+ */
+ public ApiClient setDateFormat(DateFormat dateFormat) {
+ this.dateFormat = dateFormat;
+ // also set the date format for model (de)serialization with Date properties
+ this.json.setDateFormat((DateFormat) dateFormat.clone());
+ return this;
+ }
+
+ /**
+ * Parse the given string into Date object.
+ * @param str String
+ * @return Date
+ */
+ public Date parseDate(String str) {
+ try {
+ return dateFormat.parse(str);
+ } catch (java.text.ParseException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Format the given Date object into string.
+ * @param date Date
+ * @return Date in string format
+ */
+ public String formatDate(Date date) {
+ return dateFormat.format(date);
+ }
+
+ /**
+ * Format the given parameter object into string.
+ * @param param Object
+ * @return Object in string format
+ */
+ public String parameterToString(Object param) {
+ if (param == null) {
+ return "";
+ } else if (param instanceof Date) {
+ return formatDate((Date) param);
+ } else if (param instanceof Collection) {
+ StringBuilder b = new StringBuilder();
+ for(Object o : (Collection)param) {
+ if(b.length() > 0) {
+ b.append(',');
+ }
+ b.append(String.valueOf(o));
+ }
+ return b.toString();
+ } else {
+ return String.valueOf(param);
+ }
+ }
+
+ /*
+ * Format to {@code Pair} objects.
+ * @param collectionFormat Collection format
+ * @param name Name
+ * @param value Value
+ * @return List of pairs
+ */
+ public List parameterToPairs(String collectionFormat, String name, Object value){
+ List params = new ArrayList();
+
+ // preconditions
+ if (name == null || name.isEmpty() || value == null) return params;
+
+ Collection valueCollection;
+ if (value instanceof Collection) {
+ valueCollection = (Collection) value;
+ } else {
+ params.add(new Pair(name, parameterToString(value)));
+ return params;
+ }
+
+ if (valueCollection.isEmpty()){
+ return params;
+ }
+
+ // get the collection format (default: csv)
+ String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat);
+
+ // create the params based on the collection format
+ if ("multi".equals(format)) {
+ for (Object item : valueCollection) {
+ params.add(new Pair(name, parameterToString(item)));
+ }
+
+ return params;
+ }
+
+ String delimiter = ",";
+
+ if ("csv".equals(format)) {
+ delimiter = ",";
+ } else if ("ssv".equals(format)) {
+ delimiter = " ";
+ } else if ("tsv".equals(format)) {
+ delimiter = "\t";
+ } else if ("pipes".equals(format)) {
+ delimiter = "|";
+ }
+
+ StringBuilder sb = new StringBuilder() ;
+ for (Object item : valueCollection) {
+ sb.append(delimiter);
+ sb.append(parameterToString(item));
+ }
+
+ params.add(new Pair(name, sb.substring(1)));
+
+ return params;
+ }
+
+ /**
+ * Check if the given MIME is a JSON MIME.
+ * JSON MIME examples:
+ * application/json
+ * application/json; charset=UTF8
+ * APPLICATION/JSON
+ * application/vnd.company+json
+ * "* / *" is also default to JSON
+ * @param mime MIME
+ * @return True if the MIME type is JSON
+ */
+ public boolean isJsonMime(String mime) {
+ String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
+ return mime != null && (mime.matches(jsonMime) || mime.equals("*/*"));
+ }
+
+ /**
+ * Select the Accept header's value from the given accepts array:
+ * if JSON exists in the given array, use it;
+ * otherwise use all of them (joining into a string)
+ *
+ * @param accepts The accepts array to select from
+ * @return The Accept header to use. If the given array is empty,
+ * null will be returned (not to set the Accept header explicitly).
+ */
+ public String selectHeaderAccept(String[] accepts) {
+ if (accepts.length == 0) {
+ return null;
+ }
+ for (String accept : accepts) {
+ if (isJsonMime(accept)) {
+ return accept;
+ }
+ }
+ return StringUtil.join(accepts, ",");
+ }
+
+ /**
+ * Select the Content-Type header's value from the given array:
+ * if JSON exists in the given array, use it;
+ * otherwise use the first one of the array.
+ *
+ * @param contentTypes The Content-Type array to select from
+ * @return The Content-Type header to use. If the given array is empty,
+ * JSON will be used.
+ */
+ public String selectHeaderContentType(String[] contentTypes) {
+ if (contentTypes.length == 0) {
+ return "application/json";
+ }
+ for (String contentType : contentTypes) {
+ if (isJsonMime(contentType)) {
+ return contentType;
+ }
+ }
+ return contentTypes[0];
+ }
+
+ /**
+ * Escape the given string to be used as URL query value.
+ * @param str String
+ * @return Escaped string
+ */
+ public String escapeString(String str) {
+ try {
+ return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20");
+ } catch (UnsupportedEncodingException e) {
+ return str;
+ }
+ }
+
+ /**
+ * Serialize the given Java object into string entity according the given
+ * Content-Type (only JSON is supported for now).
+ * @param obj Object
+ * @param formParams Form parameters
+ * @param contentType Context type
+ * @return Entity
+ * @throws ApiException API exception
+ */
+ public Entity> serialize(Object obj, Map formParams, String contentType) throws ApiException {
+ Entity> entity;
+ if (contentType.startsWith("multipart/form-data")) {
+ MultiPart multiPart = new MultiPart();
+ for (Entry param: formParams.entrySet()) {
+ if (param.getValue() instanceof File) {
+ File file = (File) param.getValue();
+ FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey())
+ .fileName(file.getName()).size(file.length()).build();
+ multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE));
+ } else {
+ FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build();
+ multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue())));
+ }
+ }
+ entity = Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE);
+ } else if (contentType.startsWith("application/x-www-form-urlencoded")) {
+ Form form = new Form();
+ for (Entry param: formParams.entrySet()) {
+ form.param(param.getKey(), parameterToString(param.getValue()));
+ }
+ entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE);
+ } else {
+ // We let jersey handle the serialization
+ entity = Entity.entity(obj == null ? Entity.text("") : obj, contentType);
+ }
+ return entity;
+ }
+
+ /**
+ * Serialize the given Java object into string according the given
+ * Content-Type (only JSON, HTTP form is supported for now).
+ * @param obj Object
+ * @param formParams Form parameters
+ * @param contentType Context type
+ * @return String
+ * @throws ApiException API exception
+ */
+ public String serializeToString(Object obj, Map formParams, String contentType) throws ApiException {
+ try {
+ if (contentType.startsWith("multipart/form-data")) {
+ throw new ApiException("multipart/form-data not yet supported for serializeToString (http signature authentication)");
+ } else if (contentType.startsWith("application/x-www-form-urlencoded")) {
+ String formString = "";
+ for (Entry param : formParams.entrySet()) {
+ formString = param.getKey() + "=" + URLEncoder.encode(parameterToString(param.getValue()), "UTF-8") + "&";
+ }
+
+ if (formString.length() == 0) { // empty string
+ return formString;
+ } else {
+ return formString.substring(0, formString.length() - 1);
+ }
+ } else {
+ return json.getMapper().writeValueAsString(obj);
+ }
+ } catch (Exception ex) {
+ throw new ApiException("Failed to perform serializeToString: " + ex.toString());
+ }
+ }
+
+ public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenApiSchema schema) throws ApiException{
+
+ Object result = null;
+ int matchCounter = 0;
+ ArrayList matchSchemas = new ArrayList<>();
+
+ for (Map.Entry entry : schema.getSchemas().entrySet()) {
+ String schemaName = entry.getKey();
+ GenericType schemaType = entry.getValue();
+
+ if (schemaType instanceof GenericType) { // model
+ try {
+ Object deserializedObject = deserialize(response, schemaType);
+ if (deserializedObject != null) {
+ result = deserializedObject;
+ matchCounter++;
+
+ if ("anyOf".equals(schema.getSchemaType())) {
+ break;
+ } else if ("oneOf".equals(schema.getSchemaType())) {
+ matchSchemas.add(schemaName);
+ } else {
+ throw new ApiException("Unknowe type found while expecting anyOf/oneOf:" + schema.getSchemaType());
+ }
+ } else {
+ // failed to deserialize the response in the schema provided, proceed to the next one if any
+ }
+ } catch (Exception ex) {
+ // failed to deserialize, do nothing and try next one (schema)
+ }
+ } else {// unknown type
+ throw new ApiException(schemaType.getClass() + " is not a GenericType and cannot be handled properly in deserialization.");
+ }
+
+ }
+
+ if (matchCounter > 1 && "oneOf".equals(schema.getSchemaType())) {// more than 1 match for oneOf
+ throw new ApiException("Response body is invalid as it matches more than one schema (" + String.join(", ", matchSchemas) + ") defined in the oneOf model: " + schema.getClass().getName());
+ } else if (matchCounter == 0) { // fail to match any in oneOf/anyOf schemas
+ throw new ApiException("Response body is invalid as it doens't match any schemas (" + String.join(", ", schema.getSchemas().keySet()) + ") defined in the oneOf/anyOf model: " + schema.getClass().getName());
+ } else { // only one matched
+ schema.setActualInstance(result);
+ return schema;
+ }
+
+ }
+
+
+
+ /**
+ * Deserialize response body to Java object according to the Content-Type.
+ * @param Type
+ * @param response Response
+ * @param returnType Return type
+ * @return Deserialize object
+ * @throws ApiException API exception
+ */
+ @SuppressWarnings("unchecked")
+ public T deserialize(Response response, GenericType returnType) throws ApiException {
+ if (response == null || returnType == null) {
+ return null;
+ }
+
+ if ("byte[]".equals(returnType.toString())) {
+ // Handle binary response (byte array).
+ return (T) response.readEntity(byte[].class);
+ } else if (returnType.getRawType() == File.class) {
+ // Handle file downloading.
+ T file = (T) downloadFileFromResponse(response);
+ return file;
+ }
+
+ String contentType = null;
+ List contentTypes = response.getHeaders().get("Content-Type");
+ if (contentTypes != null && !contentTypes.isEmpty())
+ contentType = String.valueOf(contentTypes.get(0));
+
+ // read the entity stream multiple times
+ response.bufferEntity();
+
+ return response.readEntity(returnType);
+ }
+
+ /**
+ * Download file from the given response.
+ * @param response Response
+ * @return File
+ * @throws ApiException If fail to read file content from response and write to disk
+ */
+ public File downloadFileFromResponse(Response response) throws ApiException {
+ try {
+ File file = prepareDownloadFile(response);
+{{^supportJava6}}
+ Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
+{{/supportJava6}}
+{{#supportJava6}}
+ // Java6 falls back to commons.io for file copying
+ FileUtils.copyToFile(response.readEntity(InputStream.class), file);
+{{/supportJava6}}
+ return file;
+ } catch (IOException e) {
+ throw new ApiException(e);
+ }
+ }
+
+ public File prepareDownloadFile(Response response) throws IOException {
+ String filename = null;
+ String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition");
+ if (contentDisposition != null && !"".equals(contentDisposition)) {
+ // Get filename from the Content-Disposition header.
+ Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
+ Matcher matcher = pattern.matcher(contentDisposition);
+ if (matcher.find())
+ filename = matcher.group(1);
+ }
+
+ String prefix;
+ String suffix = null;
+ if (filename == null) {
+ prefix = "download-";
+ suffix = "";
+ } else {
+ int pos = filename.lastIndexOf('.');
+ if (pos == -1) {
+ prefix = filename + "-";
+ } else {
+ prefix = filename.substring(0, pos) + "-";
+ suffix = filename.substring(pos);
+ }
+ // File.createTempFile requires the prefix to be at least three characters long
+ if (prefix.length() < 3)
+ prefix = "download-";
+ }
+
+ if (tempFolderPath == null)
+ return File.createTempFile(prefix, suffix);
+ else
+ return File.createTempFile(prefix, suffix, new File(tempFolderPath));
+ }
+
+ /**
+ * Invoke API by sending HTTP request with the given options.
+ *
+ * @param Type
+ * @param operation The qualified name of the operation
+ * @param path The sub-path of the HTTP URL
+ * @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE"
+ * @param queryParams The query parameters
+ * @param body The request body object
+ * @param headerParams The header parameters
+ * @param cookieParams The cookie parameters
+ * @param formParams The form parameters
+ * @param accept The request's Accept header
+ * @param contentType The request's Content-Type header
+ * @param authNames The authentications to apply
+ * @param returnType The return type into which to deserialize the response
+ * @param schema An instance of the response that uses oneOf/anyOf
+ * @return The response body in type of string
+ * @throws ApiException API exception
+ */
+ public ApiResponse invokeAPI(String operation, String path, String method, List queryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType, AbstractOpenApiSchema schema) throws ApiException {
+
+ // Not using `.target(targetURL).path(path)` below,
+ // to support (constant) query string in `path`, e.g. "/posts?draft=1"
+ String targetURL;
+ if (serverIndex != null) {
+ Integer index;
+ List serverConfigurations;
+ Map variables;
+
+ if (operationServers.containsKey(operation)) {
+ index = operationServerIndex.getOrDefault(operation, serverIndex);
+ variables = operationServerVariables.getOrDefault(operation, serverVariables);
+ serverConfigurations = operationServers.get(operation);
+ } else {
+ index = serverIndex;
+ variables = serverVariables;
+ serverConfigurations = servers;
+ }
+ if (index < 0 || index >= serverConfigurations.size()) {
+ throw new ArrayIndexOutOfBoundsException(String.format(
+ "Invalid index %d when selecting the host settings. Must be less than %d", index, serverConfigurations.size()
+ ));
+ }
+ targetURL = serverConfigurations.get(index).URL(variables) + path;
+ } else {
+ targetURL = this.basePath + path;
+ }
+ WebTarget target = httpClient.target(targetURL);
+
+ if (queryParams != null) {
+ for (Pair queryParam : queryParams) {
+ if (queryParam.getValue() != null) {
+ target = target.queryParam(queryParam.getName(), escapeString(queryParam.getValue()));
+ }
+ }
+ }
+
+ Invocation.Builder invocationBuilder = target.request().accept(accept);
+
+ for (Entry entry : headerParams.entrySet()) {
+ String value = entry.getValue();
+ if (value != null) {
+ invocationBuilder = invocationBuilder.header(entry.getKey(), value);
+ }
+ }
+
+ for (Entry entry : cookieParams.entrySet()) {
+ String value = entry.getValue();
+ if (value != null) {
+ invocationBuilder = invocationBuilder.cookie(entry.getKey(), value);
+ }
+ }
+
+ for (Entry entry : defaultCookieMap.entrySet()) {
+ String value = entry.getValue();
+ if (value != null) {
+ invocationBuilder = invocationBuilder.cookie(entry.getKey(), value);
+ }
+ }
+
+ for (Entry entry : defaultHeaderMap.entrySet()) {
+ String key = entry.getKey();
+ if (!headerParams.containsKey(key)) {
+ String value = entry.getValue();
+ if (value != null) {
+ invocationBuilder = invocationBuilder.header(key, value);
+ }
+ }
+ }
+
+ Entity> entity = serialize(body, formParams, contentType);
+
+ // put all headers in one place
+ Map allHeaderParams = new HashMap<>();
+ allHeaderParams.putAll(defaultHeaderMap);
+ allHeaderParams.putAll(headerParams);
+
+ // update different parameters (e.g. headers) for authentication
+ updateParamsForAuth(authNames, queryParams, allHeaderParams, cookieParams, serializeToString(body, formParams, contentType), method, target.getUri());
+
+ Response response = null;
+
+ try {
+ if ("GET".equals(method)) {
+ response = invocationBuilder.get();
+ } else if ("POST".equals(method)) {
+ response = invocationBuilder.post(entity);
+ } else if ("PUT".equals(method)) {
+ response = invocationBuilder.put(entity);
+ } else if ("DELETE".equals(method)) {
+ response = invocationBuilder.method("DELETE", entity);
+ } else if ("PATCH".equals(method)) {
+ response = invocationBuilder.method("PATCH", entity);
+ } else if ("HEAD".equals(method)) {
+ response = invocationBuilder.head();
+ } else if ("OPTIONS".equals(method)) {
+ response = invocationBuilder.options();
+ } else if ("TRACE".equals(method)) {
+ response = invocationBuilder.trace();
+ } else {
+ throw new ApiException(500, "unknown method type " + method);
+ }
+
+ int statusCode = response.getStatusInfo().getStatusCode();
+ Map> responseHeaders = buildResponseHeaders(response);
+
+ if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) {
+ return new ApiResponse<{{#supportJava6}}T{{/supportJava6}}>(statusCode, responseHeaders);
+ } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) {
+ if (returnType == null)
+ return new ApiResponse<{{#supportJava6}}T{{/supportJava6}}>(statusCode, responseHeaders);
+ else
+ if (schema == null) {
+ return new ApiResponse<>(statusCode, responseHeaders, deserialize(response, returnType));
+ } else { // oneOf/anyOf
+ return new ApiResponse<>(statusCode, responseHeaders, (T)deserializeSchemas(response, schema));
+ }
+ } else {
+ String message = "error";
+ String respBody = null;
+ if (response.hasEntity()) {
+ try {
+ respBody = String.valueOf(response.readEntity(String.class));
+ message = respBody;
+ } catch (RuntimeException e) {
+ // e.printStackTrace();
+ }
+ }
+ throw new ApiException(
+ response.getStatus(),
+ message,
+ buildResponseHeaders(response),
+ respBody);
+ }
+ } finally {
+ try {
+ response.close();
+ } catch (Exception e) {
+ // it's not critical, since the response object is local in method invokeAPI; that's fine, just continue
+ }
+ }
+ }
+
+ /**
+ * @deprecated Add qualified name of the operation as a first parameter.
+ */
+ @Deprecated
+ public ApiResponse invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType, AbstractOpenApiSchema schema) throws ApiException {
+ return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, schema);
+ }
+
+ /**
+ * Build the Client used to make HTTP requests.
+ * @param debugging Debug setting
+ * @return Client
+ */
+ protected Client buildHttpClient(boolean debugging) {
+ final ClientConfig clientConfig = new ClientConfig();
+ clientConfig.register(MultiPartFeature.class);
+ clientConfig.register(json);
+ clientConfig.register(JacksonFeature.class);
+ clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
+ // turn off compliance validation to be able to send payloads with DELETE calls
+ clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);
+ if (debugging) {
+{{^supportJava6}}
+ clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
+ clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
+ // Set logger to ALL
+ java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME).setLevel(java.util.logging.Level.ALL);
+{{/supportJava6}}
+{{#supportJava6}}
+ clientConfig.register(new LoggingFilter(java.util.logging.Logger.getLogger(LoggingFilter.class.getName()), true));
+{{/supportJava6}}
+ } else {
+ // suppress warnings for payloads with DELETE calls:
+ java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE);
+ }
+ performAdditionalClientConfiguration(clientConfig);
+ return ClientBuilder.newClient(clientConfig);
+ }
+
+ protected void performAdditionalClientConfiguration(ClientConfig clientConfig) {
+ // No-op extension point
+ }
+
+ protected Map> buildResponseHeaders(Response response) {
+ Map> responseHeaders = new HashMap>();
+ for (Entry> entry: response.getHeaders().entrySet()) {
+ List values = entry.getValue();
+ List headers = new ArrayList();
+ for (Object o : values) {
+ headers.add(String.valueOf(o));
+ }
+ responseHeaders.put(entry.getKey(), headers);
+ }
+ return responseHeaders;
+ }
+
+ /**
+ * Update query and header parameters based on authentication settings.
+ *
+ * @param authNames The authentications to apply
+ * @param queryParams List of query parameters
+ * @param headerParams Map of header parameters
+ * @param cookieParams Map of cookie parameters
+ * @param method HTTP method (e.g. POST)
+ * @param uri HTTP URI
+ */
+ protected void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams,
+ Map cookieParams, String payload, String method, URI uri) throws ApiException {
+ for (String authName : authNames) {
+ Authentication auth = authentications.get(authName);
+ if (auth == null) {
+ throw new RuntimeException("Authentication undefined: " + authName);
+ }
+ auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri);
+ }
+ }
+}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiResponse.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiResponse.mustache
new file mode 100644
index 0000000000..a67b11f054
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiResponse.mustache
@@ -0,0 +1,58 @@
+{{>licenseInfo}}
+
+package {{invokerPackage}};
+
+import java.util.List;
+import java.util.Map;
+{{#caseInsensitiveResponseHeaders}}
+import java.util.Map.Entry;
+import java.util.TreeMap;
+{{/caseInsensitiveResponseHeaders}}
+
+/**
+ * API response returned by API call.
+ *
+ * @param The type of data that is deserialized from response body
+ */
+public class ApiResponse {
+ private final int statusCode;
+ private final Map> headers;
+ private final T data;
+
+ /**
+ * @param statusCode The status code of HTTP response
+ * @param headers The headers of HTTP response
+ */
+ public ApiResponse(int statusCode, Map> headers) {
+ this(statusCode, headers, null);
+ }
+
+ /**
+ * @param statusCode The status code of HTTP response
+ * @param headers The headers of HTTP response
+ * @param data The object deserialized from response bod
+ */
+ public ApiResponse(int statusCode, Map> headers, T data) {
+ this.statusCode = statusCode;
+ {{#caseInsensitiveResponseHeaders}}
+ Map> responseHeaders = new TreeMap>(String.CASE_INSENSITIVE_ORDER);
+ for(Entry> entry : headers.entrySet()){
+ responseHeaders.put(entry.getKey().toLowerCase(), entry.getValue());
+ }
+ {{/caseInsensitiveResponseHeaders}}
+ this.headers = {{#caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}};
+ this.data = data;
+ }
+
+ public int getStatusCode() {
+ return statusCode;
+ }
+
+ public Map> getHeaders() {
+ return headers;
+ }
+
+ public T getData() {
+ return data;
+ }
+}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/JSON.mustache
new file mode 100644
index 0000000000..e25b307f7d
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/JSON.mustache
@@ -0,0 +1,67 @@
+package {{invokerPackage}};
+
+{{#threetenbp}}
+import org.threeten.bp.*;
+{{/threetenbp}}
+import com.fasterxml.jackson.annotation.*;
+import com.fasterxml.jackson.databind.*;
+import org.openapitools.jackson.nullable.JsonNullableModule;
+{{#java8}}
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+{{/java8}}
+{{#joda}}
+import com.fasterxml.jackson.datatype.joda.JodaModule;
+{{/joda}}
+{{#threetenbp}}
+import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
+{{/threetenbp}}
+
+import java.text.DateFormat;
+
+import javax.ws.rs.ext.ContextResolver;
+
+{{>generatedAnnotation}}
+public class JSON implements ContextResolver {
+ private ObjectMapper mapper;
+
+ public JSON() {
+ mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
+ mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true);
+ mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+ mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
+ mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
+ mapper.setDateFormat(new RFC3339DateFormat());
+ {{#java8}}
+ mapper.registerModule(new JavaTimeModule());
+ {{/java8}}
+ {{#joda}}
+ mapper.registerModule(new JodaModule());
+ {{/joda}}
+ {{#threetenbp}}
+ ThreeTenModule module = new ThreeTenModule();
+ module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT);
+ module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME);
+ module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME);
+ mapper.registerModule(module);
+ {{/threetenbp}}
+ JsonNullableModule jnm = new JsonNullableModule();
+ mapper.registerModule(jnm);
+ }
+
+ /**
+ * Set the date format for JSON (de)serialization with Date properties.
+ * @param dateFormat Date format
+ */
+ public void setDateFormat(DateFormat dateFormat) {
+ mapper.setDateFormat(dateFormat);
+ }
+
+ @Override
+ public ObjectMapper getContext(Class> type) {
+ return mapper;
+ }
+
+ public ObjectMapper getMapper() { return mapper; }
+}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/anyof_model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/anyof_model.mustache
new file mode 100644
index 0000000000..a3702d221a
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/anyof_model.mustache
@@ -0,0 +1,28 @@
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.Response;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}}
+public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} {
+
+ // store a list of schema names defined in anyOf
+ public final static Map schemas = new HashMap();
+
+ public {{classname}}() {
+ super("anyOf");
+ }
+
+ static {
+ {{#anyOf}}
+ schemas.put("{{{.}}}", new GenericType<{{{.}}}>() {
+ });
+ {{/anyOf}}
+ }
+
+ @Override
+ public Map getSchemas() {
+ return {{classname}}.schemas;
+ }
+}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api.mustache
new file mode 100644
index 0000000000..a0730135f7
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api.mustache
@@ -0,0 +1,244 @@
+package {{package}};
+
+import {{invokerPackage}}.ApiException;
+import {{invokerPackage}}.ApiClient;
+import {{invokerPackage}}.ApiResponse;
+import {{invokerPackage}}.Configuration;
+import {{invokerPackage}}.Pair;
+
+import javax.ws.rs.core.GenericType;
+
+{{#imports}}import {{import}};
+{{/imports}}
+
+{{^fullJavaUtil}}
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+{{/fullJavaUtil}}
+
+{{>generatedAnnotation}}
+{{#operations}}
+public class {{classname}} {
+ private ApiClient apiClient;
+
+ public {{classname}}() {
+ this(Configuration.getDefaultApiClient());
+ }
+
+ public {{classname}}(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ public ApiClient getApiClient() {
+ return apiClient;
+ }
+
+ public void setApiClient(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+ {{#operation}}
+ {{^vendorExtensions.x-group-parameters}}
+ /**
+ * {{summary}}
+ * {{notes}}
+ {{#allParams}}
+ * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}
+ {{/allParams}}
+ {{#returnType}}
+ * @return {{returnType}}
+ {{/returnType}}
+ * @throws ApiException if fails to make API call
+ {{#responses.0}}
+ * @http.response.details
+