Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DefaultCodegen] generate unknown default case #11078

Merged
merged 20 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e4d39c6
[DefaultCodegen] generate unknown default case
4brunu Dec 8, 2021
d2de1b1
[DefaultCodegen] replace Swift custom implementation with the Default…
4brunu Dec 8, 2021
a2a0738
[DefaultCodegen] generate unknown default case
4brunu Dec 8, 2021
013695c
[DefaultCodegen] generate unknown default case
4brunu Dec 8, 2021
c657c92
[DefaultCodegen] generate unknown default case
4brunu Dec 8, 2021
732a345
[DefaultCodegen] generate unknown default case
4brunu Dec 9, 2021
f935cae
[DefaultCodegen] generate unknown default case
4brunu Dec 9, 2021
938497c
[DefaultCodegen] generate unknown default case
4brunu Dec 9, 2021
f01ba3a
[DefaultCodegen] generate unknown default case
4brunu Dec 9, 2021
1fe52fb
[DefaultCodegen] generate unknown default case
4brunu Dec 9, 2021
fc31f04
[DefaultCodegen] update docs
4brunu Dec 9, 2021
9fa7227
[DefaultCodegen] fix Swift enum case name
4brunu Dec 9, 2021
3c59db7
Merge branch 'master' into feature/kotlin-unknown-enum-case
4brunu Dec 10, 2021
c728738
Merge branch 'master' into feature/kotlin-unknown-enum-case
4brunu Dec 11, 2021
46be4f5
Merge branch 'master' into feature/kotlin-unknown-enum-case
4brunu Dec 13, 2021
bb49ccb
[DefaultCodegen] generate unknown default case
4brunu Dec 16, 2021
ec6533d
[DefaultCodegen] generate unknown default case
4brunu Dec 16, 2021
f15edb8
Merge branch 'master' into feature/kotlin-unknown-enum-case
4brunu Dec 16, 2021
88f56ce
Merge branch 'master' into feature/kotlin-unknown-enum-case
4brunu Dec 17, 2021
5b4b7ba
Merge branch 'master' into feature/kotlin-unknown-enum-case
4brunu Dec 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/configs/kotlin-enum-default-value.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ additionalProperties:
artifactId: kotlin-enum-default-value
serializableModel: "true"
dateLibrary: java8
enumUnknownDefaultCase: true
1 change: 1 addition & 0 deletions bin/configs/kotlin-jvm-okhttp3-okhttp3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
additionalProperties:
artifactId: kotlin-petstore-okhttp3
enumUnknownDefaultCase: true
2 changes: 1 addition & 1 deletion bin/configs/swift5-frozenEnums.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ additionalProperties:
podAuthors: ""
podSummary: PetstoreClient
sortParamsByRequiredFlag: false
generateFrozenEnums: false
enumUnknownDefaultCase: true
projectName: PetstoreClient
podHomepage: https://github.com/openapitools/openapi-generator
1 change: 1 addition & 0 deletions docs/generators/ada-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by old spec/client, the client will fail to parse the network response.With the enumUnknownDefaultCase option enabled, each enum will have a new case, &acute;unknown_default_open_api&acute;, so that when the server send an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new cases, &acute;unknown_default_open_api&acute;, so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I addressed a few typos in the description that can be applied across each generator's doc:

|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response. With this option enabled, each enum will have a new case, &acute;unknown_default_open_api&acute;, so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, &acute;unknown_default_open_api&acute;, so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|

|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|projectName|GNAT project name| |defaultProject|
Expand Down
1 change: 1 addition & 0 deletions docs/generators/ada.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by old spec/client, the client will fail to parse the network response.With the enumUnknownDefaultCase option enabled, each enum will have a new case, &acute;unknown_default_open_api&acute;, so that when the server send an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new cases, &acute;unknown_default_open_api&acute;, so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|projectName|GNAT project name| |defaultProject|
Expand Down
1 change: 1 addition & 0 deletions docs/generators/android.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactVersion|artifact version for use in the generated build.gradle and pom.xml| |null|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by old spec/client, the client will fail to parse the network response.With the enumUnknownDefaultCase option enabled, each enum will have a new case, &acute;unknown_default_open_api&acute;, so that when the server send an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new cases, &acute;unknown_default_open_api&acute;, so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|groupId|groupId for use in the generated build.gradle and pom.xml| |null|
|invokerPackage|root package for generated code| |null|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
Expand Down
1 change: 1 addition & 0 deletions docs/generators/apache2.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by old spec/client, the client will fail to parse the network response.With the enumUnknownDefaultCase option enabled, each enum will have a new case, &acute;unknown_default_open_api&acute;, so that when the server send an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new cases, &acute;unknown_default_open_api&acute;, so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|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|
Expand Down
1 change: 1 addition & 0 deletions docs/generators/apex.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|classPrefix|Prefix for generated classes. Set this to avoid overwriting existing classes in your org.| |null|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by old spec/client, the client will fail to parse the network response.With the enumUnknownDefaultCase option enabled, each enum will have a new case, &acute;unknown_default_open_api&acute;, so that when the server send an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new cases, &acute;unknown_default_open_api&acute;, so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|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|
Expand Down
1 change: 1 addition & 0 deletions docs/generators/asciidoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |null|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by old spec/client, the client will fail to parse the network response.With the enumUnknownDefaultCase option enabled, each enum will have a new case, &acute;unknown_default_open_api&acute;, so that when the server send an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new cases, &acute;unknown_default_open_api&acute;, so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|groupId|groupId in generated pom.xml| |null|
|headerAttributes|generation of asciidoc header meta data attributes (set to false to suppress, default: true)| |true|
|infoEmail|an email address to contact for inquiries about the application| |null|
Expand Down
1 change: 1 addition & 0 deletions docs/generators/avro-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by old spec/client, the client will fail to parse the network response.With the enumUnknownDefaultCase option enabled, each enum will have a new case, &acute;unknown_default_open_api&acute;, so that when the server send an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new cases, &acute;unknown_default_open_api&acute;, so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|packageName|package for generated classes (where supported)| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
Expand Down
1 change: 1 addition & 0 deletions docs/generators/bash.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|curlOptions|Default cURL options| |null|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by old spec/client, the client will fail to parse the network response.With the enumUnknownDefaultCase option enabled, each enum will have a new case, &acute;unknown_default_open_api&acute;, so that when the server send an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new cases, &acute;unknown_default_open_api&acute;, so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|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|
Expand Down
Loading