forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 5.4.x
This commit is contained in:
commit
78fe5dc427
4
.github/workflows/gradle-test.yaml
vendored
4
.github/workflows/gradle-test.yaml
vendored
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
10
bin/configs/csharp-netcore-complex-files.yaml
Normal file
10
bin/configs/csharp-netcore-complex-files.yaml
Normal file
@ -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"
|
@ -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"
|
||||
|
@ -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 |
|
||||
|
@ -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|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|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.|<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|
|
||||
|groupId|groupId in generated pom.xml| |org.openapitools|
|
||||
|
@ -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|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|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.|<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|
|
||||
|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|
|
||||
|
@ -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|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|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.|<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|
|
||||
|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|
|
||||
|
@ -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|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|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.|<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|
|
||||
|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|
|
||||
|
@ -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|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|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.|<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|
|
||||
|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|
|
||||
|
@ -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|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|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.|<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|
|
||||
|jodaTimeVersion|The version of joda-time library| |2.10.10|
|
||||
|
@ -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|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|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.|<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|
|
||||
|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|
|
||||
|
@ -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|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|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.|<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|
|
||||
|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|
|
||||
|
@ -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|
|
||||
|
@ -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|
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
test:
|
||||
get:
|
||||
responses:
|
||||
'200':
|
||||
description: test
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
prop1:
|
||||
type: array
|
||||
prop2:
|
||||
type: date
|
@ -0,0 +1,8 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
description: test
|
||||
version: test
|
||||
title: test
|
||||
paths:
|
||||
/test:
|
||||
$ref: 'npe-test-spec-file.yaml#/test'
|
@ -1,3 +1,3 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=5.3.0-SNAPSHOT
|
||||
openApiGeneratorVersion=5.3.1-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,9 +45,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
public List<CodegenModel> children;
|
||||
|
||||
// anyOf, oneOf, allOf
|
||||
public Set<String> anyOf = new TreeSet<String>();
|
||||
public Set<String> oneOf = new TreeSet<String>();
|
||||
public Set<String> allOf = new TreeSet<String>();
|
||||
public Set<String> anyOf = new TreeSet<>();
|
||||
public Set<String> oneOf = new TreeSet<>();
|
||||
public Set<String> 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<CodegenProperty> vars = new ArrayList<CodegenProperty>(); // all properties (without parent's properties)
|
||||
public List<CodegenProperty> allVars = new ArrayList<CodegenProperty>(); // all properties (with parent's properties)
|
||||
public List<CodegenProperty> requiredVars = new ArrayList<CodegenProperty>(); // a list of required properties
|
||||
public List<CodegenProperty> optionalVars = new ArrayList<CodegenProperty>(); // a list of optional properties
|
||||
public List<CodegenProperty> readOnlyVars = new ArrayList<CodegenProperty>(); // a list of read-only properties
|
||||
public List<CodegenProperty> readWriteVars = new ArrayList<CodegenProperty>(); // a list of properties for read, write
|
||||
public List<CodegenProperty> parentVars = new ArrayList<CodegenProperty>();
|
||||
public List<CodegenProperty> vars = new ArrayList<>(); // all properties (without parent's properties)
|
||||
public List<CodegenProperty> allVars = new ArrayList<>(); // all properties (with parent's properties)
|
||||
public List<CodegenProperty> requiredVars = new ArrayList<>(); // a list of required properties
|
||||
public List<CodegenProperty> optionalVars = new ArrayList<>(); // a list of optional properties
|
||||
public List<CodegenProperty> readOnlyVars = new ArrayList<>(); // a list of read-only properties
|
||||
public List<CodegenProperty> readWriteVars = new ArrayList<>(); // a list of properties for read, write
|
||||
public List<CodegenProperty> parentVars = new ArrayList<>();
|
||||
public Map<String, Object> allowableValues;
|
||||
|
||||
// Sorted sets of required parameters.
|
||||
public Set<String> mandatory = new TreeSet<String>(); // without parent's required properties
|
||||
public Set<String> allMandatory = new TreeSet<String>(); // with parent's required properties
|
||||
public Set<String> mandatory = new TreeSet<>(); // without parent's required properties
|
||||
public Set<String> allMandatory = new TreeSet<>(); // with parent's required properties
|
||||
|
||||
public Set<String> imports = new TreeSet<String>();
|
||||
public Set<String> 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<String, Object> vendorExtensions = new HashMap<String, Object>();
|
||||
public Map<String, Object> 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<CodegenProperty> removeDuplicatedProperty(List<CodegenProperty> vars) {
|
||||
// clone the list first
|
||||
List<CodegenProperty> newList = new ArrayList<CodegenProperty>();
|
||||
List<CodegenProperty> newList = new ArrayList<>();
|
||||
for (CodegenProperty cp : vars) {
|
||||
newList.add(cp.clone());
|
||||
}
|
||||
|
||||
Set<String> propertyNames = new TreeSet<String>();
|
||||
Set<String> duplicatedNames = new TreeSet<String>();
|
||||
Set<String> propertyNames = new TreeSet<>();
|
||||
Set<String> duplicatedNames = new TreeSet<>();
|
||||
|
||||
ListIterator<CodegenProperty> iterator = newList.listIterator();
|
||||
while (iterator.hasNext()) {
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -147,8 +147,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected Map<String, String> typeMapping;
|
||||
protected Map<String, String> instantiationTypes;
|
||||
protected Set<String> reservedWords;
|
||||
protected Set<String> languageSpecificPrimitives = new HashSet<String>();
|
||||
protected Map<String, String> importMapping = new HashMap<String, String>();
|
||||
protected Set<String> languageSpecificPrimitives = new HashSet<>();
|
||||
protected Map<String, String> 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<String, String> apiTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> modelTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> apiTestTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> modelTestTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> apiDocTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> modelDocTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> reservedWordsMappings = new HashMap<String, String>();
|
||||
protected Map<String, String> apiTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> modelTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> apiTestTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> modelTestTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> apiDocTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> modelDocTemplateFiles = new HashMap<>();
|
||||
protected Map<String, String> reservedWordsMappings = new HashMap<>();
|
||||
protected String templateDir;
|
||||
protected String embeddedTemplateDir;
|
||||
protected Map<String, Object> additionalProperties = new HashMap<>();
|
||||
protected Map<String, String> serverVariables = new HashMap<String, String>();
|
||||
protected Map<String, Object> vendorExtensions = new HashMap<String, Object>();
|
||||
protected Map<String, String> serverVariables = new HashMap<>();
|
||||
protected Map<String, Object> 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<SupportingFile> supportingFiles = new ArrayList<SupportingFile>();
|
||||
protected List<CliOption> cliOptions = new ArrayList<CliOption>();
|
||||
protected List<SupportingFile> supportingFiles = new ArrayList<>();
|
||||
protected List<CliOption> 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<String, String> supportedLibraries = new LinkedHashMap<String, String>();
|
||||
protected Map<String, String> 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<String, String> specialCharReplacements = new HashMap<String, String>();
|
||||
protected Map<String, String> specialCharReplacements = new HashMap<>();
|
||||
// When a model is an alias for a simple type
|
||||
protected Map<String, String> 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<CodegenModel> addOneOfInterfaces = new ArrayList<CodegenModel>();
|
||||
protected List<CodegenModel> 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<String, Schema> modelNameToSchemaCache;
|
||||
|
||||
// A cache to efficiently lookup schema `toModelName()` based on the schema Key
|
||||
private Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
|
||||
private final Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public List<CliOption> 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<String, OneOfImplementorAdditionalData> additionalDataMap = new HashMap<String, OneOfImplementorAdditionalData>();
|
||||
Map<String, OneOfImplementorAdditionalData> additionalDataMap = new HashMap<>();
|
||||
for (Map.Entry<String, Object> modelsEntry : objs.entrySet()) {
|
||||
Map<String, Object> modelsAttrs = (Map<String, Object>) modelsEntry.getValue();
|
||||
List<Object> models = (List<Object>) modelsAttrs.get("models");
|
||||
@ -503,7 +503,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @return map of all models indexed by names
|
||||
*/
|
||||
public Map<String, CodegenModel> getAllModels(Map<String, Object> objs) {
|
||||
Map<String, CodegenModel> allModels = new HashMap<String, CodegenModel>();
|
||||
Map<String, CodegenModel> allModels = new HashMap<>();
|
||||
for (Entry<String, Object> entry : objs.entrySet()) {
|
||||
String modelName = toModelName(entry.getKey());
|
||||
Map<String, Object> inner = (Map<String, Object>) entry.getValue();
|
||||
@ -823,9 +823,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
public void preprocessOpenAPI(OpenAPI openAPI) {
|
||||
if (useOneOfInterfaces) {
|
||||
// we process the openapi schema here to find oneOf schemas and create interface models for them
|
||||
Map<String, Schema> schemas = new HashMap<String, Schema>(openAPI.getComponents().getSchemas());
|
||||
Map<String, Schema> schemas = new HashMap<>(openAPI.getComponents().getSchemas());
|
||||
if (schemas == null) {
|
||||
schemas = new HashMap<String, Schema>();
|
||||
schemas = new HashMap<>();
|
||||
}
|
||||
Map<String, PathItem> pathItems = openAPI.getPaths();
|
||||
|
||||
@ -858,12 +858,12 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
// also add all properties of all schemas to be checked for oneOf
|
||||
Map<String, Schema> propertySchemas = new HashMap<String, Schema>();
|
||||
Map<String, Schema> propertySchemas = new HashMap<>();
|
||||
for (Map.Entry<String, Schema> e : schemas.entrySet()) {
|
||||
Schema s = e.getValue();
|
||||
Map<String, Schema> props = s.getProperties();
|
||||
if (props == null) {
|
||||
props = new HashMap<String, Schema>();
|
||||
props = new HashMap<>();
|
||||
}
|
||||
for (Map.Entry<String, Schema> p : props.entrySet()) {
|
||||
propertySchemas.put(e.getKey() + "/" + p.getKey(), p.getValue());
|
||||
@ -1431,7 +1431,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
public String toVarName(final String name) {
|
||||
if (reservedWords.contains(name)) {
|
||||
return escapeReservedWord(name);
|
||||
} else if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) {
|
||||
} else if (name.chars().anyMatch(character -> specialCharReplacements.containsKey(String.valueOf((char) character)))) {
|
||||
return escape(name, specialCharReplacements, null, null);
|
||||
}
|
||||
return name;
|
||||
@ -1449,7 +1449,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
name = removeNonNameElementToCamelCase(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
||||
if (reservedWords.contains(name)) {
|
||||
return escapeReservedWord(name);
|
||||
} else if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) {
|
||||
} else if (name.chars().anyMatch(character -> specialCharReplacements.containsKey(String.valueOf((char) character)))) {
|
||||
return escape(name, specialCharReplacements, null, null);
|
||||
}
|
||||
return name;
|
||||
@ -1547,7 +1547,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
.generationMessage(String.format(Locale.ROOT, "OpenAPI Generator: %s (%s)", getName(), codegenType.toValue()))
|
||||
.build();
|
||||
|
||||
defaultIncludes = new HashSet<String>(
|
||||
defaultIncludes = new HashSet<>(
|
||||
Arrays.asList("double",
|
||||
"int",
|
||||
"long",
|
||||
@ -1564,7 +1564,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
"Float")
|
||||
);
|
||||
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("array", "List");
|
||||
typeMapping.put("set", "Set");
|
||||
typeMapping.put("map", "Map");
|
||||
@ -1591,9 +1591,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("URI", "URI");
|
||||
typeMapping.put("AnyType", "oas_any_type_not_mapped");
|
||||
|
||||
instantiationTypes = new HashMap<String, String>();
|
||||
instantiationTypes = new HashMap<>();
|
||||
|
||||
reservedWords = new HashSet<String>();
|
||||
reservedWords = new HashSet<>();
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG,
|
||||
CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC).defaultValue(Boolean.TRUE.toString()));
|
||||
@ -1748,7 +1748,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (!param.getRequired()) {
|
||||
paramPart.append("]");
|
||||
}
|
||||
sb.append(paramPart.toString());
|
||||
sb.append(paramPart);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2382,14 +2382,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
Map<NamedSchema, CodegenProperty> schemaCodegenPropertyCache = new HashMap<NamedSchema, CodegenProperty>();
|
||||
Map<NamedSchema, CodegenProperty> schemaCodegenPropertyCache = new HashMap<>();
|
||||
|
||||
protected void updateModelForComposedSchema(CodegenModel m, Schema schema, Map<String, Schema> allDefinitions) {
|
||||
final ComposedSchema composed = (ComposedSchema) schema;
|
||||
Map<String, Schema> properties = new LinkedHashMap<String, Schema>();
|
||||
List<String> required = new ArrayList<String>();
|
||||
Map<String, Schema> allProperties = new LinkedHashMap<String, Schema>();
|
||||
List<String> allRequired = new ArrayList<String>();
|
||||
Map<String, Schema> properties = new LinkedHashMap<>();
|
||||
List<String> required = new ArrayList<>();
|
||||
Map<String, Schema> allProperties = new LinkedHashMap<>();
|
||||
List<String> allRequired = new ArrayList<>();
|
||||
|
||||
// if schema has properties outside of allOf/oneOf/anyOf also add them to m
|
||||
if (composed.getProperties() != null && !composed.getProperties().isEmpty()) {
|
||||
@ -2407,7 +2407,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// TODO revise the logic below to set discriminator, xml attributes
|
||||
if (supportsInheritance || supportsMixins) {
|
||||
m.allVars = new ArrayList<CodegenProperty>();
|
||||
m.allVars = new ArrayList<>();
|
||||
if (composed.getAllOf() != null) {
|
||||
int modelImplCnt = 0; // only one inline object allowed in a ComposedModel
|
||||
int modelDiscriminators = 0; // only one discriminator allowed in a ComposedModel
|
||||
@ -2443,7 +2443,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (!interfaces.isEmpty()) {
|
||||
// m.interfaces is for backward compatibility
|
||||
if (m.interfaces == null)
|
||||
m.interfaces = new ArrayList<String>();
|
||||
m.interfaces = new ArrayList<>();
|
||||
|
||||
for (Schema interfaceSchema : interfaces) {
|
||||
interfaceSchema = unaliasSchema(interfaceSchema, importMapping);
|
||||
@ -2521,7 +2521,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
m.parent = toModelName(parentName);
|
||||
|
||||
if (supportsMultipleInheritance) {
|
||||
m.allParents = new ArrayList<String>();
|
||||
m.allParents = new ArrayList<>();
|
||||
for (String pname : allParents) {
|
||||
String pModelName = toModelName(pname);
|
||||
m.allParents.add(pModelName);
|
||||
@ -2673,7 +2673,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// TODO remove the anyType check here in the future ANyType models can have enums defined
|
||||
m.isEnum = true;
|
||||
// comment out below as allowableValues is not set in post processing model enum
|
||||
m.allowableValues = new HashMap<String, Object>();
|
||||
m.allowableValues = new HashMap<>();
|
||||
m.allowableValues.put("values", schema.getEnum());
|
||||
}
|
||||
if (!ModelUtils.isArraySchema(schema)) {
|
||||
@ -2742,7 +2742,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// set isDiscriminator on the discriminator property
|
||||
if (m.discriminator != null) {
|
||||
String discPropName = m.discriminator.getPropertyBaseName();
|
||||
List<List<CodegenProperty>> listOLists = new ArrayList<List<CodegenProperty>>();
|
||||
List<List<CodegenProperty>> listOLists = new ArrayList<>();
|
||||
listOLists.add(m.requiredVars);
|
||||
listOLists.add(m.vars);
|
||||
listOLists.add(m.allVars);
|
||||
@ -3461,13 +3461,13 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
//Inline enum case:
|
||||
if (p.getEnum() != null && !p.getEnum().isEmpty()) {
|
||||
List<Object> _enum = p.getEnum();
|
||||
property._enum = new ArrayList<String>();
|
||||
property._enum = new ArrayList<>();
|
||||
for (Object i : _enum) {
|
||||
property._enum.add(String.valueOf(i));
|
||||
}
|
||||
property.isEnum = true;
|
||||
|
||||
Map<String, Object> allowableValues = new HashMap<String, Object>();
|
||||
Map<String, Object> allowableValues = new HashMap<>();
|
||||
allowableValues.put("values", _enum);
|
||||
if (allowableValues.size() > 0) {
|
||||
property.allowableValues = allowableValues;
|
||||
@ -3480,7 +3480,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (referencedSchema.getEnum() != null && !referencedSchema.getEnum().isEmpty()) {
|
||||
List<Object> _enum = referencedSchema.getEnum();
|
||||
|
||||
Map<String, Object> allowableValues = new HashMap<String, Object>();
|
||||
Map<String, Object> allowableValues = new HashMap<>();
|
||||
allowableValues.put("values", _enum);
|
||||
if (allowableValues.size() > 0) {
|
||||
property.allowableValues = allowableValues;
|
||||
@ -3783,7 +3783,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
Map<String, Schema> schemas,
|
||||
CodegenOperation op,
|
||||
ApiResponse methodResponse) {
|
||||
handleMethodResponse(operation, schemas, op, methodResponse, Collections.<String, String>emptyMap());
|
||||
handleMethodResponse(operation, schemas, op, methodResponse, Collections.emptyMap());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3888,7 +3888,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
Map<String, Schema> schemas = ModelUtils.getSchemas(this.openAPI);
|
||||
CodegenOperation op = CodegenModelFactory.newInstance(CodegenModelType.OPERATION);
|
||||
Set<String> imports = new HashSet<String>();
|
||||
Set<String> imports = new HashSet<>();
|
||||
if (operation.getExtensions() != null && !operation.getExtensions().isEmpty()) {
|
||||
op.vendorExtensions.putAll(operation.getExtensions());
|
||||
|
||||
@ -3986,15 +3986,15 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
List<Parameter> parameters = operation.getParameters();
|
||||
List<CodegenParameter> allParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> bodyParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> pathParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> queryParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> headerParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> cookieParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> formParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> requiredParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> optionalParams = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> allParams = new ArrayList<>();
|
||||
List<CodegenParameter> bodyParams = new ArrayList<>();
|
||||
List<CodegenParameter> pathParams = new ArrayList<>();
|
||||
List<CodegenParameter> queryParams = new ArrayList<>();
|
||||
List<CodegenParameter> headerParams = new ArrayList<>();
|
||||
List<CodegenParameter> cookieParams = new ArrayList<>();
|
||||
List<CodegenParameter> formParams = new ArrayList<>();
|
||||
List<CodegenParameter> requiredParams = new ArrayList<>();
|
||||
List<CodegenParameter> optionalParams = new ArrayList<>();
|
||||
|
||||
CodegenParameter bodyParam = null;
|
||||
RequestBody requestBody = operation.getRequestBody();
|
||||
@ -4039,7 +4039,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// add example
|
||||
if (schemas != null) {
|
||||
op.requestBodyExamples = new ExampleGenerator(schemas, this.openAPI).generate(null, new ArrayList<String>(getConsumesInfo(this.openAPI, operation)), bodyParam.baseType);
|
||||
op.requestBodyExamples = new ExampleGenerator(schemas, this.openAPI).generate(null, new ArrayList<>(getConsumesInfo(this.openAPI, operation)), bodyParam.baseType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4531,7 +4531,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return codegenParameter;
|
||||
}
|
||||
|
||||
parameterSchema = unaliasSchema(parameterSchema, Collections.<String, String>emptyMap());
|
||||
parameterSchema = unaliasSchema(parameterSchema, Collections.emptyMap());
|
||||
if (parameterSchema == null) {
|
||||
LOGGER.warn("warning! Schema not found for parameter \" {} \", using String", parameter.getName());
|
||||
parameterSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to missing type definition.");
|
||||
@ -4755,7 +4755,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<CodegenSecurity> codegenSecurities = new ArrayList<CodegenSecurity>(securitySchemeMap.size());
|
||||
List<CodegenSecurity> codegenSecurities = new ArrayList<>(securitySchemeMap.size());
|
||||
for (String key : securitySchemeMap.keySet()) {
|
||||
final SecurityScheme securityScheme = securitySchemeMap.get(key);
|
||||
if (SecurityScheme.Type.APIKEY.equals(securityScheme.getType())) {
|
||||
@ -4855,7 +4855,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
protected void setReservedWordsLowerCase(List<String> words) {
|
||||
reservedWords = new HashSet<String>();
|
||||
reservedWords = new HashSet<>();
|
||||
for (String word : words) {
|
||||
reservedWords.add(word.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
@ -4918,9 +4918,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return null;
|
||||
}
|
||||
|
||||
final List<Map<String, Object>> output = new ArrayList<Map<String, Object>>(examples.size());
|
||||
final List<Map<String, Object>> output = new ArrayList<>(examples.size());
|
||||
for (Map.Entry<String, Object> entry : examples.entrySet()) {
|
||||
final Map<String, Object> kv = new HashMap<String, Object>();
|
||||
final Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("contentType", entry.getKey());
|
||||
kv.put("example", entry.getValue());
|
||||
output.add(kv);
|
||||
@ -4976,7 +4976,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
co, Map<String, List<CodegenOperation>> operations) {
|
||||
List<CodegenOperation> opList = operations.get(tag);
|
||||
if (opList == null) {
|
||||
opList = new ArrayList<CodegenOperation>();
|
||||
opList = new ArrayList<>();
|
||||
operations.put(tag, opList);
|
||||
}
|
||||
// check for operationId uniqueness
|
||||
@ -5084,8 +5084,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
m.hasVars = true;
|
||||
m.hasEnums = false; // TODO need to fix as its false in both cases
|
||||
|
||||
Set<String> mandatory = required == null ? Collections.<String>emptySet()
|
||||
: new TreeSet<String>(required);
|
||||
Set<String> mandatory = required == null ? Collections.emptySet()
|
||||
: new TreeSet<>(required);
|
||||
|
||||
// update "vars" without parent's properties (all, required)
|
||||
addVars(m, m.vars, properties, mandatory);
|
||||
@ -5097,8 +5097,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
if (allProperties != null) {
|
||||
Set<String> allMandatory = allRequired == null ? Collections.<String>emptySet()
|
||||
: new TreeSet<String>(allRequired);
|
||||
Set<String> allMandatory = allRequired == null ? Collections.emptySet()
|
||||
: new TreeSet<>(allRequired);
|
||||
// update "vars" with parent's properties (all, required)
|
||||
addVars(m, m.allVars, allProperties, allMandatory);
|
||||
m.allMandatory = allMandatory;
|
||||
@ -5108,14 +5108,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
// loop through list to update property name with toVarName
|
||||
Set<String> renamedMandatory = new ConcurrentSkipListSet<String>();
|
||||
Set<String> renamedMandatory = new ConcurrentSkipListSet<>();
|
||||
Iterator<String> mandatoryIterator = m.mandatory.iterator();
|
||||
while (mandatoryIterator.hasNext()) {
|
||||
renamedMandatory.add(toVarName(mandatoryIterator.next()));
|
||||
}
|
||||
m.mandatory = renamedMandatory;
|
||||
|
||||
Set<String> renamedAllMandatory = new ConcurrentSkipListSet<String>();
|
||||
Set<String> renamedAllMandatory = new ConcurrentSkipListSet<>();
|
||||
Iterator<String> allMandatoryIterator = m.allMandatory.iterator();
|
||||
while (allMandatoryIterator.hasNext()) {
|
||||
renamedAllMandatory.add(toVarName(allMandatoryIterator.next()));
|
||||
@ -5568,7 +5568,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @return sanitized string
|
||||
*/
|
||||
public String sanitizeName(String name, String removeCharRegEx) {
|
||||
return sanitizeName(name, removeCharRegEx, new ArrayList<String>());
|
||||
return sanitizeName(name, removeCharRegEx, new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -5827,7 +5827,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
enumName = String.valueOf(value);
|
||||
} else {
|
||||
enumName = value.toString().substring(truncateIdx);
|
||||
if ("".equals(enumName)) {
|
||||
if (enumName.isEmpty()) {
|
||||
enumName = value.toString();
|
||||
}
|
||||
}
|
||||
@ -6057,7 +6057,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return null;
|
||||
}
|
||||
|
||||
Set<String> produces = new ConcurrentSkipListSet<String>();
|
||||
Set<String> produces = new ConcurrentSkipListSet<>();
|
||||
|
||||
for (ApiResponse r : operation.getResponses().values()) {
|
||||
ApiResponse response = ModelUtils.getReferencedApiResponse(openAPI, r);
|
||||
@ -6108,7 +6108,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
LOGGER.debug("debugging fromRequestBodyToFormParameters= {}", body);
|
||||
Schema schema = ModelUtils.getSchemaFromRequestBody(body);
|
||||
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
|
||||
List<String> allRequired = new ArrayList<String>();
|
||||
List<String> allRequired = new ArrayList<>();
|
||||
Map<String, Schema> properties = new LinkedHashMap<>();
|
||||
// this traverses a composed schema and extracts all properties in each schema into properties
|
||||
// TODO in the future have this return one codegenParameter of type object or composed which includes all definition
|
||||
@ -6289,7 +6289,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
codegenParameter.datatypeWithEnum = codegenProperty.datatypeWithEnum;
|
||||
codegenParameter.enumName = codegenProperty.enumName;
|
||||
}
|
||||
|
||||
|
||||
// import
|
||||
if (codegenProperty.complexType != null) {
|
||||
imports.add(codegenProperty.complexType);
|
||||
@ -6953,7 +6953,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
cm.name = type;
|
||||
cm.classname = type;
|
||||
cm.vendorExtensions.put("x-is-one-of-interface", true);
|
||||
cm.interfaceModels = new ArrayList<CodegenModel>();
|
||||
cm.interfaceModels = new ArrayList<>();
|
||||
|
||||
addOneOfInterfaces.add(cm);
|
||||
}
|
||||
@ -7171,7 +7171,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
List<CodegenProperty> xOf = new ArrayList<>();
|
||||
int i = 0;
|
||||
for (Schema xOfSchema: xOfCollection) {
|
||||
CodegenProperty cp = fromProperty(collectionName + "_" + String.valueOf(i), xOfSchema);
|
||||
CodegenProperty cp = fromProperty(collectionName + "_" + i, xOfSchema);
|
||||
xOf.add(cp);
|
||||
i += 1;
|
||||
}
|
||||
|
@ -268,7 +268,11 @@ public class DefaultGenerator implements Generator {
|
||||
URL url = URLPathUtils.getServerURL(openAPI, config.serverVariableOverrides());
|
||||
contextPath = removeTrailingSlash(config.escapeText(url.getPath())); // for backward compatibility
|
||||
basePathWithoutHost = contextPath;
|
||||
basePath = removeTrailingSlash(config.escapeText(URLPathUtils.getHost(openAPI, config.serverVariableOverrides())));
|
||||
if (URLPathUtils.isRelativeUrl(openAPI.getServers())) {
|
||||
basePath = removeTrailingSlash(basePathWithoutHost);
|
||||
} else {
|
||||
basePath = removeTrailingSlash(config.escapeText(URLPathUtils.getHost(openAPI, config.serverVariableOverrides())));
|
||||
}
|
||||
}
|
||||
|
||||
private void configureOpenAPIInfo() {
|
||||
|
@ -129,6 +129,6 @@ public class SpecValidationException extends RuntimeException {
|
||||
});
|
||||
|
||||
return super.getMessage() + " | " +
|
||||
"Error count: " + errorCount + ", Warning count: " + warningCount + sb.toString();
|
||||
"Error count: " + errorCount + ", Warning count: " + warningCount + sb;
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public class TemplateManager implements TemplatingExecutor, TemplateProcessor {
|
||||
* @param name The location of the template
|
||||
* @return The raw template contents
|
||||
*/
|
||||
@SuppressWarnings({"java:S112"})
|
||||
@SuppressWarnings("java:S112")
|
||||
// ignored rule java:S112 as RuntimeException is used to match previous exception type
|
||||
public String readTemplate(String name) {
|
||||
if (name == null || name.contains("..")) {
|
||||
|
@ -26,7 +26,7 @@ public class TemplatingEngineLoader {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
@SuppressWarnings({"java:S112"}) // ignore java:S112 as generic RuntimeException is acceptable here
|
||||
@SuppressWarnings("java:S112") // ignore java:S112 as generic RuntimeException is acceptable here
|
||||
public static TemplatingEngineAdapter byIdentifier(String id) {
|
||||
ServiceLoader<TemplatingEngineAdapter> loader = ServiceLoader.load(TemplatingEngineAdapter.class, TemplatingEngineLoader.class.getClassLoader());
|
||||
|
||||
@ -42,7 +42,7 @@ public class TemplatingEngineLoader {
|
||||
// Attempt to load skipping SPI
|
||||
return (TemplatingEngineAdapter) Class.forName(id).getDeclaredConstructor().newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(String.format(Locale.ROOT, "Couldn't load template engine adapter %s. Available options: %n%s", id, sb.toString()), e);
|
||||
throw new RuntimeException(String.format(Locale.ROOT, "Couldn't load template engine adapter %s. Available options: %n%s", id, sb), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -534,9 +534,17 @@ public class CodegenConfigurator {
|
||||
if (validationMessages.size() > 0) {
|
||||
Set<String> warnings = new HashSet<>();
|
||||
if (specification != null) {
|
||||
List<String> unusedModels = ModelUtils.getUnusedSchemas(specification);
|
||||
if (unusedModels != null) {
|
||||
unusedModels.forEach(name -> warnings.add("Unused model: " + name));
|
||||
|
||||
// Wrap the getUnusedSchemas() in try catch block so it catches the NPE
|
||||
// when the input spec file is not correct
|
||||
try{
|
||||
List<String> unusedModels = ModelUtils.getUnusedSchemas(specification);
|
||||
if (unusedModels != null) {
|
||||
unusedModels.forEach(name -> warnings.add("Unused model: " + name));
|
||||
}
|
||||
} catch (Exception e){
|
||||
System.err.println("[error] There is an error with OpenAPI specification parsed from the input spec file: " + inputSpec);
|
||||
System.err.println("[error] Please make sure the spec file has correct format and all required fields are populated with valid value.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ public class ExampleGenerator {
|
||||
}
|
||||
} else if (modelName != null && mediaType.startsWith(MIME_TYPE_XML)) {
|
||||
final Schema schema = this.examples.get(modelName);
|
||||
String example = new XmlExampleGenerator(this.examples).toXml(schema, 0, Collections.<String>emptySet());
|
||||
String example = new XmlExampleGenerator(this.examples).toXml(schema, 0, Collections.emptySet());
|
||||
if (example != null) {
|
||||
kv.put(EXAMPLE, example);
|
||||
output.add(kv);
|
||||
|
@ -44,7 +44,7 @@ public class XmlExampleGenerator {
|
||||
}
|
||||
|
||||
public String toXml(Schema schema) {
|
||||
return toXml(null, schema, 0, Collections.<String>emptySet());
|
||||
return toXml(null, schema, 0, Collections.emptySet());
|
||||
}
|
||||
|
||||
protected String toXml(Schema schema, int indent, Collection<String> path) {
|
||||
|
@ -41,7 +41,7 @@ public class RootedFileRule extends Rule {
|
||||
}
|
||||
|
||||
private String getExtensionPart(final String input, int stopIndex) {
|
||||
return input.substring(stopIndex > 0 ? stopIndex+1: input.length(), input.length());
|
||||
return input.substring(stopIndex > 0 ? stopIndex+1: input.length());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,7 +50,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
protected List<Map<String, Object>> orderedModels;
|
||||
protected final Map<String, List<String>> modelDepends;
|
||||
protected final Map<String, String> nullableTypeMapping;
|
||||
protected final HashMap<String, String> operationsScopes;
|
||||
protected final Map<String, String> operationsScopes;
|
||||
protected int scopeIndex = 0;
|
||||
|
||||
public AbstractAdaCodegen() {
|
||||
@ -155,7 +155,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
"xor")
|
||||
);
|
||||
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("date", "Swagger.Date");
|
||||
typeMapping.put("DateTime", "Swagger.Datetime");
|
||||
typeMapping.put("string", "Swagger.UString");
|
||||
@ -172,7 +172,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
typeMapping.put("binary", "Swagger.Binary");
|
||||
|
||||
// Mapping to convert an Ada required type to an optional type (nullable).
|
||||
nullableTypeMapping = new HashMap<String, String>();
|
||||
nullableTypeMapping = new HashMap<>();
|
||||
nullableTypeMapping.put("Swagger.Date", "Swagger.Nullable_Date");
|
||||
nullableTypeMapping.put("Swagger.Datetime", "Swagger.Nullable_Date");
|
||||
nullableTypeMapping.put("Swagger.UString", "Swagger.Nullable_UString");
|
||||
@ -181,10 +181,10 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
nullableTypeMapping.put("Boolean", "Swagger.Nullable_Boolean");
|
||||
nullableTypeMapping.put("Swagger.Object", "Swagger.Object");
|
||||
|
||||
modelDepends = new HashMap<String, List<String>>();
|
||||
orderedModels = new ArrayList<Map<String, Object>>();
|
||||
operationsScopes = new HashMap<String, String>();
|
||||
super.importMapping = new HashMap<String, String>();
|
||||
modelDepends = new HashMap<>();
|
||||
orderedModels = new ArrayList<>();
|
||||
operationsScopes = new HashMap<>();
|
||||
super.importMapping = new HashMap<>();
|
||||
|
||||
// CLI options
|
||||
addOption(CodegenConstants.PROJECT_NAME, "GNAT project name",
|
||||
@ -193,7 +193,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
modelNameSuffix = "Type";
|
||||
embeddedTemplateDir = templateDir = "Ada";
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList("integer", "boolean", "number", "long", "float",
|
||||
"double", "object", "string", "date", "DateTime", "binary"));
|
||||
}
|
||||
@ -651,7 +651,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
Object v = model.get("model");
|
||||
if (v instanceof CodegenModel) {
|
||||
CodegenModel m = (CodegenModel) v;
|
||||
List<String> d = new ArrayList<String>();
|
||||
List<String> d = new ArrayList<>();
|
||||
for (CodegenProperty p : m.vars) {
|
||||
boolean isModel = false;
|
||||
CodegenProperty item = p;
|
||||
@ -687,8 +687,8 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
// if I find a model that has no dependencies, or all of its dependencies are in revisedOrderedModels, consider it the independentModel
|
||||
// put the independentModel at the end of revisedOrderedModels, and remove it from orderedModels
|
||||
//
|
||||
List<Map<String, Object>> revisedOrderedModels = new ArrayList<Map<String, Object>>();
|
||||
List<String> collectedModelNames = new ArrayList<String>();
|
||||
List<Map<String, Object>> revisedOrderedModels = new ArrayList<>();
|
||||
List<String> collectedModelNames = new ArrayList<>();
|
||||
int sizeOrderedModels = orderedModels.size();
|
||||
for (int i = 0; i < sizeOrderedModels; i++) {
|
||||
Map<String, Object> independentModel = null;
|
||||
@ -760,7 +760,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
* @return the authMethods to be used by the operation with its required scopes.
|
||||
*/
|
||||
private List<CodegenSecurity> postProcessAuthMethod(List<CodegenSecurity> authMethods, Map<String, List<String>> scopes) {
|
||||
List<CodegenSecurity> result = (scopes == null) ? null : new ArrayList<CodegenSecurity>();
|
||||
List<CodegenSecurity> result = (scopes == null) ? null : new ArrayList<>();
|
||||
if (authMethods != null) {
|
||||
for (CodegenSecurity authMethod : authMethods) {
|
||||
if (authMethod.scopes != null) {
|
||||
@ -803,7 +803,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
opSecurity.isKeyInQuery = authMethod.isKeyInQuery;
|
||||
opSecurity.flow = authMethod.flow;
|
||||
opSecurity.tokenUrl = authMethod.tokenUrl;
|
||||
List<Map<String, Object>> opAuthScopes = new ArrayList<Map<String, Object>>();
|
||||
List<Map<String, Object>> opAuthScopes = new ArrayList<>();
|
||||
for (String opScopeName : opScopes) {
|
||||
for (Map<String, Object> scope : authMethod.scopes) {
|
||||
String name = (String) scope.get("scope");
|
||||
|
@ -81,9 +81,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
protected boolean supportNullable = Boolean.FALSE;
|
||||
|
||||
// nullable type
|
||||
protected Set<String> nullableType = new HashSet<String>();
|
||||
protected Set<String> nullableType = new HashSet<>();
|
||||
|
||||
protected Set<String> valueTypes = new HashSet<String>();
|
||||
protected Set<String> valueTypes = new HashSet<>();
|
||||
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(AbstractCSharpCodegen.class);
|
||||
|
||||
@ -104,14 +104,14 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
outputFolder = "generated-code" + File.separator + this.getName();
|
||||
embeddedTemplateDir = templateDir = this.getName();
|
||||
|
||||
collectionTypes = new HashSet<String>(
|
||||
collectionTypes = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"IList", "List",
|
||||
"ICollection", "Collection",
|
||||
"IEnumerable")
|
||||
);
|
||||
|
||||
mapTypes = new HashSet<String>(
|
||||
mapTypes = new HashSet<>(
|
||||
Arrays.asList("IDictionary")
|
||||
);
|
||||
|
||||
@ -141,7 +141,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
);
|
||||
|
||||
// TODO: Either include fully qualified names here or handle in DefaultCodegen via lastIndexOf(".") search
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"String",
|
||||
"string",
|
||||
@ -184,7 +184,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
|
||||
// Nullable types here assume C# 2 support is not part of base
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("string", "string");
|
||||
typeMapping.put("binary", "byte[]");
|
||||
typeMapping.put("ByteArray", "byte[]");
|
||||
@ -207,11 +207,11 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
typeMapping.put("AnyType", "Object");
|
||||
|
||||
// nullable type
|
||||
nullableType = new HashSet<String>(
|
||||
nullableType = new HashSet<>(
|
||||
Arrays.asList("decimal", "bool", "int", "float", "long", "double", "DateTime", "DateTimeOffset", "Guid")
|
||||
);
|
||||
// value Types
|
||||
valueTypes = new HashSet<String>(
|
||||
valueTypes = new HashSet<>(
|
||||
Arrays.asList("decimal", "bool", "int", "float", "long", "double")
|
||||
);
|
||||
}
|
||||
@ -463,9 +463,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
*
|
||||
* @param models processed models to be further processed for enum references
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@SuppressWarnings("unchecked")
|
||||
private void postProcessEnumRefs(final Map<String, Object> models) {
|
||||
Map<String, CodegenModel> enumRefs = new HashMap<String, CodegenModel>();
|
||||
Map<String, CodegenModel> enumRefs = new HashMap<>();
|
||||
for (Map.Entry<String, Object> entry : models.entrySet()) {
|
||||
CodegenModel model = ModelUtils.getModelByName(entry.getKey(), models);
|
||||
if (model.isEnum) {
|
||||
@ -1325,7 +1325,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// only process files with .cs extension
|
||||
if ("cs".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = csharpPostProcessFile + " " + file.toString();
|
||||
String command = csharpPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
|
@ -323,7 +323,7 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
||||
}
|
||||
// only process files with cpp extension
|
||||
if ("cpp".equals(FilenameUtils.getExtension(file.toString())) || "h".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = cppPostProcessFile + " " + file.toString();
|
||||
String command = cppPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
p.waitFor();
|
||||
|
@ -340,7 +340,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
|
||||
// replace all characters that have a mapping but ignore underscores
|
||||
// append an underscore to each replacement so that it can be camelized
|
||||
if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) {
|
||||
if (name.chars().anyMatch(character -> specialCharReplacements.containsKey(String.valueOf((char) character)))) {
|
||||
name = escape(name, specialCharReplacements, Collections.singletonList("_"), "_");
|
||||
}
|
||||
// remove the rest
|
||||
@ -752,7 +752,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
// process all files with dart extension
|
||||
if ("dart".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
// currently supported is "dartfmt -w" and "dart format"
|
||||
String command = dartPostProcessFile + " " + file.toString();
|
||||
String command = dartPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
|
@ -53,9 +53,9 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
||||
"redefine", "rename", "require", "rescue", "Result", "retry", "select", "separate", "then", "True",
|
||||
"TUPLE", "undefine", "until", "variant", "Void", "when", "xor"));
|
||||
|
||||
defaultIncludes = new HashSet<String>(Arrays.asList("map", "array"));
|
||||
defaultIncludes = new HashSet<>(Arrays.asList("map", "array"));
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList("BOOLEAN", "INTEGER_8", "INTEGER_16", "INTEGER_32", "INTEGER_64", "NATURAL_8",
|
||||
"NATURAL_16", "NATURAL_32", "NATURAL_64", "REAL_32", "REAL_64"));
|
||||
|
||||
@ -559,7 +559,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
|
||||
public Map<String, String> createMapping(String key, String value) {
|
||||
Map<String, String> customImport = new HashMap<String, String>();
|
||||
Map<String, String> customImport = new HashMap<>();
|
||||
customImport.put(key, value);
|
||||
|
||||
return customImport;
|
||||
@ -592,7 +592,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
||||
|
||||
public String toEiffelFeatureStyle(String operationId) {
|
||||
if (operationId.startsWith("get_")) {
|
||||
return operationId.substring(4, operationId.length());
|
||||
return operationId.substring(4);
|
||||
} else {
|
||||
return operationId;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
// true if nullable types will be supported (as option)
|
||||
protected boolean supportNullable = Boolean.TRUE;
|
||||
|
||||
protected Set<String> nullableType = new HashSet<String>();
|
||||
protected Set<String> nullableType = new HashSet<>();
|
||||
|
||||
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(AbstractFSharpCodegen.class);
|
||||
@ -89,9 +89,9 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
outputFolder = this.getName();
|
||||
embeddedTemplateDir = templateDir = this.getName();
|
||||
|
||||
collectionTypes = new HashSet<String>(Arrays.asList("list", "seq"));
|
||||
collectionTypes = new HashSet<>(Arrays.asList("list", "seq"));
|
||||
|
||||
mapTypes = new HashSet<String>(
|
||||
mapTypes = new HashSet<>(
|
||||
Arrays.asList("IDictionary")
|
||||
);
|
||||
|
||||
@ -114,7 +114,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
);
|
||||
|
||||
// TODO - these are based on C# generator, do we need to add any more?
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"String",
|
||||
"string",
|
||||
@ -156,7 +156,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
instantiationTypes.put("map", "IDictionary");
|
||||
|
||||
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("string", "string");
|
||||
typeMapping.put("binary", "byte[]");
|
||||
typeMapping.put("ByteArray", "byte[]");
|
||||
@ -177,7 +177,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
typeMapping.put("URI", "string");
|
||||
|
||||
// nullable type
|
||||
nullableType = new HashSet<String>(
|
||||
nullableType = new HashSet<>(
|
||||
Arrays.asList("decimal", "bool", "int", "float", "long", "double", "string", "Guid", "apiKey")
|
||||
);
|
||||
}
|
||||
@ -349,12 +349,12 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
* Output of CodeGen models must therefore be in dependency order (rather than alphabetical order, which seems to be the default).
|
||||
* This could probably be made more efficient if absolutely needed.
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, Object> postProcessDependencyOrders(final Map<String, Object> objs) {
|
||||
|
||||
Map<String, Set<String>> dependencies = new HashMap<String, Set<String>>();
|
||||
Map<String, Set<String>> dependencies = new HashMap<>();
|
||||
|
||||
List<String> classNames = new ArrayList<String>();
|
||||
List<String> classNames = new ArrayList<>();
|
||||
|
||||
for (String k : objs.keySet()) {
|
||||
CodegenModel model = ModelUtils.getModelByName(k, objs);
|
||||
@ -381,7 +381,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> sorted = new LinkedHashMap<String, Object>();
|
||||
Map<String, Object> sorted = new LinkedHashMap<>();
|
||||
for (int i = sortedKeys.length - 1; i >= 0; i--) {
|
||||
Object k = sortedKeys[i];
|
||||
sorted.put(k.toString(), objs.get(k));
|
||||
@ -400,9 +400,9 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
*
|
||||
* @param models processed models to be further processed for enum references
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@SuppressWarnings("unchecked")
|
||||
private void postProcessEnumRefs(final Map<String, Object> models) {
|
||||
Map<String, CodegenModel> enumRefs = new HashMap<String, CodegenModel>();
|
||||
Map<String, CodegenModel> enumRefs = new HashMap<>();
|
||||
for (Map.Entry<String, Object> entry : models.entrySet()) {
|
||||
CodegenModel model = ModelUtils.getModelByName(entry.getKey(), models);
|
||||
if (model.isEnum) {
|
||||
@ -455,10 +455,9 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
// Since we iterate enumVars for modelInnerEnum and enumClass templates, and CodegenModel is missing some of CodegenProperty's properties,
|
||||
// we can take advantage of Mustache's contextual lookup to add the same "properties" to the model's enumVars scope rather than CodegenProperty's scope.
|
||||
List<Map<String, String>> enumVars = (ArrayList<Map<String, String>>) model.allowableValues.get("enumVars");
|
||||
List<Map<String, Object>> newEnumVars = new ArrayList<Map<String, Object>>();
|
||||
List<Map<String, Object>> newEnumVars = new ArrayList<>();
|
||||
for (Map<String, String> enumVar : enumVars) {
|
||||
Map<String, Object> mixedVars = new HashMap<String, Object>();
|
||||
mixedVars.putAll(enumVar);
|
||||
Map<String, Object> mixedVars = new HashMap<>(enumVar);
|
||||
|
||||
mixedVars.put("isString", isString);
|
||||
mixedVars.put("isLong", isLong);
|
||||
@ -473,7 +472,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOGGER.warn("Expected to retrieve model %s by name, but no model was found. Check your -Dmodels inclusions.", openAPIName);
|
||||
LOGGER.warn("Expected to retrieve model {} by name, but no model was found. Check your -Dmodels inclusions.", openAPIName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1115,7 +1114,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// only process files with .fs extension
|
||||
if ("fs".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = fsharpPostProcessFile + " " + file.toString();
|
||||
String command = fsharpPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
|
@ -56,7 +56,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
supportsInheritance = true;
|
||||
hideGenerationTimestamp = Boolean.FALSE;
|
||||
|
||||
defaultIncludes = new HashSet<String>(
|
||||
defaultIncludes = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"map",
|
||||
"array")
|
||||
@ -77,7 +77,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
// Added "error" as it's used so frequently that it may as well be a keyword
|
||||
);
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"string",
|
||||
"bool",
|
||||
@ -133,14 +133,14 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
typeMapping.put("object", "map[string]interface{}");
|
||||
typeMapping.put("AnyType", "interface{}");
|
||||
|
||||
numberTypes = new HashSet<String>(
|
||||
numberTypes = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"uint", "uint8", "uint16", "uint32", "uint64",
|
||||
"int", "int8", "int16", "int32", "int64",
|
||||
"float32", "float64")
|
||||
);
|
||||
|
||||
importMapping = new HashMap<String, String>();
|
||||
importMapping = new HashMap<>();
|
||||
|
||||
cliOptions.clear();
|
||||
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "Go package name (convention: lowercase).")
|
||||
@ -252,7 +252,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
String[] parts = name.split("_");
|
||||
String suffix = parts[parts.length - 1];
|
||||
|
||||
Set<String> reservedSuffixes = new HashSet<String>(Arrays.asList(
|
||||
Set<String> reservedSuffixes = new HashSet<>(Arrays.asList(
|
||||
// Test
|
||||
"test",
|
||||
// $GOOS
|
||||
@ -699,7 +699,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
}
|
||||
|
||||
public Map<String, String> createMapping(String key, String value) {
|
||||
Map<String, String> customImport = new HashMap<String, String>();
|
||||
Map<String, String> customImport = new HashMap<>();
|
||||
customImport.put(key, value);
|
||||
|
||||
return customImport;
|
||||
@ -813,7 +813,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
}
|
||||
|
||||
// only process the following type (or we can simply rely on the file extension to check if it's a Go file)
|
||||
Set<String> supportedFileType = new HashSet<String>(
|
||||
Set<String> supportedFileType = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"supporting-mustache",
|
||||
"model-test",
|
||||
@ -828,7 +828,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
if ("go".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
// e.g. "gofmt -w yourcode.go"
|
||||
// e.g. "go fmt path/to/your/package"
|
||||
String command = goPostProcessFile + " " + file.toString();
|
||||
String command = goPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
|
@ -55,13 +55,13 @@ public abstract class AbstractGraphQLCodegen extends DefaultCodegen implements C
|
||||
)
|
||||
);
|
||||
|
||||
defaultIncludes = new HashSet<String>(
|
||||
defaultIncludes = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"map",
|
||||
"array")
|
||||
);
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"null",
|
||||
"ID",
|
||||
@ -344,7 +344,7 @@ public abstract class AbstractGraphQLCodegen extends DefaultCodegen implements C
|
||||
}
|
||||
|
||||
public Map<String, String> createMapping(String key, String value) {
|
||||
Map<String, String> customImport = new HashMap<String, String>();
|
||||
Map<String, String> customImport = new HashMap<>();
|
||||
customImport.put(key, value);
|
||||
|
||||
return customImport;
|
||||
|
@ -18,6 +18,7 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Sets;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.PathItem;
|
||||
@ -164,9 +165,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
"native", "super", "while", "null")
|
||||
);
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
Arrays.asList(
|
||||
"String",
|
||||
languageSpecificPrimitives = Sets.newHashSet("String",
|
||||
"boolean",
|
||||
"Boolean",
|
||||
"Double",
|
||||
@ -174,7 +173,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
"Long",
|
||||
"Float",
|
||||
"Object",
|
||||
"byte[]")
|
||||
"byte[]"
|
||||
);
|
||||
instantiationTypes.put("array", "ArrayList");
|
||||
instantiationTypes.put("set", "LinkedHashSet");
|
||||
@ -508,6 +507,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
// optional jackson mappings for BigDecimal support
|
||||
importMapping.put("ToStringSerializer", "com.fasterxml.jackson.databind.ser.std.ToStringSerializer");
|
||||
importMapping.put("JsonSerialize", "com.fasterxml.jackson.databind.annotation.JsonSerialize");
|
||||
importMapping.put("JsonDeserialize", "com.fasterxml.jackson.databind.annotation.JsonDeserialize");
|
||||
|
||||
// imports for pojos
|
||||
importMapping.put("ApiModelProperty", "io.swagger.annotations.ApiModelProperty");
|
||||
@ -713,7 +713,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
|
||||
// If name contains special chars -> replace them.
|
||||
if ((((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.keySet().contains("" + ((char) character))))) {
|
||||
if ((((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.containsKey(String.valueOf((char) character))))) {
|
||||
List<String> allowedCharacters = new ArrayList<>();
|
||||
allowedCharacters.add("_");
|
||||
allowedCharacters.add("$");
|
||||
@ -996,7 +996,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
*/
|
||||
@Override
|
||||
public void setParameterExampleValue(CodegenParameter codegenParameter, RequestBody requestBody) {
|
||||
Boolean isModel = (codegenParameter.isModel || (codegenParameter.isContainer && codegenParameter.getItems().isModel));
|
||||
boolean isModel = (codegenParameter.isModel || (codegenParameter.isContainer && codegenParameter.getItems().isModel));
|
||||
|
||||
Content content = requestBody.getContent();
|
||||
|
||||
@ -1228,6 +1228,8 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
model.imports.add("ArrayList");
|
||||
} else if ("set".equals(property.containerType)) {
|
||||
model.imports.add("LinkedHashSet");
|
||||
model.imports.add("JsonDeserialize");
|
||||
property.vendorExtensions.put("x-setter-extra-annotation", "@JsonDeserialize(as = LinkedHashSet.class)");
|
||||
} else if ("map".equals(property.containerType)) {
|
||||
model.imports.add("HashMap");
|
||||
}
|
||||
@ -1245,6 +1247,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
model.getVendorExtensions().put("x-jackson-optional-nullable-helpers", true);
|
||||
}
|
||||
}
|
||||
|
||||
if (property.isReadOnly) {
|
||||
model.getVendorExtensions().put("x-has-readonly-properties", true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1260,7 +1266,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
// if the import package happens to be found in the importMapping (key)
|
||||
// add the corresponding import package to the list
|
||||
if (importMapping.containsKey(_import)) {
|
||||
Map<String, String> newImportMap = new HashMap<String, String>();
|
||||
Map<String, String> newImportMap = new HashMap<>();
|
||||
newImportMap.put("import", importMapping.get(_import));
|
||||
listIterator.add(newImportMap);
|
||||
}
|
||||
@ -1285,7 +1291,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation op : operationList) {
|
||||
Collection<String> operationImports = new ConcurrentSkipListSet<String>();
|
||||
Collection<String> operationImports = new ConcurrentSkipListSet<>();
|
||||
for (CodegenParameter p : op.allParams) {
|
||||
if (importMapping.containsKey(p.dataType)) {
|
||||
operationImports.add(importMapping.get(p.dataType));
|
||||
@ -1314,7 +1320,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
if (hasBodyParameter(openAPI, operation) || hasFormParameter(openAPI, operation)) {
|
||||
String defaultContentType = hasFormParameter(openAPI, operation) ? "application/x-www-form-urlencoded" : "application/json";
|
||||
List<String> consumes = new ArrayList<>(getConsumesInfo(openAPI, operation));
|
||||
String contentType = consumes == null || consumes.isEmpty() ? defaultContentType : consumes.get(0);
|
||||
String contentType = consumes.isEmpty() ? defaultContentType : consumes.get(0);
|
||||
operation.addExtension("x-contentType", contentType);
|
||||
}
|
||||
String accepts = getAccept(openAPI, operation);
|
||||
@ -1865,7 +1871,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
|
||||
// only process files with java extension
|
||||
if ("java".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = javaPostProcessFile + " " + file.toString();
|
||||
String command = javaPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
p.waitFor();
|
||||
|
@ -66,7 +66,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
|
||||
updateOption(CodegenConstants.ARTIFACT_ID, this.getArtifactId());
|
||||
updateOption(CodegenConstants.API_PACKAGE, apiPackage);
|
||||
updateOption(CodegenConstants.MODEL_PACKAGE, modelPackage);
|
||||
updateOption(this.DATE_LIBRARY, this.getDateLibrary());
|
||||
updateOption(DATE_LIBRARY, this.getDateLibrary());
|
||||
|
||||
additionalProperties.put("title", title);
|
||||
// java inflector uses the jackson lib
|
||||
|
@ -78,7 +78,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
supportsInheritance = true;
|
||||
setSortModelPropertiesByRequiredFlag(true);
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(Arrays.asList(
|
||||
languageSpecificPrimitives = new HashSet<>(Arrays.asList(
|
||||
"kotlin.Byte",
|
||||
"kotlin.ByteArray",
|
||||
"kotlin.Short",
|
||||
@ -97,7 +97,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// this includes hard reserved words defined by https://github.com/JetBrains/kotlin/blob/master/core/descriptors/src/org/jetbrains/kotlin/renderer/KeywordStringsGenerated.java
|
||||
// as well as keywords from https://kotlinlang.org/docs/reference/keyword-reference.html
|
||||
reservedWords = new HashSet<String>(Arrays.asList(
|
||||
reservedWords = new HashSet<>(Arrays.asList(
|
||||
"abstract",
|
||||
"actual",
|
||||
"annotation",
|
||||
@ -171,7 +171,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
"while"
|
||||
));
|
||||
|
||||
defaultIncludes = new HashSet<String>(Arrays.asList(
|
||||
defaultIncludes = new HashSet<>(Arrays.asList(
|
||||
"kotlin.Byte",
|
||||
"kotlin.ByteArray",
|
||||
"kotlin.Short",
|
||||
@ -187,7 +187,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
"kotlin.collections.Map"
|
||||
));
|
||||
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("string", "kotlin.String");
|
||||
typeMapping.put("boolean", "kotlin.Boolean");
|
||||
typeMapping.put("integer", "kotlin.Int");
|
||||
@ -214,7 +214,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
instantiationTypes.put("list", "kotlin.collections.ArrayList");
|
||||
instantiationTypes.put("map", "kotlin.collections.HashMap");
|
||||
|
||||
importMapping = new HashMap<String, String>();
|
||||
importMapping = new HashMap<>();
|
||||
importMapping.put("BigDecimal", "java.math.BigDecimal");
|
||||
importMapping.put("UUID", "java.util.UUID");
|
||||
importMapping.put("URI", "java.net.URI");
|
||||
@ -896,7 +896,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
|
||||
// If name contains special chars -> replace them.
|
||||
if ((name.chars().anyMatch(character -> specialCharReplacements.keySet().contains("" + ((char) character))))) {
|
||||
if ((name.chars().anyMatch(character -> specialCharReplacements.keySet().contains(String.valueOf((char) character))))) {
|
||||
List<String> allowedCharacters = new ArrayList<>();
|
||||
allowedCharacters.add("_");
|
||||
allowedCharacters.add("$");
|
||||
@ -941,7 +941,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// only process files with kt extension
|
||||
if ("kt".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = kotlinPostProcessFile + " " + file.toString();
|
||||
String command = kotlinPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
p.waitFor();
|
||||
|
@ -79,7 +79,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
);
|
||||
|
||||
// ref: http://php.net/manual/en/language.types.intro.php
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"bool",
|
||||
"boolean",
|
||||
@ -107,7 +107,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
additionalProperties.put("primitives", primitives);
|
||||
|
||||
// ref: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("integer", "int");
|
||||
typeMapping.put("long", "int");
|
||||
typeMapping.put("number", "float");
|
||||
@ -769,7 +769,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
}
|
||||
// only process files with php extension
|
||||
if ("php".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = phpPostProcessFile + " " + file.toString();
|
||||
String command = phpPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
p.waitFor();
|
||||
|
@ -270,7 +270,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// only process files with py extension
|
||||
if ("py".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = pythonPostProcessFile + " " + file.toString();
|
||||
String command = pythonPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
|
@ -666,11 +666,11 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
|
||||
operation.isMultipart = Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
operation.vendorExtensions.put("x-prefered-consume", consume);
|
||||
operation.vendorExtensions.put("x-preferred-consume", consume);
|
||||
} else if (operation.consumes.size() > 1) {
|
||||
Map<String, String> consume = operation.consumes.get(0);
|
||||
skipTests.put("reason", "Connexion does not support multiple consumes. See https://github.com/zalando/connexion/pull/760");
|
||||
operation.vendorExtensions.put("x-prefered-consume", consume);
|
||||
operation.vendorExtensions.put("x-preferred-consume", consume);
|
||||
if ("multipart/form-data".equals(consume.get(MEDIA_TYPE))) {
|
||||
operation.isMultipart = Boolean.TRUE;
|
||||
}
|
||||
@ -680,14 +680,14 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
|
||||
if (operation.bodyParam != null) {
|
||||
Map<String, String> consume = new HashMap<>();
|
||||
consume.put(MEDIA_TYPE, "application/json");
|
||||
operation.vendorExtensions.put("x-prefered-consume", consume);
|
||||
operation.vendorExtensions.put("x-preferred-consume", consume);
|
||||
skipTests.put("reason", "*/* not supported by Connexion. Use application/json instead. See https://github.com/zalando/connexion/pull/760");
|
||||
}
|
||||
}
|
||||
// Choose to consume 'application/json' if available, else choose the last one.
|
||||
if (operation.produces != null) {
|
||||
for (Map<String, String> produce : operation.produces) {
|
||||
operation.vendorExtensions.put("x-prefered-produce", produce);
|
||||
operation.vendorExtensions.put("x-preferred-produce", produce);
|
||||
if (produce.get(MEDIA_TYPE).equals("application/json")) {
|
||||
break;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ abstract public class AbstractRubyCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
// only process files with rb extension
|
||||
if ("rb".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = rubyPostProcessFile + " " + file.toString();
|
||||
String command = rubyPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
@ -250,7 +250,7 @@ abstract public class AbstractRubyCodegen extends DefaultCodegen implements Code
|
||||
while ((line = br.readLine()) != null) {
|
||||
sb.append(line);
|
||||
}
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}, Error output: {}", command, exitValue, sb.toString());
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}, Error output: {}", command, exitValue, sb);
|
||||
}
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: `{}`", command);
|
||||
|
@ -46,7 +46,7 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
protected String dateLibrary = DateLibraries.java8.name();
|
||||
|
||||
protected enum DateLibraries {
|
||||
java8("Java 8 native JSR310 (prefered for JDK 1.8+)"),
|
||||
java8("Java 8 native JSR310 (preferred for JDK 1.8+)"),
|
||||
joda( "Joda (for legacy app)"),
|
||||
legacy( "Backport to http-client (deprecated)");
|
||||
|
||||
@ -529,7 +529,7 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
|
||||
// only process files with scala extension
|
||||
if ("scala".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = scalaPostProcessFile + " " + file.toString();
|
||||
String command = scalaPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
|
@ -181,7 +181,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
" Required to generate a full package"));
|
||||
this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package. If not provided, using the version from the OpenAPI specification file.").defaultValue(this.getNpmVersion()));
|
||||
this.cliOptions.add(CliOption.newBoolean(SNAPSHOT,
|
||||
"When setting this property to true, the version will be suffixed with -SNAPSHOT." + this.SNAPSHOT_SUFFIX_FORMAT.get().toPattern(),
|
||||
"When setting this property to true, the version will be suffixed with -SNAPSHOT." + SNAPSHOT_SUFFIX_FORMAT.get().toPattern(),
|
||||
false));
|
||||
this.cliOptions.add(new CliOption(NULL_SAFE_ADDITIONAL_PROPS, NULL_SAFE_ADDITIONAL_PROPS_DESC).defaultValue(String.valueOf(this.getNullSafeAdditionalProps())));
|
||||
}
|
||||
@ -896,7 +896,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
}
|
||||
// only process files with ts extension
|
||||
if ("ts".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = tsPostProcessFile + " " + file.toString();
|
||||
String command = tsPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
|
@ -117,7 +117,7 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
||||
"native", "super", "while", "null")
|
||||
);
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"String",
|
||||
"boolean",
|
||||
|
@ -49,7 +49,7 @@ public class ApexClientCodegen extends AbstractApexCodegen {
|
||||
private String namedCredential;
|
||||
private String srcPath = "force-app/main/default/";
|
||||
private String sfdxConfigPath = "config/";
|
||||
private HashMap<String, Object> primitiveDefaults = new HashMap<String, Object>();
|
||||
private HashMap<String, Object> primitiveDefaults = new HashMap<>();
|
||||
|
||||
public ApexClientCodegen() {
|
||||
super();
|
||||
@ -113,7 +113,7 @@ public class ApexClientCodegen extends AbstractApexCodegen {
|
||||
"virtual", "void", "webservice", "when", "where", "while"
|
||||
));
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList("Blob", "Boolean", "Date", "Datetime", "Decimal", "Double", "ID",
|
||||
"Integer", "Long", "Object", "String", "Time"
|
||||
));
|
||||
@ -233,7 +233,7 @@ public class ApexClientCodegen extends AbstractApexCodegen {
|
||||
out = String.valueOf(p.getDefault());
|
||||
} else if (ModelUtils.isLongSchema(p)) {
|
||||
Long def = (Long) p.getDefault();
|
||||
out = def == null ? out : def.toString() + "L";
|
||||
out = def == null ? out : def + "L";
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
Schema inner = getAdditionalProperties(p);
|
||||
String s = inner == null ? "Object" : getTypeDeclaration(inner);
|
||||
|
@ -89,10 +89,10 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
||||
|
||||
String includeStatement = "include::{" + attributePathReference + "}" + escapeCurlyBrackets(relativeFileName) + "[opts=optional]";
|
||||
if (Files.isRegularFile(filePathToInclude)) {
|
||||
LOGGER.debug("including {}. file into markup from: {}", ++includeCount, filePathToInclude.toString());
|
||||
LOGGER.debug("including {}. file into markup from: {}", ++includeCount, filePathToInclude);
|
||||
out.write("\n" + includeStatement + "\n");
|
||||
} else {
|
||||
LOGGER.debug("{}. file not found, skip include for: {}", ++notFoundCount, filePathToInclude.toString());
|
||||
LOGGER.debug("{}. file not found, skip include for: {}", ++notFoundCount, filePathToInclude);
|
||||
out.write("\n// markup not found, no " + includeStatement + "\n");
|
||||
}
|
||||
}
|
||||
@ -140,10 +140,10 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
||||
final Path filePathToLinkTo = Paths.get(basePath, relativeFileName).toAbsolutePath();
|
||||
|
||||
if (Files.isRegularFile(filePathToLinkTo)) {
|
||||
LOGGER.debug("linking {}. file into markup from: {}", ++linkedCount, filePathToLinkTo.toString());
|
||||
LOGGER.debug("linking {}. file into markup from: {}", ++linkedCount, filePathToLinkTo);
|
||||
out.write("\n" + linkName + " link:" + relativeFileName + "[]\n");
|
||||
} else {
|
||||
LOGGER.debug("{}. file not found, skip link for: {}", ++notFoundLinkCount, filePathToLinkTo.toString());
|
||||
LOGGER.debug("{}. file not found, skip link for: {}", ++notFoundLinkCount, filePathToLinkTo);
|
||||
out.write("\n// file not found, no " + linkName + " link :" + relativeFileName + "[]\n");
|
||||
}
|
||||
}
|
||||
@ -217,7 +217,7 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
||||
outputFolder = "generated-code" + File.separator + "asciidoc";
|
||||
embeddedTemplateDir = templateDir = "asciidoc-documentation";
|
||||
|
||||
defaultIncludes = new HashSet<String>();
|
||||
defaultIncludes = new HashSet<>();
|
||||
|
||||
cliOptions.add(new CliOption("appName", "short name of the application"));
|
||||
cliOptions.add(new CliOption("appDescription", "description of the application"));
|
||||
@ -264,10 +264,10 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion);
|
||||
|
||||
supportingFiles.add(new SupportingFile("index.mustache", "", "index.adoc"));
|
||||
reservedWords = new HashSet<String>();
|
||||
reservedWords = new HashSet<>();
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>();
|
||||
importMapping = new HashMap<String, String>();
|
||||
languageSpecificPrimitives = new HashSet<>();
|
||||
importMapping = new HashMap<>();
|
||||
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
String specDir = this.additionalProperties.get(SPEC_DIR) + "";
|
||||
String specDir = String.valueOf(this.additionalProperties.get(SPEC_DIR));
|
||||
if (!Files.isDirectory(Paths.get(specDir))) {
|
||||
LOGGER.warn("base part for include markup lambda not found: {} as {}", specDir, Paths.get(specDir).toAbsolutePath());
|
||||
}
|
||||
@ -333,7 +333,7 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
||||
this.includeSpecMarkupLambda = new IncludeMarkupLambda(SPEC_DIR,specDir);
|
||||
additionalProperties.put("specinclude", this.includeSpecMarkupLambda);
|
||||
|
||||
String snippetDir = this.additionalProperties.get(SNIPPET_DIR) + "";
|
||||
String snippetDir = String.valueOf(this.additionalProperties.get(SNIPPET_DIR));
|
||||
if (!Files.isDirectory(Paths.get(snippetDir))) {
|
||||
LOGGER.warn("base part for include markup lambda not found: {} as {}", snippetDir, Paths.get(snippetDir).toAbsolutePath());
|
||||
}
|
||||
|
@ -444,7 +444,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
}
|
||||
|
||||
// Converts, for example, PUT to HttpPut for controller attributes
|
||||
operation.httpMethod = "Http" + operation.httpMethod.substring(0, 1) + operation.httpMethod.substring(1).toLowerCase(Locale.ROOT);
|
||||
operation.httpMethod = "Http" + operation.httpMethod.charAt(0) + operation.httpMethod.substring(1).toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -472,7 +472,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(consumesString.toString().equals("")) {
|
||||
if(consumesString.toString().isEmpty()) {
|
||||
consumesString = new StringBuilder("\"" + consume.get("mediaType") + "\"");
|
||||
}
|
||||
else {
|
||||
@ -500,7 +500,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
if(!consumesString.toString().equals("")) {
|
||||
if(!consumesString.toString().isEmpty()) {
|
||||
operation.vendorExtensions.put("x-aspnetcore-consumes", consumesString.toString());
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
/**
|
||||
* Bash reserved words.
|
||||
*/
|
||||
reservedWords = new HashSet<String>(
|
||||
reservedWords = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"case",
|
||||
"do",
|
||||
|
@ -874,7 +874,7 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
|
||||
}
|
||||
|
||||
// only process the following type (or we can simply rely on the file extension to check if it's a .c or .h file)
|
||||
Set<String> supportedFileType = new HashSet<String>(
|
||||
Set<String> supportedFileType = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"supporting-mustache",
|
||||
"model-test",
|
||||
@ -888,7 +888,7 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
|
||||
// only process files with .c or .h extension
|
||||
if ("c".equals(FilenameUtils.getExtension(file.toString())) ||
|
||||
"h".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = cPostProcessFile + " " + file.toString();
|
||||
String command = cPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
|
@ -35,7 +35,7 @@ import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
@SuppressWarnings({"hiding"})
|
||||
@SuppressWarnings("hiding")
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(CSharpClientCodegen.class);
|
||||
private static final String NUNIT = "nunit";
|
||||
private static final String RESTSHARP = "restsharp";
|
||||
|
@ -56,7 +56,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
// Project Variable, determined from target framework. Not intended to be user-settable.
|
||||
protected static final String TARGET_FRAMEWORK_VERSION = "targetFrameworkVersion";
|
||||
|
||||
@SuppressWarnings({"hiding"})
|
||||
@SuppressWarnings("hiding")
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(CSharpClientCodegen.class);
|
||||
private static final List<FrameworkStrategy> frameworkStrategies = Arrays.asList(
|
||||
FrameworkStrategy.NETSTANDARD_1_3,
|
||||
|
@ -55,7 +55,7 @@ public class ConfluenceWikiCodegen extends DefaultCodegen implements CodegenConf
|
||||
outputFolder = "docs";
|
||||
embeddedTemplateDir = templateDir = "confluenceWikiDocs";
|
||||
|
||||
defaultIncludes = new HashSet<String>();
|
||||
defaultIncludes = new HashSet<>();
|
||||
|
||||
cliOptions.add(new CliOption("appName", "short name of the application"));
|
||||
cliOptions.add(new CliOption("appDescription", "description of the application"));
|
||||
@ -80,10 +80,10 @@ public class ConfluenceWikiCodegen extends DefaultCodegen implements CodegenConf
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion);
|
||||
|
||||
supportingFiles.add(new SupportingFile("index.mustache", "", "confluence-markup.txt"));
|
||||
reservedWords = new HashSet<String>();
|
||||
reservedWords = new HashSet<>();
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>();
|
||||
importMapping = new HashMap<String, String>();
|
||||
languageSpecificPrimitives = new HashSet<>();
|
||||
importMapping = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,10 +116,10 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
|
||||
supportingFiles.add(new SupportingFile("cmake.mustache", "", "CMakeLists.txt"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList("int", "char", "bool", "long", "float", "double", "int32_t", "int64_t"));
|
||||
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("date", "std::string");
|
||||
typeMapping.put("DateTime", "std::string");
|
||||
typeMapping.put("string", "std::string");
|
||||
@ -137,7 +137,7 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
|
||||
typeMapping.put("URI", "std::string");
|
||||
typeMapping.put("ByteArray", "std::string");
|
||||
|
||||
super.importMapping = new HashMap<String, String>();
|
||||
super.importMapping = new HashMap<>();
|
||||
importMapping.put("std::vector", "#include <vector>");
|
||||
importMapping.put("std::map", "#include <map>");
|
||||
importMapping.put("std::string", "#include <string>");
|
||||
@ -290,14 +290,14 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
|
||||
|
||||
//TODO: This changes the info about the real type but it is needed to parse the header params
|
||||
if (param.isHeaderParam) {
|
||||
param.dataType = "Pistache::Optional<Pistache::Http::Header::Raw>";
|
||||
param.baseType = "Pistache::Optional<Pistache::Http::Header::Raw>";
|
||||
param.dataType = "std::optional<Pistache::Http::Header::Raw>";
|
||||
param.baseType = "std::optional<Pistache::Http::Header::Raw>";
|
||||
} else if (param.isQueryParam) {
|
||||
if (param.isPrimitiveType) {
|
||||
param.dataType = "Pistache::Optional<" + param.dataType + ">";
|
||||
param.dataType = "std::optional<" + param.dataType + ">";
|
||||
} else {
|
||||
param.dataType = "Pistache::Optional<" + param.dataType + ">";
|
||||
param.baseType = "Pistache::Optional<" + param.baseType + ">";
|
||||
param.dataType = "std::optional<" + param.dataType + ">";
|
||||
param.baseType = "std::optional<" + param.baseType + ">";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,13 +22,13 @@ public abstract class CppQtAbstractCodegen extends AbstractCppCodegen implements
|
||||
protected static final String CPP_NAMESPACE_DESC = "C++ namespace (convention: name::space::for::api).";
|
||||
protected static final String CONTENT_COMPRESSION_ENABLED = "contentCompression";
|
||||
protected static final String CONTENT_COMPRESSION_ENABLED_DESC = "Enable Compressed Content Encoding for requests and responses";
|
||||
protected Set<String> foundationClasses = new HashSet<String>();
|
||||
protected Set<String> foundationClasses = new HashSet<>();
|
||||
protected String cppNamespace = "OpenAPI";
|
||||
protected Map<String, String> namespaces = new HashMap<String, String>();
|
||||
protected Set<String> systemIncludes = new HashSet<String>();
|
||||
protected Map<String, String> namespaces = new HashMap<>();
|
||||
protected Set<String> systemIncludes = new HashSet<>();
|
||||
protected boolean isContentCompressionEnabled = false;
|
||||
|
||||
protected Set<String> nonFrameworkPrimitives = new HashSet<String>();
|
||||
protected Set<String> nonFrameworkPrimitives = new HashSet<>();
|
||||
|
||||
public CppQtAbstractCodegen() {
|
||||
super();
|
||||
@ -75,7 +75,7 @@ public abstract class CppQtAbstractCodegen extends AbstractCppCodegen implements
|
||||
* Language Specific Primitives. These types will not trigger imports by
|
||||
* the client generator
|
||||
*/
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"bool",
|
||||
"qint32",
|
||||
@ -93,7 +93,7 @@ public abstract class CppQtAbstractCodegen extends AbstractCppCodegen implements
|
||||
"QByteArray")
|
||||
);
|
||||
languageSpecificPrimitives.addAll(foundationClasses);
|
||||
super.typeMapping = new HashMap<String, String>();
|
||||
super.typeMapping = new HashMap<>();
|
||||
|
||||
typeMapping.put("date", "QDate");
|
||||
typeMapping.put("DateTime", "QDateTime");
|
||||
@ -116,8 +116,8 @@ public abstract class CppQtAbstractCodegen extends AbstractCppCodegen implements
|
||||
typeMapping.put("URI", "QString");
|
||||
typeMapping.put("file", "QByteArray");
|
||||
typeMapping.put("binary", "QByteArray");
|
||||
importMapping = new HashMap<String, String>();
|
||||
namespaces = new HashMap<String, String>();
|
||||
importMapping = new HashMap<>();
|
||||
namespaces = new HashMap<>();
|
||||
|
||||
systemIncludes.add("QString");
|
||||
systemIncludes.add("QList");
|
||||
@ -315,7 +315,7 @@ public abstract class CppQtAbstractCodegen extends AbstractCppCodegen implements
|
||||
List<CodegenOperation> operations = (List<CodegenOperation>) objectMap.get("operation");
|
||||
|
||||
List<Map<String, String>> imports = (List<Map<String, String>>) objs.get("imports");
|
||||
Map<String, CodegenModel> codegenModels = new HashMap<String, CodegenModel>();
|
||||
Map<String, CodegenModel> codegenModels = new HashMap<>();
|
||||
|
||||
for (Object moObj : allModels) {
|
||||
CodegenModel mo = ((Map<String, CodegenModel>) moObj).get("model");
|
||||
@ -336,7 +336,7 @@ public abstract class CppQtAbstractCodegen extends AbstractCppCodegen implements
|
||||
imports.add(createMapping("import", operation.returnBaseType));
|
||||
}
|
||||
}
|
||||
List<CodegenParameter> params = new ArrayList<CodegenParameter>();
|
||||
List<CodegenParameter> params = new ArrayList<>();
|
||||
if (operation.allParams != null) params.addAll(operation.allParams);
|
||||
|
||||
// Check all parameter baseType if there is a necessity to include, include it if not
|
||||
@ -375,7 +375,7 @@ public abstract class CppQtAbstractCodegen extends AbstractCppCodegen implements
|
||||
}
|
||||
|
||||
private Map<String, String> createMapping(String key, String value) {
|
||||
Map<String, String> customImport = new HashMap<String, String>();
|
||||
Map<String, String> customImport = new HashMap<>();
|
||||
customImport.put(key, toModelImport(value));
|
||||
return customImport;
|
||||
}
|
||||
|
@ -46,6 +46,10 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
|
||||
.includeSecurityFeatures(SecurityFeature.BasicAuth)
|
||||
.includeSecurityFeatures(SecurityFeature.ApiKey)
|
||||
.includeSecurityFeatures(SecurityFeature.BearerToken)
|
||||
.includeSecurityFeatures(SecurityFeature.OAuth2_AuthorizationCode)
|
||||
.includeSecurityFeatures(SecurityFeature.OAuth2_Implicit)
|
||||
.includeSecurityFeatures(SecurityFeature.OAuth2_ClientCredentials)
|
||||
.includeSecurityFeatures(SecurityFeature.OAuth2_Password)
|
||||
.includeGlobalFeatures(GlobalFeature.ParameterStyling)
|
||||
);
|
||||
|
||||
@ -96,6 +100,8 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
|
||||
supportingFiles.add(new SupportingFile("enum.mustache", sourceFolder, PREFIX + "Enum.h"));
|
||||
supportingFiles.add(new SupportingFile("ServerConfiguration.mustache", sourceFolder, PREFIX + "ServerConfiguration.h"));
|
||||
supportingFiles.add(new SupportingFile("ServerVariable.mustache", sourceFolder, PREFIX + "ServerVariable.h"));
|
||||
supportingFiles.add(new SupportingFile("oauth.cpp.mustache", sourceFolder, PREFIX + "Oauth.cpp"));
|
||||
supportingFiles.add(new SupportingFile("oauth.h.mustache", sourceFolder, PREFIX + "Oauth.h"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("CMakeLists.txt.mustache", sourceFolder, "CMakeLists.txt"));
|
||||
if (optionalProjectFileFlag) {
|
||||
@ -127,6 +133,8 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
|
||||
supportingFiles.add(new SupportingFile("enum.mustache", sourceFolder, modelNamePrefix + "Enum.h"));
|
||||
supportingFiles.add(new SupportingFile("ServerConfiguration.mustache", sourceFolder, modelNamePrefix + "ServerConfiguration.h"));
|
||||
supportingFiles.add(new SupportingFile("ServerVariable.mustache", sourceFolder, modelNamePrefix + "ServerVariable.h"));
|
||||
supportingFiles.add(new SupportingFile("oauth.cpp.mustache", sourceFolder, modelNamePrefix + "Oauth.cpp"));
|
||||
supportingFiles.add(new SupportingFile("oauth.h.mustache", sourceFolder, modelNamePrefix + "Oauth.h"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("CMakeLists.txt.mustache", sourceFolder, "CMakeLists.txt"));
|
||||
|
||||
|
@ -166,10 +166,10 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
|
||||
supportingFiles.add(new SupportingFile("cmake-config.mustache", "", "Config.cmake.in"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList("int", "char", "bool", "long", "float", "double", "int32_t", "int64_t"));
|
||||
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("date", "utility::datetime");
|
||||
typeMapping.put("DateTime", "utility::datetime");
|
||||
typeMapping.put("string", "utility::string_t");
|
||||
@ -186,7 +186,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
|
||||
typeMapping.put("URI", "utility::string_t");
|
||||
typeMapping.put("ByteArray", "utility::string_t");
|
||||
|
||||
super.importMapping = new HashMap<String, String>();
|
||||
super.importMapping = new HashMap<>();
|
||||
importMapping.put("std::vector", "#include <vector>");
|
||||
importMapping.put("std::map", "#include <map>");
|
||||
importMapping.put("std::string", "#include <string>");
|
||||
@ -263,7 +263,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
|
||||
CodegenModel codegenModel = super.fromModel(name, model);
|
||||
|
||||
Set<String> oldImports = codegenModel.imports;
|
||||
codegenModel.imports = new HashSet<String>();
|
||||
codegenModel.imports = new HashSet<>();
|
||||
for (String imp : oldImports) {
|
||||
String newImp = toModelImport(imp);
|
||||
if (!newImp.isEmpty()) {
|
||||
|
@ -93,10 +93,10 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList("int", "char", "bool", "long", "float", "double", "int32_t", "int64_t"));
|
||||
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("date", "std::string");
|
||||
typeMapping.put("DateTime", "std::string");
|
||||
typeMapping.put("string", "std::string");
|
||||
@ -113,7 +113,7 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
|
||||
typeMapping.put("URI", "std::string");
|
||||
typeMapping.put("ByteArray", "std::string");
|
||||
|
||||
super.importMapping = new HashMap<String, String>();
|
||||
super.importMapping = new HashMap<>();
|
||||
importMapping.put("std::vector", "#include <vector>");
|
||||
importMapping.put("std::map", "#include <map>");
|
||||
importMapping.put("std::string", "#include <string>");
|
||||
@ -129,7 +129,7 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
|
||||
// Clean interfaces of ambiguity
|
||||
for (Entry<String, CodegenModel> cm : allModels.entrySet()) {
|
||||
if (cm.getValue().getInterfaces() != null && !cm.getValue().getInterfaces().isEmpty()) {
|
||||
List<String> newIntf = new ArrayList<String>(cm.getValue().getInterfaces());
|
||||
List<String> newIntf = new ArrayList<>(cm.getValue().getInterfaces());
|
||||
|
||||
for (String intf : allModels.get(cm.getKey()).getInterfaces()) {
|
||||
if (allModels.get(intf).getInterfaces() != null && !allModels.get(intf).getInterfaces().isEmpty()) {
|
||||
@ -256,7 +256,7 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
|
||||
CodegenModel codegenModel = super.fromModel(name, model);
|
||||
|
||||
Set<String> oldImports = codegenModel.imports;
|
||||
codegenModel.imports = new HashSet<String>();
|
||||
codegenModel.imports = new HashSet<>();
|
||||
for (String imp : oldImports) {
|
||||
String newImp = toModelImport(imp);
|
||||
if (!newImp.isEmpty()) {
|
||||
@ -285,7 +285,7 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
|
||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
List<CodegenOperation> newOpList = new ArrayList<CodegenOperation>();
|
||||
List<CodegenOperation> newOpList = new ArrayList<>();
|
||||
|
||||
for (CodegenOperation op : operationList) {
|
||||
String path = op.path;
|
||||
@ -318,7 +318,7 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
|
||||
final String X_CODEGEN_OTHER_METHODS = "x-codegen-other-methods";
|
||||
List<CodegenOperation> currentOtherMethodList = (List<CodegenOperation>) op1.vendorExtensions.get(X_CODEGEN_OTHER_METHODS);
|
||||
if (currentOtherMethodList == null) {
|
||||
currentOtherMethodList = new ArrayList<CodegenOperation>();
|
||||
currentOtherMethodList = new ArrayList<>();
|
||||
}
|
||||
op.operationIdCamelCase = op1.operationIdCamelCase;
|
||||
currentOtherMethodList.add(op);
|
||||
|
@ -71,7 +71,7 @@ public class CppTinyClientCodegen extends AbstractCppCodegen implements CodegenC
|
||||
}
|
||||
|
||||
public void addControllerToAdditionalProperties() {
|
||||
Map<String, String> supportedControllers = new HashMap<String, String>();
|
||||
Map<String, String> supportedControllers = new HashMap<>();
|
||||
supportedControllers.put("esp32", "isESP32");
|
||||
supportedControllers.put("esp8266", "isESP8266");
|
||||
if (supportedControllers.containsKey(controller)) {
|
||||
@ -152,20 +152,19 @@ public class CppTinyClientCodegen extends AbstractCppCodegen implements CodegenC
|
||||
|
||||
// SERVICES: Helpers
|
||||
supportingFiles.add(new SupportingFile("service/Response.h.mustache", serviceFolder, "Response.h"));
|
||||
supportingFiles.add(new SupportingFile("service/AbstractService.h.mustache", serviceFolder, "AbstractService.h"));
|
||||
supportingFiles.add(new SupportingFile("service/AbstractService.cpp.mustache", serviceFolder, "AbstractService.cpp"));
|
||||
supportingFiles.add(new SupportingFile("service/Service.h.mustache", serviceFolder, "Service.h"));
|
||||
supportingFiles.add(new SupportingFile("service/Service.cpp.mustache", serviceFolder, "Service.cpp"));
|
||||
|
||||
// Main
|
||||
supportingFiles.add(new SupportingFile("main.mustache", CppTinyClientCodegen.sourceFolder, "main.cpp"));
|
||||
supportingFiles.add(new SupportingFile("main.mustache", CppTinyClientCodegen.sourceFolder, "main.cpp")); // TODO no overwrite
|
||||
|
||||
// Config files
|
||||
supportingFiles.add(new SupportingFile("README.mustache", rootFolder, "README.md"));
|
||||
supportingFiles.add(new SupportingFile("platformio.ini.mustache", rootFolder, "platformio.ini"));
|
||||
supportingFiles.add(new SupportingFile("root.cert.mustache", rootFolder, "root.cert"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", rootFolder, "README.md"));
|
||||
supportingFiles.add(new SupportingFile("platformio.ini.mustache", rootFolder, "platformio.ini")); // TODO no overwrite
|
||||
supportingFiles.add(new SupportingFile("root.cert.mustache", rootFolder, "root.cert")); // TODO no overwrite
|
||||
supportingFiles.add(new SupportingFile("pre_compiling_bourne.py.mustache", rootFolder, "pre_compiling_bourne.py"));
|
||||
|
||||
defaultIncludes = new HashSet<String>(
|
||||
defaultIncludes = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"bool",
|
||||
"int",
|
||||
@ -173,7 +172,7 @@ public class CppTinyClientCodegen extends AbstractCppCodegen implements CodegenC
|
||||
"double",
|
||||
"float")
|
||||
);
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"bool",
|
||||
"int",
|
||||
@ -183,7 +182,7 @@ public class CppTinyClientCodegen extends AbstractCppCodegen implements CodegenC
|
||||
"std::string")
|
||||
);
|
||||
|
||||
super.typeMapping = new HashMap<String, String>();
|
||||
super.typeMapping = new HashMap<>();
|
||||
typeMapping.put("string", "std::string");
|
||||
typeMapping.put("integer", "int");
|
||||
typeMapping.put("boolean", "bool");
|
||||
@ -232,7 +231,6 @@ public class CppTinyClientCodegen extends AbstractCppCodegen implements CodegenC
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
// Throw exception if http and esp8266
|
||||
|
||||
// -- --additional-properties=controller=<controllername>
|
||||
if (additionalProperties.containsKey(MICROCONTROLLER)) {
|
||||
@ -259,7 +257,7 @@ public class CppTinyClientCodegen extends AbstractCppCodegen implements CodegenC
|
||||
if (languageSpecificPrimitives.contains(openAPIType)) {
|
||||
return toModelName(openAPIType);
|
||||
} else {
|
||||
return openAPIType + "";
|
||||
return openAPIType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -316,7 +314,7 @@ public class CppTinyClientCodegen extends AbstractCppCodegen implements CodegenC
|
||||
if (isReservedWord(paramName)) {
|
||||
return escapeReservedWord(paramName);
|
||||
}
|
||||
return "" + paramName;
|
||||
return paramName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,7 +71,7 @@ public class CppTizenClientCodegen extends AbstractCppCodegen implements Codegen
|
||||
embeddedTemplateDir = templateDir = "cpp-tizen-client";
|
||||
modelPackage = "";
|
||||
|
||||
defaultIncludes = new HashSet<String>(
|
||||
defaultIncludes = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"bool",
|
||||
"int",
|
||||
@ -79,7 +79,7 @@ public class CppTizenClientCodegen extends AbstractCppCodegen implements Codegen
|
||||
"double",
|
||||
"float")
|
||||
);
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"bool",
|
||||
"int",
|
||||
@ -105,7 +105,7 @@ public class CppTizenClientCodegen extends AbstractCppCodegen implements Codegen
|
||||
"unsigned", "using", "virtual", "void", "volatile", "wchar_t", "while", "xor", "xor_eq"
|
||||
));
|
||||
|
||||
super.typeMapping = new HashMap<String, String>();
|
||||
super.typeMapping = new HashMap<>();
|
||||
|
||||
//typeMapping.put("Date", "DateTime");
|
||||
//typeMapping.put("DateTime", "DateTime");
|
||||
@ -128,7 +128,7 @@ public class CppTizenClientCodegen extends AbstractCppCodegen implements Codegen
|
||||
typeMapping.put("UUID", "std::string");
|
||||
typeMapping.put("URI", "std::string");
|
||||
|
||||
importMapping = new HashMap<String, String>();
|
||||
importMapping = new HashMap<>();
|
||||
|
||||
supportingFiles.clear();
|
||||
supportingFiles.add(new SupportingFile("helpers-header.mustache", sourceFolder, "Helpers.h"));
|
||||
@ -175,7 +175,7 @@ public class CppTizenClientCodegen extends AbstractCppCodegen implements Codegen
|
||||
if (languageSpecificPrimitives.contains(name)) {
|
||||
return name;
|
||||
} else {
|
||||
return name + "";
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ public class CppTizenClientCodegen extends AbstractCppCodegen implements Codegen
|
||||
if (languageSpecificPrimitives.contains(openAPIType)) {
|
||||
return toModelName(openAPIType);
|
||||
} else {
|
||||
return openAPIType + "";
|
||||
return openAPIType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ public class CppTizenClientCodegen extends AbstractCppCodegen implements Codegen
|
||||
if (isReservedWord(paramName)) {
|
||||
return escapeReservedWord(paramName);
|
||||
}
|
||||
return "" + paramName;
|
||||
return paramName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,14 +39,14 @@ public class CppUE4ClientCodegen extends AbstractCppCodegen {
|
||||
|
||||
protected String unrealModuleName = "OpenAPI";
|
||||
// Will be treated as pointer
|
||||
protected Set<String> pointerClasses = new HashSet<String>();
|
||||
protected Set<String> pointerClasses = new HashSet<>();
|
||||
// source folder where to write the files
|
||||
protected String privateFolder = "Private";
|
||||
protected String publicFolder = "Public";
|
||||
protected String apiVersion = "1.0.0";
|
||||
protected Map<String, String> namespaces = new HashMap<String, String>();
|
||||
protected Map<String, String> namespaces = new HashMap<>();
|
||||
// Will be included using the <> syntax, not used in Unreal's coding convention
|
||||
protected Set<String> systemIncludes = new HashSet<String>();
|
||||
protected Set<String> systemIncludes = new HashSet<>();
|
||||
protected String cppNamespace = unrealModuleName;
|
||||
protected boolean optionalProjectFileFlag = true;
|
||||
|
||||
@ -132,7 +132,7 @@ public class CppUE4ClientCodegen extends AbstractCppCodegen {
|
||||
* Language Specific Primitives. These types will not trigger imports by
|
||||
* the client generator
|
||||
*/
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"bool",
|
||||
"int32",
|
||||
@ -159,7 +159,7 @@ public class CppUE4ClientCodegen extends AbstractCppCodegen {
|
||||
supportingFiles.add(new SupportingFile("module-source.mustache", privateFolder, unrealModuleName + "Module.cpp"));
|
||||
}
|
||||
|
||||
super.typeMapping = new HashMap<String, String>();
|
||||
super.typeMapping = new HashMap<>();
|
||||
|
||||
// Maps C++ types during call to getSchemaType, see DefaultCodegen.getSchemaType and not the types/formats
|
||||
// defined in openapi specification "array" is also used explicitly in the generator for containers
|
||||
@ -188,10 +188,10 @@ public class CppUE4ClientCodegen extends AbstractCppCodegen {
|
||||
typeMapping.put("UUID", "FGuid");
|
||||
typeMapping.put("AnyType", "TSharedPtr<FJsonValue>");
|
||||
|
||||
importMapping = new HashMap<String, String>();
|
||||
importMapping = new HashMap<>();
|
||||
importMapping.put("HttpFileInput", "#include \"" + modelNamePrefix + "Helpers.h\"");
|
||||
|
||||
namespaces = new HashMap<String, String>();
|
||||
namespaces = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -130,7 +130,7 @@ public class CrystalClientCodegen extends DefaultCodegen {
|
||||
hideGenerationTimestamp = Boolean.TRUE;
|
||||
|
||||
// reserved word. Ref: https://github.com/crystal-lang/crystal/wiki/Crystal-for-Rubyists#available-keywords
|
||||
reservedWords = new HashSet<String>(
|
||||
reservedWords = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"abstract", "do", "if", "nil?", "select", "union",
|
||||
"alias", "else", "in", "of", "self", "unless",
|
||||
@ -557,8 +557,8 @@ public class CrystalClientCodegen extends DefaultCodegen {
|
||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
|
||||
objs = super.postProcessOperationsWithModels(objs, allModels);
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
HashMap<String, CodegenModel> modelMaps = new HashMap<String, CodegenModel>();
|
||||
HashMap<String, Integer> processedModelMaps = new HashMap<String, Integer>();
|
||||
HashMap<String, CodegenModel> modelMaps = new HashMap<>();
|
||||
HashMap<String, Integer> processedModelMaps = new HashMap<>();
|
||||
|
||||
for (Object o : allModels) {
|
||||
HashMap<String, Object> h = (HashMap<String, Object>) o;
|
||||
@ -870,7 +870,7 @@ public class CrystalClientCodegen extends DefaultCodegen {
|
||||
}
|
||||
// only process files with cr extension
|
||||
if ("cr".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = crystalPostProcessFile + " " + file.toString();
|
||||
String command = crystalPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
@ -882,7 +882,7 @@ public class CrystalClientCodegen extends DefaultCodegen {
|
||||
while ((line = br.readLine()) != null) {
|
||||
sb.append(line);
|
||||
}
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}, Error output: {}", command, exitValue, sb.toString());
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}, Error output: {}", command, exitValue, sb);
|
||||
}
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
|
@ -116,7 +116,7 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
* Reserved words. Override this with reserved words specific to your language
|
||||
* Ref: https://github.com/itsgreggreg/elixir_quick_reference#reserved-words
|
||||
*/
|
||||
reservedWords = new HashSet<String>(
|
||||
reservedWords = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"nil",
|
||||
"true",
|
||||
@ -164,7 +164,7 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
* Language Specific Primitives. These types will not trigger imports by
|
||||
* the client generator
|
||||
*/
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"Integer",
|
||||
"Float",
|
||||
@ -182,7 +182,7 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
);
|
||||
|
||||
// ref: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("integer", "Integer");
|
||||
typeMapping.put("long", "Integer");
|
||||
typeMapping.put("number", "Float");
|
||||
@ -727,10 +727,10 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
}
|
||||
|
||||
sb.append("keyword()) :: ");
|
||||
HashSet<String> uniqueResponseTypes = new HashSet<String>();
|
||||
HashSet<String> uniqueResponseTypes = new HashSet<>();
|
||||
for (CodegenResponse response : this.responses) {
|
||||
ExtendedCodegenResponse exResponse = (ExtendedCodegenResponse) response;
|
||||
StringBuilder returnEntry = new StringBuilder("");
|
||||
StringBuilder returnEntry = new StringBuilder();
|
||||
if (exResponse.baseType == null) {
|
||||
returnEntry.append("nil");
|
||||
} else if (exResponse.simpleType) {
|
||||
|
@ -328,19 +328,17 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
private boolean anyVarMatches(final List<Map<String, Object>> models, final Predicate<CodegenProperty> predicate) {
|
||||
return models.stream()
|
||||
.map(obj -> (CodegenModel) obj.get("model"))
|
||||
.flatMap(model -> model.vars.stream())
|
||||
.filter(var -> {
|
||||
CodegenProperty prop = var;
|
||||
while (prop != null) {
|
||||
if (predicate.test(prop)) {
|
||||
return true;
|
||||
.map(obj -> (CodegenModel) obj.get("model"))
|
||||
.flatMap(model -> model.vars.stream()).anyMatch(var -> {
|
||||
CodegenProperty prop = var;
|
||||
while (prop != null) {
|
||||
if (predicate.test(prop)) {
|
||||
return true;
|
||||
}
|
||||
prop = prop.items;
|
||||
}
|
||||
prop = prop.items;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.count() > 0;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -267,7 +267,7 @@ public class FsharpGiraffeServerCodegen extends AbstractFSharpCodegen {
|
||||
}
|
||||
|
||||
// Converts, for example, PUT to HttpPut for controller attributes
|
||||
operation.httpMethod = "Http" + operation.httpMethod.substring(0, 1) + operation.httpMethod.substring(1).toLowerCase(Locale.ROOT);
|
||||
operation.httpMethod = "Http" + operation.httpMethod.charAt(0) + operation.httpMethod.substring(1).toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,8 +136,8 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
|
||||
protected Map<String, Map<String, Object>> uniqueParamNameTypes = new HashMap<>();
|
||||
protected Map<String, Set<String>> modelMimeTypes = new HashMap<>();
|
||||
protected Map<String, String> knownMimeDataTypes = new HashMap<>();
|
||||
protected Set<String> typeNames = new HashSet<String>();
|
||||
protected Set<String> modelTypeNames = new HashSet<String>();
|
||||
protected Set<String> typeNames = new HashSet<>();
|
||||
protected Set<String> modelTypeNames = new HashSet<>();
|
||||
|
||||
final private static Pattern CONTAINS_JSON_MIME_PATTERN = Pattern.compile("(?i)application/.*json(;.*)?");
|
||||
|
||||
@ -235,7 +235,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
|
||||
supportingFiles.add(new SupportingFile("tests/PropMime.mustache", "tests", "PropMime.hs"));
|
||||
supportingFiles.add(new SupportingFile("tests/Test.mustache", "tests", "Test.hs"));
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"Bool",
|
||||
"String",
|
||||
@ -555,7 +555,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
|
||||
}
|
||||
|
||||
if (!additionalProperties.containsKey(PROP_BASE_MODULE)) {
|
||||
List<String> wordsCaps = new ArrayList<String>();
|
||||
List<String> wordsCaps = new ArrayList<>();
|
||||
for (String word : baseTitle.split(" ")) {
|
||||
wordsCaps.add(firstLetterToUpper(word));
|
||||
}
|
||||
@ -684,7 +684,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
|
||||
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation op, Map<String, List<CodegenOperation>> operations) {
|
||||
List<CodegenOperation> opList = operations.get(tag);
|
||||
if (opList == null || opList.isEmpty()) {
|
||||
opList = new ArrayList<CodegenOperation>();
|
||||
opList = new ArrayList<>();
|
||||
operations.put(tag, opList);
|
||||
}
|
||||
// check for operationId uniqueness
|
||||
@ -1454,7 +1454,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
|
||||
|
||||
// only process files with hs extension
|
||||
if ("hs".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = haskellPostProcessFile + " " + file.toString();
|
||||
String command = haskellPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
|
@ -169,7 +169,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
* Language Specific Primitives. These types will not trigger imports by
|
||||
* the client generator
|
||||
*/
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"Bool",
|
||||
"String",
|
||||
@ -286,14 +286,14 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
String[] words = title.split(" ");
|
||||
|
||||
// The package name is made by appending the lowercased words of the title interspersed with dashes
|
||||
List<String> wordsLower = new ArrayList<String>();
|
||||
List<String> wordsLower = new ArrayList<>();
|
||||
for (String word : words) {
|
||||
wordsLower.add(word.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
String cabalName = joinStrings("-", wordsLower);
|
||||
|
||||
// The API name is made by appending the capitalized words of the title
|
||||
List<String> wordsCaps = new ArrayList<String>();
|
||||
List<String> wordsCaps = new ArrayList<>();
|
||||
for (String word : words) {
|
||||
wordsCaps.add(firstLetterToUpper(word));
|
||||
}
|
||||
@ -446,7 +446,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
// IdType is provided by the capture params.
|
||||
private List<String> pathToServantRoute(String path, List<CodegenParameter> pathParams) {
|
||||
// Map the capture params by their names.
|
||||
HashMap<String, String> captureTypes = new HashMap<String, String>();
|
||||
HashMap<String, String> captureTypes = new HashMap<>();
|
||||
for (CodegenParameter param : pathParams) {
|
||||
captureTypes.put(param.baseName, param.dataType);
|
||||
}
|
||||
@ -462,7 +462,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
}
|
||||
|
||||
// Convert the path into a list of servant route components.
|
||||
List<String> pathComponents = new ArrayList<String>();
|
||||
List<String> pathComponents = new ArrayList<>();
|
||||
for (String piece : path.split("/")) {
|
||||
if (piece.startsWith("{") && piece.endsWith("}")) {
|
||||
String name = piece.substring(1, piece.length() - 1);
|
||||
@ -479,7 +479,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
// Extract the arguments that are passed in the route path parameters
|
||||
private List<String> pathToClientType(String path, List<CodegenParameter> pathParams) {
|
||||
// Map the capture params by their names.
|
||||
HashMap<String, String> captureTypes = new HashMap<String, String>();
|
||||
HashMap<String, String> captureTypes = new HashMap<>();
|
||||
for (CodegenParameter param : pathParams) {
|
||||
captureTypes.put(param.baseName, param.dataType);
|
||||
}
|
||||
@ -490,7 +490,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
}
|
||||
|
||||
// Convert the path into a list of servant route components.
|
||||
List<String> type = new ArrayList<String>();
|
||||
List<String> type = new ArrayList<>();
|
||||
for (String piece : path.split("/")) {
|
||||
if (piece.startsWith("{") && piece.endsWith("}")) {
|
||||
String name = piece.substring(1, piece.length() - 1);
|
||||
@ -605,8 +605,8 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
String name = string;
|
||||
//Check if it is a reserved word, in which case the underscore is added when property name is generated.
|
||||
if (string.startsWith("_")) {
|
||||
if (reservedWords.contains(string.substring(1, string.length()))) {
|
||||
name = string.substring(1, string.length());
|
||||
if (reservedWords.contains(string.substring(1))) {
|
||||
name = string.substring(1);
|
||||
} else if (reservedWordsMappings.containsValue(string)) {
|
||||
name = LEADING_UNDERSCORE.matcher(string).replaceFirst("");
|
||||
}
|
||||
@ -685,7 +685,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
|
||||
// only process files with hs extension
|
||||
if ("hs".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = haskellPostProcessFile + " " + file.toString();
|
||||
String command = haskellPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
|
@ -136,7 +136,7 @@ public class HaskellYesodServerCodegen extends DefaultCodegen implements Codegen
|
||||
)
|
||||
);
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"Bool",
|
||||
"Int",
|
||||
@ -359,7 +359,7 @@ public class HaskellYesodServerCodegen extends DefaultCodegen implements Codegen
|
||||
|
||||
private List<String> pathToComponents(String path, List<CodegenParameter> pathParams) {
|
||||
// Map the capture params by their names.
|
||||
HashMap<String, String> captureTypes = new HashMap<String, String>();
|
||||
HashMap<String, String> captureTypes = new HashMap<>();
|
||||
for (CodegenParameter param : pathParams) {
|
||||
captureTypes.put(param.baseName, param.dataType);
|
||||
}
|
||||
@ -370,7 +370,7 @@ public class HaskellYesodServerCodegen extends DefaultCodegen implements Codegen
|
||||
}
|
||||
|
||||
// Convert the path into a list of yesod path components.
|
||||
List<String> components = new ArrayList<String>();
|
||||
List<String> components = new ArrayList<>();
|
||||
for (String piece : path.split("/")) {
|
||||
if (piece.startsWith("{") && piece.endsWith("}")) {
|
||||
String name = piece.substring(1, piece.length() - 1);
|
||||
@ -412,7 +412,7 @@ public class HaskellYesodServerCodegen extends DefaultCodegen implements Codegen
|
||||
|
||||
List<Map<String, Object>> routes = (List<Map<String, Object>>) additionalProperties.get("routes");
|
||||
if (routes == null) {
|
||||
routes = new ArrayList<Map<String, Object>>();
|
||||
routes = new ArrayList<>();
|
||||
additionalProperties.put("routes", routes);
|
||||
}
|
||||
|
||||
@ -432,10 +432,10 @@ public class HaskellYesodServerCodegen extends DefaultCodegen implements Codegen
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
Map<String, Object> route = new HashMap<String, Object>();
|
||||
Map<String, Object> route = new HashMap<>();
|
||||
route.put("path", path);
|
||||
route.put("resource", resource);
|
||||
List<String> methods = new ArrayList<String>();
|
||||
List<String> methods = new ArrayList<>();
|
||||
methods.add(op.httpMethod);
|
||||
route.put("methods", methods);
|
||||
routes.add(route);
|
||||
@ -534,8 +534,8 @@ public class HaskellYesodServerCodegen extends DefaultCodegen implements Codegen
|
||||
String name = string;
|
||||
//Check if it is a reserved word, in which case the underscore is added when property name is generated.
|
||||
if (string.startsWith("_")) {
|
||||
if (reservedWords.contains(string.substring(1, string.length()))) {
|
||||
name = string.substring(1, string.length());
|
||||
if (reservedWords.contains(string.substring(1))) {
|
||||
name = string.substring(1);
|
||||
} else if (reservedWordsMappings.containsValue(string)) {
|
||||
name = LEADING_UNDERSCORE.matcher(string).replaceFirst("");
|
||||
}
|
||||
@ -614,7 +614,7 @@ public class HaskellYesodServerCodegen extends DefaultCodegen implements Codegen
|
||||
|
||||
// only process files with hs extension
|
||||
if ("hs".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = haskellPostProcessFile + " " + file.toString();
|
||||
String command = haskellPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
|
@ -133,7 +133,7 @@ public class JMeterClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
/*
|
||||
* Reserved words. Override this with reserved words specific to your language
|
||||
*/
|
||||
reservedWords = new HashSet<String>(
|
||||
reservedWords = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"sample1", // replace with static values
|
||||
"sample2")
|
||||
|
@ -70,7 +70,7 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
updateOption(CodegenConstants.ARTIFACT_ID, this.getArtifactId());
|
||||
updateOption(CodegenConstants.API_PACKAGE, apiPackage);
|
||||
updateOption(CodegenConstants.MODEL_PACKAGE, modelPackage);
|
||||
updateOption(this.DATE_LIBRARY, this.getDateLibrary());
|
||||
updateOption(DATE_LIBRARY, this.getDateLibrary());
|
||||
|
||||
// clear model and api doc template as this codegen
|
||||
// does not support auto-generated markdown doc at the moment
|
||||
|
@ -655,7 +655,7 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
|
||||
var.addTestData(randomBigDecimal);
|
||||
}
|
||||
} else {
|
||||
buffer.append(randomBigDecimal.toString()).append('D');
|
||||
buffer.append(randomBigDecimal).append('D');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1294,7 +1294,7 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
|
||||
if (testDataCache.root().isDirty()) {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
testDataCache.root().flush(out);
|
||||
String testDataJson = new String(out.toByteArray(), "UTF-8");
|
||||
String testDataJson = out.toString("UTF-8");
|
||||
objs.put("test-data.json", testDataJson);
|
||||
supportingFiles.add(new SupportingFile("testData.mustache", testDataFile.getAbsolutePath()));
|
||||
}
|
||||
@ -1306,7 +1306,7 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
|
||||
if (testDataControlCache.root().isDirty()) {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
testDataControlCache.root().flush(out);
|
||||
String testDataControlJson = new String(out.toByteArray(), "UTF-8");
|
||||
String testDataControlJson = out.toString("UTF-8");
|
||||
objs.put("test-data-control.json", testDataControlJson);
|
||||
supportingFiles
|
||||
.add(new SupportingFile("testDataControl.mustache", testDataControlFile.getAbsolutePath()));
|
||||
|
@ -806,6 +806,12 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
model.imports.remove("JsonSerialize");
|
||||
model.imports.remove("ToStringSerializer");
|
||||
}
|
||||
|
||||
if ("set".equals(property.containerType) && !JACKSON.equals(serializationLibrary)) {
|
||||
// clean-up
|
||||
model.imports.remove("JsonDeserialize");
|
||||
property.vendorExtensions.remove("x-setter-extra-annotation");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -65,7 +65,7 @@ public class JavaInflectorServerCodegen extends AbstractJavaCodegen {
|
||||
updateOption(CodegenConstants.ARTIFACT_ID, this.getArtifactId());
|
||||
updateOption(CodegenConstants.API_PACKAGE, apiPackage);
|
||||
updateOption(CodegenConstants.MODEL_PACKAGE, modelPackage);
|
||||
updateOption(this.DATE_LIBRARY, this.getDateLibrary());
|
||||
updateOption(DATE_LIBRARY, this.getDateLibrary());
|
||||
|
||||
additionalProperties.put("title", title);
|
||||
// java inflector uses the jackson lib
|
||||
|
@ -116,7 +116,7 @@ public class JavaMicronautClientCodegen extends AbstractJavaCodegen implements B
|
||||
.ifPresent(v -> cliOptions.remove(v));
|
||||
|
||||
// Add reserved words
|
||||
String[] reservedWordsArray = new String[]{
|
||||
String[] reservedWordsArray = {
|
||||
"client", "format", "queryvalue", "queryparam", "pathvariable", "header", "cookie",
|
||||
"authorization", "body", "application"
|
||||
};
|
||||
|
@ -471,7 +471,7 @@ public class JavaPKMSTServerCodegen extends AbstractJavaCodegen {
|
||||
// get vendor extensions
|
||||
|
||||
Map<String, Object> vendorExt = openAPI.getInfo().getExtensions();
|
||||
if (vendorExt != null && !vendorExt.toString().equals("")) {
|
||||
if (vendorExt != null && !vendorExt.toString().isEmpty()) {
|
||||
if (vendorExt.containsKey("x-codegen")) {
|
||||
|
||||
Map<String, String> uris = (Map<String, String>) vendorExt.get("x-codegen");
|
||||
|
@ -52,7 +52,7 @@ public class JavaUndertowServerCodegen extends AbstractJavaCodegen {
|
||||
// clioOptions default redefinition need to be updated
|
||||
updateOption(CodegenConstants.INVOKER_PACKAGE, this.getInvokerPackage());
|
||||
updateOption(CodegenConstants.ARTIFACT_ID, this.getArtifactId());
|
||||
updateOption(this.DATE_LIBRARY, this.getDateLibrary());
|
||||
updateOption(DATE_LIBRARY, this.getDateLibrary());
|
||||
|
||||
apiTestTemplateFiles.clear(); // TODO: add test template
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class JavaVertXServerCodegen extends AbstractJavaCodegen {
|
||||
updateOption(CodegenConstants.ARTIFACT_VERSION, this.getArtifactVersion());
|
||||
updateOption(CodegenConstants.API_PACKAGE, apiPackage);
|
||||
updateOption(CodegenConstants.MODEL_PACKAGE, modelPackage);
|
||||
updateOption(this.DATE_LIBRARY, this.getDateLibrary());
|
||||
updateOption(DATE_LIBRARY, this.getDateLibrary());
|
||||
|
||||
additionalProperties.put(ROOT_PACKAGE, rootPackage);
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class JavascriptApolloClientCodegen extends DefaultCodegen implements Cod
|
||||
public static final String EMIT_JS_DOC = "emitJSDoc";
|
||||
public static final String NPM_REPOSITORY = "npmRepository";
|
||||
|
||||
final String[][] JAVASCRIPT_SUPPORTING_FILES = new String[][]{
|
||||
final String[][] JAVASCRIPT_SUPPORTING_FILES = {
|
||||
new String[]{"package.mustache", "package.json"},
|
||||
// new String[]{"index.mustache", "src/index.js", },
|
||||
// new String[]{"ApiClient.mustache", "src/ApiClient.js"},
|
||||
@ -59,7 +59,7 @@ public class JavascriptApolloClientCodegen extends DefaultCodegen implements Cod
|
||||
new String[]{"travis.yml", ".travis.yml"}
|
||||
};
|
||||
|
||||
final String[][] JAVASCRIPT_ES6_SUPPORTING_FILES = new String[][]{
|
||||
final String[][] JAVASCRIPT_ES6_SUPPORTING_FILES = {
|
||||
new String[]{"package.mustache", "package.json"},
|
||||
// new String[]{"index.mustache", "src/index.js"},
|
||||
// new String[]{"ApiClient.mustache", "src/ApiClient.js"},
|
||||
@ -132,10 +132,10 @@ public class JavascriptApolloClientCodegen extends DefaultCodegen implements Cod
|
||||
"prototype", "String", "toString", "undefined", "valueOf")
|
||||
);
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList("String", "Boolean", "Number", "Array", "Object", "Date", "File", "Blob")
|
||||
);
|
||||
defaultIncludes = new HashSet<String>(languageSpecificPrimitives);
|
||||
defaultIncludes = new HashSet<>(languageSpecificPrimitives);
|
||||
|
||||
instantiationTypes.put("array", "Array");
|
||||
instantiationTypes.put("list", "Array");
|
||||
@ -1127,7 +1127,7 @@ public class JavascriptApolloClientCodegen extends DefaultCodegen implements Cod
|
||||
|
||||
// only process files with js extension
|
||||
if ("js".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = jsPostProcessFile + " " + file.toString();
|
||||
String command = jsPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
p.waitFor();
|
||||
|
@ -51,7 +51,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
public static final String USE_ES6 = "useES6";
|
||||
public static final String NPM_REPOSITORY = "npmRepository";
|
||||
|
||||
final String[][] JAVASCRIPT_SUPPORTING_FILES = new String[][]{
|
||||
final String[][] JAVASCRIPT_SUPPORTING_FILES = {
|
||||
new String[]{"package.mustache", "package.json"},
|
||||
// new String[]{"index.mustache", "src/index.js", },
|
||||
// new String[]{"ApiClient.mustache", "src/ApiClient.js"},
|
||||
@ -62,7 +62,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
new String[]{"gitignore.mustache", ".gitignore"}
|
||||
};
|
||||
|
||||
final String[][] JAVASCRIPT_ES6_SUPPORTING_FILES = new String[][]{
|
||||
final String[][] JAVASCRIPT_ES6_SUPPORTING_FILES = {
|
||||
new String[]{"package.mustache", "package.json"},
|
||||
// new String[]{"index.mustache", "src/index.js"},
|
||||
// new String[]{"ApiClient.mustache", "src/ApiClient.js"},
|
||||
@ -135,10 +135,10 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
"prototype", "String", "toString", "undefined", "valueOf")
|
||||
);
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList("String", "Boolean", "Number", "Array", "Object", "Date", "File", "Blob")
|
||||
);
|
||||
defaultIncludes = new HashSet<String>(languageSpecificPrimitives);
|
||||
defaultIncludes = new HashSet<>(languageSpecificPrimitives);
|
||||
|
||||
instantiationTypes.put("array", "Array");
|
||||
instantiationTypes.put("set", "Array");
|
||||
@ -1212,7 +1212,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
|
||||
// only process files with js extension
|
||||
if ("js".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = jsPostProcessFile + " " + file.toString();
|
||||
String command = jsPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
p.waitFor();
|
||||
|
@ -55,16 +55,16 @@ public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implem
|
||||
"short", "try", "char", "final", "interface", "static", "void",
|
||||
"class", "finally", "const", "super", "while"));
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(Arrays.asList(
|
||||
"string",
|
||||
"boolean",
|
||||
"number",
|
||||
"Object",
|
||||
"Blob",
|
||||
"Date"));
|
||||
languageSpecificPrimitives = new HashSet<>(Arrays.asList(
|
||||
"string",
|
||||
"boolean",
|
||||
"number",
|
||||
"Object",
|
||||
"Blob",
|
||||
"Date"));
|
||||
instantiationTypes.put("array", "Array");
|
||||
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("Array", "Array");
|
||||
typeMapping.put("array", "Array");
|
||||
typeMapping.put("List", "Array");
|
||||
@ -86,11 +86,11 @@ public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implem
|
||||
typeMapping.put("map", "Object");
|
||||
typeMapping.put("DateTime", "Date");
|
||||
|
||||
importMapping = new HashMap<String, String>();
|
||||
defaultIncludes = new HashSet<String>(Arrays.asList(
|
||||
"Object",
|
||||
"Array",
|
||||
"Blob"
|
||||
importMapping = new HashMap<>();
|
||||
defaultIncludes = new HashSet<>(Arrays.asList(
|
||||
"Object",
|
||||
"Array",
|
||||
"Blob"
|
||||
));
|
||||
|
||||
typeMapping.put("binary", "string");
|
||||
|
@ -64,7 +64,7 @@ public class JavascriptFlowtypedClientCodegen extends AbstractTypeScriptClientCo
|
||||
"Math", "NaN", "Number", "Object",
|
||||
"prototype", "String", "toString", "undefined", "valueOf"));
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList("string", "boolean", "number", "Array", "Object", "Date", "File", "Blob")
|
||||
);
|
||||
|
||||
@ -95,7 +95,7 @@ public class JavascriptFlowtypedClientCodegen extends AbstractTypeScriptClientCo
|
||||
typeMapping.put("UUID", "string");
|
||||
typeMapping.put("URI", "string");
|
||||
|
||||
defaultIncludes = new HashSet<String>(languageSpecificPrimitives);
|
||||
defaultIncludes = new HashSet<>(languageSpecificPrimitives);
|
||||
outputFolder = "generated-code/javascript-flowtyped";
|
||||
embeddedTemplateDir = templateDir = "Javascript-Flowtyped";
|
||||
|
||||
@ -173,14 +173,14 @@ public class JavascriptFlowtypedClientCodegen extends AbstractTypeScriptClientCo
|
||||
// name enum with model name, e.g. StatusEnum => Pet.StatusEnum
|
||||
for (CodegenProperty var : cm.vars) {
|
||||
if (Boolean.TRUE.equals(var.isEnum)) {
|
||||
var.datatypeWithEnum = var.datatypeWithEnum.replace(var.enumName, cm.classname + "" + var.enumName);
|
||||
var.datatypeWithEnum = var.datatypeWithEnum.replace(var.enumName, cm.classname + var.enumName);
|
||||
}
|
||||
}
|
||||
if (cm.parent != null) {
|
||||
for (CodegenProperty var : cm.allVars) {
|
||||
if (Boolean.TRUE.equals(var.isEnum)) {
|
||||
var.datatypeWithEnum = var.datatypeWithEnum
|
||||
.replace(var.enumName, cm.classname + "" + var.enumName);
|
||||
.replace(var.enumName, cm.classname + var.enumName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ public class K6ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
.map(x -> quoteExample(
|
||||
StringEscapeUtils.escapeEcmaScript(
|
||||
String.valueOf(x.getValue()))))
|
||||
.collect(Collectors.toCollection(() -> new TreeSet<String>()));
|
||||
.collect(Collectors.toCollection(() -> new TreeSet<>()));
|
||||
|
||||
if (!exampleValues.isEmpty()) {
|
||||
|
||||
@ -274,7 +274,7 @@ public class K6ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public static final String BASE_URL = "baseURL";
|
||||
public static final String PRESERVE_LEADING_PARAM_CHAR = "preserveLeadingParamChar";
|
||||
static final Collection<String> INVOKER_PKG_SUPPORTING_FILES = Arrays.asList("script.mustache", "README.mustache");
|
||||
static final String[][] JAVASCRIPT_SUPPORTING_FILES = new String[][]{
|
||||
static final String[][] JAVASCRIPT_SUPPORTING_FILES = {
|
||||
new String[]{"script.mustache", "script.js"}, new String[]{"README.mustache", "README.md"}};
|
||||
|
||||
protected String projectName;
|
||||
@ -412,7 +412,7 @@ public class K6ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
List<Parameter> queryParams = new ArrayList<>();
|
||||
List<Parameter> bodyOrFormParams = new ArrayList<>();
|
||||
List<k6Check> k6Checks = new ArrayList<>();
|
||||
Set<String> imports = new HashSet<String>();
|
||||
Set<String> imports = new HashSet<>();
|
||||
|
||||
final Operation operation = methodOperation.getValue();
|
||||
final PathItem.HttpMethod method = methodOperation.getKey();
|
||||
|
@ -372,13 +372,18 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
||||
}
|
||||
|
||||
if (usesRetrofit2Library()) {
|
||||
if (ProcessUtils.hasOAuthMethods(openAPI)) {
|
||||
supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.kt.mustache", authFolder, "ApiKeyAuth.kt"));
|
||||
boolean hasOAuthMethods = ProcessUtils.hasOAuthMethods(openAPI);
|
||||
|
||||
if (hasOAuthMethods) {
|
||||
supportingFiles.add(new SupportingFile("auth/OAuth.kt.mustache", authFolder, "OAuth.kt"));
|
||||
supportingFiles.add(new SupportingFile("auth/OAuthFlow.kt.mustache", authFolder, "OAuthFlow.kt"));
|
||||
supportingFiles.add(new SupportingFile("auth/OAuthOkHttpClient.kt.mustache", authFolder, "OAuthOkHttpClient.kt"));
|
||||
}
|
||||
|
||||
if (hasOAuthMethods || ProcessUtils.hasApiKeyMethods(openAPI)) {
|
||||
supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.kt.mustache", authFolder, "ApiKeyAuth.kt"));
|
||||
}
|
||||
|
||||
if (ProcessUtils.hasHttpBearerMethods(openAPI)) {
|
||||
supportingFiles.add(new SupportingFile("auth/HttpBearerAuth.kt.mustache", authFolder, "HttpBearerAuth.kt"));
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
basePath = basePath.substring(0, pos);
|
||||
}
|
||||
|
||||
if (basePath.equals("")) {
|
||||
if (basePath.isEmpty()) {
|
||||
basePath = "default";
|
||||
} else {
|
||||
co.subresourceOperation = !co.path.isEmpty();
|
||||
|
@ -1055,7 +1055,7 @@ public class KtormSchemaCodegen extends AbstractKotlinCodegen {
|
||||
|
||||
// identifier name cannot be empty
|
||||
if (escapedName.isEmpty()) {
|
||||
throw new RuntimeException("Empty database/table/column name for property '" + name.toString() + "' not allowed");
|
||||
throw new RuntimeException("Empty database/table/column name for property '" + name + "' not allowed");
|
||||
}
|
||||
return escapedName;
|
||||
}
|
||||
|
@ -111,13 +111,13 @@ public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
)
|
||||
);
|
||||
|
||||
defaultIncludes = new HashSet<String>(
|
||||
defaultIncludes = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"map",
|
||||
"array")
|
||||
);
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"nil",
|
||||
"string",
|
||||
@ -150,7 +150,7 @@ public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("ByteArray", "string");
|
||||
typeMapping.put("object", "TODO_OBJECT_MAPPING");
|
||||
|
||||
importMapping = new HashMap<String, String>();
|
||||
importMapping = new HashMap<>();
|
||||
importMapping.put("time.Time", "time");
|
||||
importMapping.put("*os.File", "os");
|
||||
importMapping.put("os", "io/ioutil");
|
||||
@ -508,7 +508,7 @@ public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
public Map<String, String> createMapping(String key, String value) {
|
||||
Map<String, String> customImport = new HashMap<String, String>();
|
||||
Map<String, String> customImport = new HashMap<>();
|
||||
customImport.put(key, value);
|
||||
|
||||
return customImport;
|
||||
|
@ -97,7 +97,7 @@ public class MarkdownDocumentationCodegen extends DefaultCodegen implements Code
|
||||
public String toParamName(String name) {
|
||||
if (reservedWords.contains(name)) {
|
||||
return escapeReservedWord(name);
|
||||
} else if (((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.keySet().contains("" + ((char) character)))) {
|
||||
} else if (((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.keySet().contains(String.valueOf((char) character)))) {
|
||||
return escape(name, specialCharReplacements, null, null);
|
||||
}
|
||||
return name;
|
||||
|
@ -41,19 +41,19 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
public static final Integer ENUM_MAX_ELEMENTS = 65535;
|
||||
public static final Integer IDENTIFIER_MAX_LENGTH = 64;
|
||||
|
||||
protected Vector<String> mysqlNumericTypes = new Vector<String>(Arrays.asList(
|
||||
protected Vector<String> mysqlNumericTypes = new Vector<>(Arrays.asList(
|
||||
"BIGINT", "BIT", "BOOL", "BOOLEAN", "DEC", "DECIMAL", "DOUBLE", "DOUBLE PRECISION", "FIXED", "FLOAT", "INT", "INTEGER", "MEDIUMINT", "NUMERIC", "REAL", "SMALLINT", "TINYINT"
|
||||
));
|
||||
|
||||
protected Vector<String> mysqlDateAndTimeTypes = new Vector<String>(Arrays.asList(
|
||||
protected Vector<String> mysqlDateAndTimeTypes = new Vector<>(Arrays.asList(
|
||||
"DATE", "DATETIME", "TIME", "TIMESTAMP", "YEAR"
|
||||
));
|
||||
|
||||
protected Vector<String> mysqlStringTypes = new Vector<String>(Arrays.asList(
|
||||
protected Vector<String> mysqlStringTypes = new Vector<>(Arrays.asList(
|
||||
"BINARY", "BLOB", "CHAR", "CHAR BYTE", "CHARACTER", "ENUM", "LONGBLOB", "LONGTEXT", "MEDIUMBLOB", "MEDIUMTEXT", "SET", "TEXT", "TINYBLOB", "TINYTEXT", "VARBINARY", "VARCHAR"
|
||||
));
|
||||
|
||||
protected Vector<String> mysqlSpatialTypes = new Vector<String>(Arrays.asList(
|
||||
protected Vector<String> mysqlSpatialTypes = new Vector<>(Arrays.asList(
|
||||
"GEOMETRY", "GEOMETRYCOLLECTION", "LINESTRING", "MULTILINESTRING", "MULTIPOINT", "MULTIPOLYGON", "POINT", "POLYGON"
|
||||
));
|
||||
|
||||
@ -125,7 +125,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
);
|
||||
|
||||
// all types can be threaded as primitives except array, object and refs
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"bool",
|
||||
"boolean",
|
||||
@ -263,8 +263,8 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
String tableName = this.toTableName(modelName);
|
||||
String modelDescription = model.getDescription();
|
||||
Map<String, Object> modelVendorExtensions = model.getVendorExtensions();
|
||||
Map<String, Object> mysqlSchema = new HashMap<String, Object>();
|
||||
Map<String, Object> tableDefinition = new HashMap<String, Object>();
|
||||
Map<String, Object> mysqlSchema = new HashMap<>();
|
||||
Map<String, Object> tableDefinition = new HashMap<>();
|
||||
|
||||
if (this.getIdentifierNamingConvention().equals("snake_case") && !modelName.equals(tableName)) {
|
||||
// add original name in table comment
|
||||
@ -325,8 +325,8 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
*/
|
||||
public void processIntegerTypeProperty(CodegenModel model, CodegenProperty property) {
|
||||
Map<String, Object> vendorExtensions = property.getVendorExtensions();
|
||||
Map<String, Object> mysqlSchema = new HashMap<String, Object>();
|
||||
Map<String, Object> columnDefinition = new HashMap<String, Object>();
|
||||
Map<String, Object> mysqlSchema = new HashMap<>();
|
||||
Map<String, Object> columnDefinition = new HashMap<>();
|
||||
ArrayList columnDataTypeArguments = new ArrayList();
|
||||
String baseName = property.getBaseName();
|
||||
String colName = this.toColumnName(baseName);
|
||||
@ -366,7 +366,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
if (i > ENUM_MAX_ELEMENTS - 1) {
|
||||
LOGGER.warn(
|
||||
"ENUM column can have maximum of {} distinct elements, following value will be skipped: {}",
|
||||
ENUM_MAX_ELEMENTS.toString(), (String) enumValues.get(i));
|
||||
ENUM_MAX_ELEMENTS, (String) enumValues.get(i));
|
||||
break;
|
||||
}
|
||||
String value = String.valueOf(enumValues.get(i));
|
||||
@ -417,8 +417,8 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
*/
|
||||
public void processDecimalTypeProperty(CodegenModel model, CodegenProperty property) {
|
||||
Map<String, Object> vendorExtensions = property.getVendorExtensions();
|
||||
Map<String, Object> mysqlSchema = new HashMap<String, Object>();
|
||||
Map<String, Object> columnDefinition = new HashMap<String, Object>();
|
||||
Map<String, Object> mysqlSchema = new HashMap<>();
|
||||
Map<String, Object> columnDefinition = new HashMap<>();
|
||||
ArrayList columnDataTypeArguments = new ArrayList();
|
||||
String baseName = property.getBaseName();
|
||||
String colName = this.toColumnName(baseName);
|
||||
@ -457,7 +457,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
if (i > ENUM_MAX_ELEMENTS - 1) {
|
||||
LOGGER.warn(
|
||||
"ENUM column can have maximum of {} distinct elements, following value will be skipped: {}",
|
||||
ENUM_MAX_ELEMENTS.toString(), (String) enumValues.get(i));
|
||||
ENUM_MAX_ELEMENTS, (String) enumValues.get(i));
|
||||
break;
|
||||
}
|
||||
String value = String.valueOf(enumValues.get(i));
|
||||
@ -507,8 +507,8 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
*/
|
||||
public void processBooleanTypeProperty(CodegenModel model, CodegenProperty property) {
|
||||
Map<String, Object> vendorExtensions = property.getVendorExtensions();
|
||||
Map<String, Object> mysqlSchema = new HashMap<String, Object>();
|
||||
Map<String, Object> columnDefinition = new HashMap<String, Object>();
|
||||
Map<String, Object> mysqlSchema = new HashMap<>();
|
||||
Map<String, Object> columnDefinition = new HashMap<>();
|
||||
ArrayList columnDataTypeArguments = new ArrayList();
|
||||
String baseName = property.getBaseName();
|
||||
String colName = this.toColumnName(baseName);
|
||||
@ -562,8 +562,8 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
*/
|
||||
public void processStringTypeProperty(CodegenModel model, CodegenProperty property) {
|
||||
Map<String, Object> vendorExtensions = property.getVendorExtensions();
|
||||
Map<String, Object> mysqlSchema = new HashMap<String, Object>();
|
||||
Map<String, Object> columnDefinition = new HashMap<String, Object>();
|
||||
Map<String, Object> mysqlSchema = new HashMap<>();
|
||||
Map<String, Object> columnDefinition = new HashMap<>();
|
||||
ArrayList columnDataTypeArguments = new ArrayList();
|
||||
String baseName = property.getBaseName();
|
||||
String colName = this.toColumnName(baseName);
|
||||
@ -601,7 +601,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
if (i > ENUM_MAX_ELEMENTS - 1) {
|
||||
LOGGER.warn(
|
||||
"ENUM column can have maximum of {} distinct elements, following value will be skipped: {}",
|
||||
ENUM_MAX_ELEMENTS.toString(), (String) enumValues.get(i));
|
||||
ENUM_MAX_ELEMENTS, (String) enumValues.get(i));
|
||||
break;
|
||||
}
|
||||
String value = String.valueOf(enumValues.get(i));
|
||||
@ -645,8 +645,8 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
*/
|
||||
public void processDateTypeProperty(CodegenModel model, CodegenProperty property) {
|
||||
Map<String, Object> vendorExtensions = property.getVendorExtensions();
|
||||
Map<String, Object> mysqlSchema = new HashMap<String, Object>();
|
||||
Map<String, Object> columnDefinition = new HashMap<String, Object>();
|
||||
Map<String, Object> mysqlSchema = new HashMap<>();
|
||||
Map<String, Object> columnDefinition = new HashMap<>();
|
||||
String baseName = property.getBaseName();
|
||||
String colName = this.toColumnName(baseName);
|
||||
String dataType = property.getDataType();
|
||||
@ -698,8 +698,8 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
*/
|
||||
public void processJsonTypeProperty(CodegenModel model, CodegenProperty property) {
|
||||
Map<String, Object> vendorExtensions = property.getVendorExtensions();
|
||||
Map<String, Object> mysqlSchema = new HashMap<String, Object>();
|
||||
Map<String, Object> columnDefinition = new HashMap<String, Object>();
|
||||
Map<String, Object> mysqlSchema = new HashMap<>();
|
||||
Map<String, Object> columnDefinition = new HashMap<>();
|
||||
String baseName = property.getBaseName();
|
||||
String colName = this.toColumnName(baseName);
|
||||
String dataType = property.getDataType();
|
||||
@ -755,8 +755,8 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
*/
|
||||
public void processUnknownTypeProperty(CodegenModel model, CodegenProperty property) {
|
||||
Map<String, Object> vendorExtensions = property.getVendorExtensions();
|
||||
Map<String, Object> mysqlSchema = new HashMap<String, Object>();
|
||||
Map<String, Object> columnDefinition = new HashMap<String, Object>();
|
||||
Map<String, Object> mysqlSchema = new HashMap<>();
|
||||
Map<String, Object> columnDefinition = new HashMap<>();
|
||||
String baseName = property.getBaseName();
|
||||
String colName = this.toColumnName(baseName);
|
||||
Boolean required = property.getRequired();
|
||||
@ -806,7 +806,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
* @return generated codegen property
|
||||
*/
|
||||
public HashMap<String, Object> toCodegenMysqlDataTypeArgument(Object value) {
|
||||
HashMap<String, Object> arg = new HashMap<String, Object>();
|
||||
HashMap<String, Object> arg = new HashMap<>();
|
||||
if (value instanceof String) {
|
||||
arg.put("isString", true);
|
||||
arg.put("isFloat", false);
|
||||
@ -838,7 +838,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
* @return generated codegen property
|
||||
*/
|
||||
public HashMap<String, Object> toCodegenMysqlDataTypeDefault(String defaultValue, String mysqlDataType) {
|
||||
HashMap<String, Object> defaultMap = new HashMap<String, Object>();
|
||||
HashMap<String, Object> defaultMap = new HashMap<>();
|
||||
if (defaultValue == null || defaultValue.toUpperCase(Locale.ROOT).equals("NULL")) {
|
||||
defaultMap.put("defaultValue", "NULL");
|
||||
defaultMap.put("isString", false);
|
||||
@ -1076,7 +1076,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
// identifier name cannot be empty
|
||||
if (escapedName.isEmpty()) {
|
||||
throw new RuntimeException("Empty database/table/column name for property '" + name.toString() + "' not allowed");
|
||||
throw new RuntimeException("Empty database/table/column name for property '" + name + "' not allowed");
|
||||
}
|
||||
return escapedName;
|
||||
}
|
||||
|
@ -117,13 +117,13 @@ public class NimClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
)
|
||||
);
|
||||
|
||||
defaultIncludes = new HashSet<String>(
|
||||
defaultIncludes = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"array"
|
||||
)
|
||||
);
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"int",
|
||||
"int8",
|
||||
|
@ -439,7 +439,7 @@ public class NodeJSExpressServerCodegen extends DefaultCodegen implements Codege
|
||||
|
||||
// only process files with js extension
|
||||
if ("js".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = jsPostProcessFile + " " + file.toString();
|
||||
String command = jsPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
p.waitFor();
|
||||
|
@ -672,7 +672,7 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
public String toEnumValueName(String name) {
|
||||
if (reservedWords.contains(name)) {
|
||||
return escapeReservedWord(name);
|
||||
} else if (((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.keySet().contains("" + ((char) character)))) {
|
||||
} else if (((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.keySet().contains(String.valueOf((char) character)))) {
|
||||
return escape(name, specialCharReplacements, Collections.singletonList("_"), null);
|
||||
} else {
|
||||
return name;
|
||||
@ -812,7 +812,7 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
}
|
||||
// only process files with ml or mli extension
|
||||
if ("ml".equals(FilenameUtils.getExtension(file.toString())) || "mli".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = ocamlPostProcessFile + " " + file.toString();
|
||||
String command = ocamlPostProcessFile + " " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
|
@ -43,7 +43,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public static final String DEFAULT_LICENSE = "Proprietary";
|
||||
public static final String CORE_DATA = "coreData";
|
||||
|
||||
protected Set<String> foundationClasses = new HashSet<String>();
|
||||
protected Set<String> foundationClasses = new HashSet<>();
|
||||
protected String podName = "OpenAPIClient";
|
||||
protected String podVersion = "1.0.0";
|
||||
protected String classPrefix = "OAI";
|
||||
@ -60,7 +60,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
protected boolean generateCoreData = false;
|
||||
|
||||
protected Set<String> advancedMappingTypes = new HashSet<String>();
|
||||
protected Set<String> advancedMappingTypes = new HashSet<>();
|
||||
|
||||
public ObjcClientCodegen() {
|
||||
super();
|
||||
@ -185,9 +185,9 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
"description", "class"
|
||||
));
|
||||
|
||||
importMapping = new HashMap<String, String>();
|
||||
importMapping = new HashMap<>();
|
||||
|
||||
foundationClasses = new HashSet<String>(
|
||||
foundationClasses = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"NSNumber",
|
||||
"NSObject",
|
||||
|
@ -614,7 +614,7 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
if ("t".equals(FilenameUtils.getExtension(file.toString())) ||
|
||||
"pm".equals(FilenameUtils.getExtension(file.toString())) ||
|
||||
"pl".equals(FilenameUtils.getExtension(file.toString()))) {
|
||||
String command = perlTidyPath + " -b -bext='/' " + file.toString();
|
||||
String command = perlTidyPath + " -b -bext='/' " + file;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
|
@ -90,7 +90,7 @@ public class PhpSilexServerCodegen extends DefaultCodegen implements CodegenConf
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion);
|
||||
|
||||
// ref: http://php.net/manual/en/language.types.intro.php
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
languageSpecificPrimitives = new HashSet<>(
|
||||
Arrays.asList(
|
||||
"boolean",
|
||||
"int",
|
||||
@ -108,7 +108,7 @@ public class PhpSilexServerCodegen extends DefaultCodegen implements CodegenConf
|
||||
instantiationTypes.put("map", "map");
|
||||
|
||||
// ref: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping = new HashMap<>();
|
||||
typeMapping.put("integer", "int");
|
||||
typeMapping.put("long", "int");
|
||||
typeMapping.put("float", "float");
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user