diff --git a/.github/workflows/gradle-test.yaml b/.github/workflows/gradle-test.yaml
index 92c976f55d4..755ca996a15 100644
--- a/.github/workflows/gradle-test.yaml
+++ b/.github/workflows/gradle-test.yaml
@@ -21,7 +21,7 @@ jobs:
build:
name: Gradle tests
runs-on: ubuntu-latest
- container: gradle:jdk8
+ container: gradle:jdk11
strategy:
fail-fast: true
matrix:
@@ -37,7 +37,7 @@ jobs:
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
- java-version: 8
+ java-version: 11
# Cache Gradle Dependencies
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v2
diff --git a/README.md b/README.md
index e993fdf0fb2..5774c216447 100644
--- a/README.md
+++ b/README.md
@@ -589,6 +589,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [Bithost GmbH](https://www.bithost.ch)
- [Bosch Connected Industry](https://www.bosch-connected-industry.com)
- [Boxever](https://www.boxever.com/)
+- [Bunker Holding Group](https://www.bunker-holding.com/)
- [California State University, Northridge](https://www.csun.edu)
- [CAM](https://www.cam-inc.co.jp/)
- [Camptocamp](https://www.camptocamp.com/en)
@@ -650,6 +651,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [Ponicode](https://ponicode.dev/)
- [Pricefx](https://www.pricefx.com/)
- [Prometheus/Alertmanager](https://github.com/prometheus/alertmanager)
+- [Qavar](https://www.qavar.com)
- [QEDIT](https://qed-it.com)
- [Qulix Systems](https://www.qulix.com)
- [Raksul](https://corp.raksul.com)
diff --git a/appveyor.yml b/appveyor.yml
index bd3df29e020..b415f595021 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -7,7 +7,7 @@ install:
Add-Type -AssemblyName System.IO.Compression.FileSystem
if (!(Test-Path -Path "C:\maven" )) {
(new-object System.Net.WebClient).DownloadFile(
- 'http://www.us.apache.org/dist/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.zip',
+ 'https://archive.apache.org/dist/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.zip',
'C:\maven-bin.zip'
)
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\maven-bin.zip", "C:\maven")
@@ -22,15 +22,15 @@ install:
)
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\gradle-bin.zip", "C:\gradle")
}
- - cmd: SET PATH=C:\maven\apache-maven-3.2.5\bin;C:\gradle\gradle-5.6.4\bin;%JAVA_HOME%\bin;%PATH%
+ - cmd: SET PATH=C:\maven\apache-maven-3.8.3\bin;C:\gradle\gradle-5.6.4\bin;%JAVA_HOME%\bin;%PATH%
- cmd: SET MAVEN_OPTS=-Xmx4g
- cmd: SET JAVA_OPTS=-Xmx4g
- - cmd: SET M2_HOME=C:\maven\apache-maven-3.2.5
+ - cmd: SET M2_HOME=C:\maven\apache-maven-3.8.3
- cmd: java -version
- cmd: gradle -v
- cmd: dir/w
- git clone https://github.com/wing328/swagger-samples --depth 1
- - ps: Start-Process -FilePath 'C:\maven\apache-maven-3.2.5\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci"
+ - ps: Start-Process -FilePath 'C:\maven\apache-maven-3.8.3\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci"
- ps: Start-Sleep -s 15
- ps: $PSVersionTable.PSVersion
- ps: Install-Module -Name Pester -Force -Scope CurrentUser
diff --git a/bin/configs/csharp-netcore-complex-files.yaml b/bin/configs/csharp-netcore-complex-files.yaml
new file mode 100644
index 00000000000..b67cece1ad1
--- /dev/null
+++ b/bin/configs/csharp-netcore-complex-files.yaml
@@ -0,0 +1,10 @@
+generatorName: csharp-netcore
+outputDir: samples/client/others/csharp-netcore-complex-files
+inputSpec: modules/openapi-generator/src/test/resources/3_0/form-multipart-binary-array.yaml
+templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
+additionalProperties:
+ packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
+ targetFramework: netstandard2.0
+ useCompareNetObjects: "true"
+globalProperties:
+ skipFormModel: "false"
diff --git a/bin/utils/release/release_version_update.sh b/bin/utils/release/release_version_update.sh
index a6f310fe2bd..9026c07afbd 100755
--- a/bin/utils/release/release_version_update.sh
+++ b/bin/utils/release/release_version_update.sh
@@ -79,6 +79,7 @@ declare -a xml_files=(
"${root}/modules/openapi-generator-online/pom.xml"
"${root}/modules/openapi-generator/pom.xml"
"${root}/modules/openapi-generator-gradle-plugin/gradle.properties"
+ "${root}/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties"
"${root}/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml"
"${root}/modules/openapi-generator-maven-plugin/examples/java-client.xml"
"${root}/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml"
diff --git a/docs/generators/cpp-qt-client.md b/docs/generators/cpp-qt-client.md
index 0dcbd968233..96be28abb0a 100644
--- a/docs/generators/cpp-qt-client.md
+++ b/docs/generators/cpp-qt-client.md
@@ -236,10 +236,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✓|OAS3
-|OAuth2_Implicit|✗|OAS2,OAS3
-|OAuth2_Password|✗|OAS2,OAS3
-|OAuth2_ClientCredentials|✗|OAS2,OAS3
-|OAuth2_AuthorizationCode|✗|OAS2,OAS3
+|OAuth2_Implicit|✓|OAS2,OAS3
+|OAuth2_Password|✓|OAS2,OAS3
+|OAuth2_ClientCredentials|✓|OAS2,OAS3
+|OAuth2_AuthorizationCode|✓|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
diff --git a/docs/generators/scala-akka-http-server.md b/docs/generators/scala-akka-http-server.md
index 7e056315f61..3727fc6fdf6 100644
--- a/docs/generators/scala-akka-http-server.md
+++ b/docs/generators/scala-akka-http-server.md
@@ -13,7 +13,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId| |openapi-scala-akka-http-server|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|asManagedSources|Resulting files cab be used as managed resources. No build files or default controllers will be generated| |false|
-|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (prefered for JDK 1.8+)
|java8|
+|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (preferred for JDK 1.8+)
|java8|
|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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true|
|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|
diff --git a/docs/generators/scala-akka.md b/docs/generators/scala-akka.md
index 683fbef2167..f2c9cecdab9 100644
--- a/docs/generators/scala-akka.md
+++ b/docs/generators/scala-akka.md
@@ -9,7 +9,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|
|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|
+|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (preferred for JDK 1.8+)
|java8|
|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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true|
diff --git a/docs/generators/scala-gatling.md b/docs/generators/scala-gatling.md
index 414715926d2..2477cb6848e 100644
--- a/docs/generators/scala-gatling.md
+++ b/docs/generators/scala-gatling.md
@@ -9,7 +9,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|
|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|
+|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (preferred for JDK 1.8+)
|java8|
|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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true|
diff --git a/docs/generators/scala-httpclient-deprecated.md b/docs/generators/scala-httpclient-deprecated.md
index 15bf6f6e26f..adf4649ffcc 100644
--- a/docs/generators/scala-httpclient-deprecated.md
+++ b/docs/generators/scala-httpclient-deprecated.md
@@ -9,7 +9,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|
|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|
+|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (preferred for JDK 1.8+)
|java8|
|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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true|
diff --git a/docs/generators/scala-lagom-server.md b/docs/generators/scala-lagom-server.md
index 8dc2075e377..8c583afcaac 100644
--- a/docs/generators/scala-lagom-server.md
+++ b/docs/generators/scala-lagom-server.md
@@ -9,7 +9,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|
|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|
+|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (preferred for JDK 1.8+)
|java8|
|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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true|
diff --git a/docs/generators/scala-sttp.md b/docs/generators/scala-sttp.md
index a0cd2044ea1..0e12f7695d4 100644
--- a/docs/generators/scala-sttp.md
+++ b/docs/generators/scala-sttp.md
@@ -10,7 +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|
|apiPackage|package for generated api classes| |null|
|circeVersion|The version of circe library| |0.13.0|
-|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (prefered for JDK 1.8+)
|java8|
+|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (preferred for JDK 1.8+)
|java8|
|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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|jodaTimeVersion|The version of joda-time library| |2.10.10|
diff --git a/docs/generators/scalatra.md b/docs/generators/scalatra.md
index a7a657bce95..aab1bd98c22 100644
--- a/docs/generators/scalatra.md
+++ b/docs/generators/scalatra.md
@@ -9,7 +9,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|
|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|
+|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (preferred for JDK 1.8+)
|java8|
|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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true|
diff --git a/docs/generators/scalaz.md b/docs/generators/scalaz.md
index 41b6240df6d..87dc8b0e5e4 100644
--- a/docs/generators/scalaz.md
+++ b/docs/generators/scalaz.md
@@ -9,7 +9,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|
|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|
+|dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (preferred for JDK 1.8+)
|java8|
|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.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true|
diff --git a/docs/generators/spring.md b/docs/generators/spring.md
index 5515eaae9bc..8f834fdf27d 100644
--- a/docs/generators/spring.md
+++ b/docs/generators/spring.md
@@ -45,6 +45,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model|
+|oas3|Use OAS 3 Swagger annotations instead of OAS 2 annotations| |false|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
@@ -69,6 +70,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useOptional|Use Optional container for optional parameters| |false|
+|useSpringController|Annotate the generated API as a Spring Controller| |false|
|useTags|use tags for creating interface and controller classnames| |false|
|virtualService|Generates the virtual service. For more details refer - https://github.com/virtualansoftware/virtualan/wiki| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
diff --git a/docs/generators/typescript-angular.md b/docs/generators/typescript-angular.md
index 126ccd5ae38..ab8b3da35fc 100644
--- a/docs/generators/typescript-angular.md
+++ b/docs/generators/typescript-angular.md
@@ -19,7 +19,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|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|
-|ngVersion|The version of Angular. (At least 6.0.0)| |12.0.0|
+|ngVersion|The version of Angular. (At least 6.0.0)| |12.2.12|
|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|
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ConfigHelp.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ConfigHelp.java
index 3a235af7f7c..8193e20e3f4 100644
--- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ConfigHelp.java
+++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ConfigHelp.java
@@ -86,7 +86,7 @@ public class ConfigHelp extends OpenApiGeneratorCommand {
"--markdown-header"}, title = "markdown header", description = "When format=markdown, include this option to write out markdown headers (e.g. for docusaurus).")
private Boolean markdownHeader;
- @Option(name = {"--full-details"}, title = "full generator details", description = "displays CLI options as well as other configs/mappings (implies --instantiation-types, --reserved-words, --language-specific-primitives, --import-mappings, --supporting-files)")
+ @Option(name = {"--full-details"}, title = "full generator details", description = "displays CLI options as well as other configs/mappings (implies --instantiation-types, --reserved-words, --language-specific-primitives, --import-mappings, --feature-set)")
private Boolean fullDetails;
private String newline = System.lineSeparator();
diff --git a/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java b/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java
index 496e078a15d..5b013006739 100644
--- a/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java
+++ b/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java
@@ -22,7 +22,9 @@ import org.apache.commons.lang3.ArrayUtils;
import org.mockito.MockSettings;
import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.Generator;
+import org.openapitools.codegen.SpecValidationException;
import org.openapitools.codegen.config.CodegenConfigurator;
+import org.testng.TestException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -430,4 +432,12 @@ public class GenerateTest {
verify(configurator).toContext();
verifyNoMoreInteractions(configurator);
}
+
+ /**
+ * This test ensures that when the
+ */
+ @Test(expectedExceptions = SpecValidationException.class)
+ public void testNPEWithInvalidSpecFile() {
+ setupAndRunTest("-i", "src/test/resources/npe-test.yaml", "-g", "java", "-o", "src/main/java", false, null);
+ }
}
diff --git a/modules/openapi-generator-cli/src/test/resources/npe-test-spec-file.yaml b/modules/openapi-generator-cli/src/test/resources/npe-test-spec-file.yaml
new file mode 100644
index 00000000000..3e2a60862c9
--- /dev/null
+++ b/modules/openapi-generator-cli/src/test/resources/npe-test-spec-file.yaml
@@ -0,0 +1,14 @@
+test:
+ get:
+ responses:
+ '200':
+ description: test
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ prop1:
+ type: array
+ prop2:
+ type: date
\ No newline at end of file
diff --git a/modules/openapi-generator-cli/src/test/resources/npe-test.yaml b/modules/openapi-generator-cli/src/test/resources/npe-test.yaml
new file mode 100644
index 00000000000..11fc1eff666
--- /dev/null
+++ b/modules/openapi-generator-cli/src/test/resources/npe-test.yaml
@@ -0,0 +1,8 @@
+openapi: 3.0.0
+info:
+ description: test
+ version: test
+ title: test
+paths:
+ /test:
+ $ref: 'npe-test-spec-file.yaml#/test'
\ No newline at end of file
diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties
index 4da9eca486b..0d00f845a96 100644
--- a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties
+++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties
@@ -1,3 +1,3 @@
# RELEASE_VERSION
-openApiGeneratorVersion=5.3.0-SNAPSHOT
+openApiGeneratorVersion=5.3.1-SNAPSHOT
# /RELEASE_VERSION
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfigLoader.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfigLoader.java
index 6c552a97b80..64cd2fe921e 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfigLoader.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfigLoader.java
@@ -45,7 +45,7 @@ public class CodegenConfigLoader {
try {
return (CodegenConfig) Class.forName(name).getDeclaredConstructor().newInstance();
} catch (Exception e) {
- throw new GeneratorNotFoundException("Can't load config class with name '".concat(name) + "'\nAvailable:\n" + availableConfigs.toString(), e);
+ throw new GeneratorNotFoundException("Can't load config class with name '".concat(name) + "'\nAvailable:\n" + availableConfigs, e);
}
}
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 0a44812ceac..39e7f784cc9 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
@@ -45,9 +45,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public List children;
// anyOf, oneOf, allOf
- public Set anyOf = new TreeSet();
- public Set oneOf = new TreeSet();
- public Set allOf = new TreeSet();
+ public Set anyOf = new TreeSet<>();
+ public Set oneOf = new TreeSet<>();
+ public Set allOf = new TreeSet<>();
// The schema name as written in the OpenAPI document.
public String name;
@@ -66,20 +66,20 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public boolean isAlias; // Is this effectively an alias of another simple type
public boolean isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, isDate, isDateTime, isShort, isUnboundedInteger, isBoolean;
private boolean additionalPropertiesIsAnyType;
- public List vars = new ArrayList(); // all properties (without parent's properties)
- public List allVars = new ArrayList(); // all properties (with parent's properties)
- public List requiredVars = new ArrayList(); // a list of required properties
- public List optionalVars = new ArrayList(); // a list of optional properties
- public List readOnlyVars = new ArrayList(); // a list of read-only properties
- public List readWriteVars = new ArrayList(); // a list of properties for read, write
- public List parentVars = new ArrayList();
+ public List vars = new ArrayList<>(); // all properties (without parent's properties)
+ public List allVars = new ArrayList<>(); // all properties (with parent's properties)
+ public List requiredVars = new ArrayList<>(); // a list of required properties
+ public List optionalVars = new ArrayList<>(); // a list of optional properties
+ public List readOnlyVars = new ArrayList<>(); // a list of read-only properties
+ public List readWriteVars = new ArrayList<>(); // a list of properties for read, write
+ public List parentVars = new ArrayList<>();
public Map allowableValues;
// Sorted sets of required parameters.
- public Set mandatory = new TreeSet(); // without parent's required properties
- public Set allMandatory = new TreeSet(); // with parent's required properties
+ public Set mandatory = new TreeSet<>(); // without parent's required properties
+ public Set allMandatory = new TreeSet<>(); // with parent's required properties
- public Set imports = new TreeSet();
+ public Set imports = new TreeSet<>();
public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasValidation;
/**
* Indicates the OAS schema specifies "nullable: true".
@@ -104,7 +104,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public boolean hasOnlyReadOnly = true; // true if all properties are read-only
public ExternalDocumentation externalDocumentation;
- public Map vendorExtensions = new HashMap();
+ public Map vendorExtensions = new HashMap<>();
private CodegenComposedSchemas composedSchemas;
private boolean hasMultipleTypes = false;
@@ -320,7 +320,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public void setDiscriminator(CodegenDiscriminator discriminator) {
this.discriminator = discriminator;
- if (discriminator instanceof CodegenDiscriminator && !discriminator.getMappedModels().isEmpty()) {
+ if (discriminator != null && !discriminator.getMappedModels().isEmpty()) {
this.hasDiscriminatorWithNonEmptyMapping = true;
}
}
@@ -1067,13 +1067,13 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
private List removeDuplicatedProperty(List vars) {
// clone the list first
- List newList = new ArrayList();
+ List newList = new ArrayList<>();
for (CodegenProperty cp : vars) {
newList.add(cp.clone());
}
- Set propertyNames = new TreeSet();
- Set duplicatedNames = new TreeSet();
+ Set propertyNames = new TreeSet<>();
+ Set duplicatedNames = new TreeSet<>();
ListIterator iterator = newList.listIterator();
while (iterator.hasNext()) {
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java
index 8d8e9cdc13e..ef348bbb266 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java
@@ -225,9 +225,17 @@ public class CodegenOperation {
/**
* Check if body param is allowed for the request method
*
- * @return true request method is PUT, PATCH or POST; false otherwise
+ * @return true request method is DELETE, PUT, PATCH or POST; false otherwise
*/
public boolean isBodyAllowed() {
+ return Arrays.asList("DELETE","PUT", "PATCH", "POST").contains(httpMethod.toUpperCase(Locale.ROOT));
+ }
+ /**
+ * Check if the request method is PUT or PATCH or POST
+ *
+ * @return true request method is PUT, PATCH or POST; false otherwise
+ */
+ public boolean isMethodPutOrPatchOrPost() {
return Arrays.asList("PUT", "PATCH", "POST").contains(httpMethod.toUpperCase(Locale.ROOT));
}
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 dc67303aa9b..6e669ab37cd 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
@@ -147,8 +147,8 @@ public class DefaultCodegen implements CodegenConfig {
protected Map typeMapping;
protected Map instantiationTypes;
protected Set reservedWords;
- protected Set languageSpecificPrimitives = new HashSet();
- protected Map importMapping = new HashMap();
+ protected Set languageSpecificPrimitives = new HashSet<>();
+ protected Map importMapping = new HashMap<>();
protected String modelPackage = "", apiPackage = "", fileSuffix;
protected String modelNamePrefix = "", modelNameSuffix = "";
protected String apiNamePrefix = "", apiNameSuffix = "Api";
@@ -159,25 +159,25 @@ public class DefaultCodegen implements CodegenConfig {
apiTemplateFiles are for API outputs only (controllers/handlers).
API templates may be written multiple times; APIs are grouped by tag and the file is written once per tag group.
*/
- protected Map apiTemplateFiles = new HashMap();
- protected Map modelTemplateFiles = new HashMap();
- protected Map apiTestTemplateFiles = new HashMap();
- protected Map modelTestTemplateFiles = new HashMap();
- protected Map apiDocTemplateFiles = new HashMap();
- protected Map modelDocTemplateFiles = new HashMap();
- protected Map reservedWordsMappings = new HashMap();
+ protected Map apiTemplateFiles = new HashMap<>();
+ protected Map modelTemplateFiles = new HashMap<>();
+ protected Map apiTestTemplateFiles = new HashMap<>();
+ protected Map modelTestTemplateFiles = new HashMap<>();
+ protected Map apiDocTemplateFiles = new HashMap<>();
+ protected Map modelDocTemplateFiles = new HashMap<>();
+ protected Map reservedWordsMappings = new HashMap<>();
protected String templateDir;
protected String embeddedTemplateDir;
protected Map additionalProperties = new HashMap<>();
- protected Map serverVariables = new HashMap();
- protected Map vendorExtensions = new HashMap();
+ protected Map serverVariables = new HashMap<>();
+ protected Map vendorExtensions = new HashMap<>();
/*
Supporting files are those which aren't models, APIs, or docs.
These get a different map of data bound to the templates. Supporting files are written once.
See also 'apiTemplateFiles'.
*/
- protected List supportingFiles = new ArrayList();
- protected List cliOptions = new ArrayList();
+ protected List supportingFiles = new ArrayList<>();
+ protected List cliOptions = new ArrayList<>();
protected boolean skipOverwrite;
protected boolean removeOperationIdPrefix;
protected String removeOperationIdPrefixDelimiter = "_";
@@ -210,7 +210,7 @@ public class DefaultCodegen implements CodegenConfig {
*/
protected boolean supportsAdditionalPropertiesWithComposedSchema;
protected boolean supportsMixins;
- protected Map supportedLibraries = new LinkedHashMap();
+ protected Map supportedLibraries = new LinkedHashMap<>();
protected String library;
protected Boolean sortParamsByRequiredFlag = true;
protected Boolean sortModelPropertiesByRequiredFlag = false;
@@ -222,7 +222,7 @@ public class DefaultCodegen implements CodegenConfig {
// How to encode special characters like $
// They are translated to words like "Dollar" and prefixed with '
// Then translated back during JSON encoding and decoding
- protected Map specialCharReplacements = new HashMap();
+ protected Map specialCharReplacements = new HashMap<>();
// When a model is an alias for a simple type
protected Map typeAliases = null;
protected Boolean prependFormOrBodyParameters = false;
@@ -236,7 +236,7 @@ public class DefaultCodegen implements CodegenConfig {
protected boolean useOneOfInterfaces = false;
// whether or not the oneOf imports machinery should add oneOf interfaces as imports in implementing classes
protected boolean addOneOfInterfaceImports = false;
- protected List addOneOfInterfaces = new ArrayList();
+ protected List addOneOfInterfaces = new ArrayList<>();
// flag to indicate whether to only update files whose contents have changed
protected boolean enableMinimalUpdate = false;
@@ -260,7 +260,7 @@ public class DefaultCodegen implements CodegenConfig {
private Map modelNameToSchemaCache;
// A cache to efficiently lookup schema `toModelName()` based on the schema Key
- private Map schemaKeyToModelNameCache = new HashMap<>();
+ private final Map schemaKeyToModelNameCache = new HashMap<>();
@Override
public List cliOptions() {
@@ -440,7 +440,7 @@ public class DefaultCodegen implements CodegenConfig {
// Gather data from all the models that contain oneOf into OneOfImplementorAdditionalData classes
// (see docstring of that class to find out what information is gathered and why)
- Map additionalDataMap = new HashMap();
+ Map additionalDataMap = new HashMap<>();
for (Map.Entry modelsEntry : objs.entrySet()) {
Map modelsAttrs = (Map) modelsEntry.getValue();
List