Merge remote-tracking branch 'origin/master' into 6.0.x

This commit is contained in:
William Cheng 2021-10-06 12:00:02 +08:00
commit 0bfa28f844
1650 changed files with 36995 additions and 6074 deletions

View File

@ -56,7 +56,7 @@ jobs:
~/.gradle
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Install Gradle wrapper
uses: eskatos/gradle-command-action@v1
uses: eskatos/gradle-command-action@v2
with:
gradle-version: ${{ env.GRADLE_VERSION }}
build-root-directory: ${{ matrix.sample }}

View File

@ -21,28 +21,11 @@ cache:
- $HOME/samples/client/petstore/php/OpenAPIToolsClient-php/vendor
- $HOME/samples/client/petstore/ruby/vendor/bundle
- $HOME/samples/client/petstore/python/.venv/
- $HOME/samples/openapi3/client/petstore/typescript/tests/default/node_modules
- $HOME/samples/openapi3/client/petstore/typescript/tests/jquery/node_modules
- $HOME/samples/openapi3/client/petstore/typescript/tests/object_params/node_modules
- $HOME/samples/openapi3/client/petstore/typescript/tests/inversify/node_modules
- $HOME/samples/client/petstore/typescript-node/npm/node_modules
- $HOME/samples/client/petstore/typescript-node/npm/typings/
- $HOME/samples/client/petstore/typescript-fetch/tests/default/node_modules
- $HOME/samples/client/petstore/typescript-fetch/tests/default/typings
- $HOME/samples/client/petstore/typescript-fetch/builds/default/node_modules
- $HOME/samples/client/petstore/typescript-fetch/builds/default/typings
- $HOME/samples/client/petstore/typescript-fetch/builds/es6-target/node_modules
- $HOME/samples/client/petstore/typescript-fetch/builds/es6-target/typings
- $HOME/samples/client/petstore/typescript-fetch/builds/with-npm-version/node_modules
- $HOME/samples/client/petstore/typescript-fetch/npm/with-npm-version/typings
- $HOME/samples/client/petstore/typescript-angular/node_modules
- $HOME/samples/client/petstore/typescript-angular/typings
- $HOME/samples/server/petstore/rust-server/target
- $HOME/perl5
- $HOME/.cargo
- $HOME/.pub-cache
- $HOME/samples/server/petstore/cpp-pistache/pistache
- $HOME/.npm
- $HOME/.rvm/gems/ruby-2.4.1
- $HOME/website/node_modules/
- $HOME/.cache/deno
@ -75,23 +58,19 @@ before_install:
- docker pull swaggerapi/petstore
- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
- docker ps -a
# comment out crystal installation as the tests will run on circleci or github action instead
# install crystal
- echo 'deb http://download.opensuse.org/repositories/devel:/languages:/crystal/xUbuntu_16.04/ /' | sudo tee /etc/apt/sources.list.d/devel:languages:crystal.list
- curl -fsSL https://download.opensuse.org/repositories/devel:languages:crystal/xUbuntu_16.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_languages_crystal.gpg > /dev/null
- sudo apt update
- sudo apt install crystal
- crystal --version
#- echo 'deb http://download.opensuse.org/repositories/devel:/languages:/crystal/xUbuntu_16.04/ /' | sudo tee /etc/apt/sources.list.d/devel:languages:crystal.list
#- curl -fsSL https://download.opensuse.org/repositories/devel:languages:crystal/xUbuntu_16.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_languages_crystal.gpg > /dev/null
#- sudo apt update
#- sudo apt install crystal
#- crystal --version
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.22.0
- export PATH="$HOME/.yarn/bin:$PATH"
# install rust
- curl https://sh.rustup.rs -sSf | sh -s -- -y -v
# required when sudo: required for the Ruby petstore tests
- gem install bundler
- nvm install 12.20.0
- nvm use 12.20.0
- npm install -g typescript
- npm install -g npm
- npm config set registry http://registry.npmjs.org/
# set python 3.6.3 as default
- source ~/virtualenv/python3.6/bin/activate
# -- skip bash test to shorten build time

View File

@ -7,6 +7,8 @@ NODE_INDEX=${CIRCLE_NODE_INDEX:-0}
set -e
export NODE_ENV=test
function cleanup {
# Show logs of 'petstore.swagger' container to troubleshoot Unit Test failures, if any.
docker logs petstore.swagger # container name specified in circle.yml
@ -20,15 +22,12 @@ if [ "$NODE_INDEX" = "1" ]; then
mvn --no-snapshot-updates --quiet verify -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
echo "show ivy2 cache"
ls -l /home/circleci/.ivy2/cache
elif [ "$NODE_INDEX" = "2" ]; then
echo "Running node $NODE_INDEX to test haskell"
# install haskell
curl -sSL https://get.haskellstack.org/ | sh
stack upgrade
stack --version
#curl -sSLk https://get.haskellstack.org/ | sh
#stack upgrade
#stack --version
# prepare r
sudo sh -c 'echo "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/" >> /etc/apt/sources.list'
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9

View File

@ -571,6 +571,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [Agoda](https://www.agoda.com/)
- [Allianz](https://www.allianz.com)
- [Angular.Schule](https://angular.schule/)
- [Aqovia](https://aqovia.com/)
- [Australia and New Zealand Banking Group (ANZ)](http://www.anz.com/)
- [ASKUL](https://www.askul.co.jp)
- [Arduino](https://www.arduino.cc/)
@ -611,6 +612,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [Here](https://developer.here.com/)
- [IBM](https://www.ibm.com/)
- [Instana](https://www.instana.com)
- [Interxion](https://www.interxion.com)
- [Inquisico](https://inquisico.com)
- [JustStar](https://www.juststarinfo.com)
- [k6.io](https://k6.io/)
@ -628,6 +630,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [Myworkout](https://myworkout.com)
- [NamSor](https://www.namsor.com/)
- [Neverfail](https://www.neverfail.com/)
- [NeuerEnergy](https://neuerenergy.com)
- [Nokia](https://www.nokia.com/)
- [Options Clearing Corporation (OCC)](https://www.theocc.com/)
- [Openet](https://www.openet.com/)
@ -825,6 +828,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- 2021-07-29 - [How To Rewrite a Huge Codebase](https://dzone.com/articles/how-to-rewrite-a-huge-code-base) by [Curtis Poe](https://dzone.com/users/4565446/publiusovidius.html)
- 2021-08-21 - [Generating Client APIs using Swagger Part 1](https://medium.com/@flowsquad/generating-client-apis-using-swagger-part-1-2d46f13f5e92) by [FlowSquad.io](https://medium.com/@flowsquad)
- 2021-09-11 - [Invoking AWS ParallelCluster API](https://docs.aws.amazon.com/parallelcluster/latest/ug/api-reference-v3.html) at [AWS ParallelCluster API official documentation](https://docs.aws.amazon.com/parallelcluster/latest/ug/api-reference-v3.html)
- 2021-10-02 - [How to Write Fewer Lines of Code with the OpenAPI Generator](https://hackernoon.com/how-to-write-fewer-lines-of-code-with-the-openapi-generator) by [Mikhail Alfa](https://hackernoon.com/u/alphamikle)
## [6 - About Us](#table-of-contents)

View File

@ -0,0 +1,11 @@
generatorName: dart-dio-next
outputDir: samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
typeMappings:
Client: "ModelClient"
File: "ModelFile"
EnumClass: "ModelEnumClass"
additionalProperties:
hideGenerationTimestamp: "true"
dioLibrary: "dio_http"

View File

@ -0,0 +1,11 @@
generatorName: swift5
outputDir: samples/client/petstore/swift5/asyncAwaitLibrary
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/swift5
generateAliasAsModel: true
additionalProperties:
responseAs: AsyncAwait
podAuthors: ""
podSummary: PetstoreClient
projectName: PetstoreClient
podHomepage: https://github.com/openapitools/openapi-generator

View File

@ -0,0 +1,4 @@
generatorName: typescript-axios
outputDir: samples/client/petstore/typescript-axios/builds/test-petstore
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/typescript-axios

View File

@ -24,7 +24,7 @@ The following generators are available:
* [dart](generators/dart.md)
* [dart-dio](generators/dart-dio.md)
* [dart-dio-next (experimental)](generators/dart-dio-next.md)
* [dart-jaguar](generators/dart-jaguar.md)
* [dart-jaguar (deprecated)](generators/dart-jaguar.md)
* [eiffel](generators/eiffel.md)
* [elixir](generators/elixir.md)
* [elm](generators/elm.md)

View File

@ -9,6 +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|
|dateLibrary|Specify Date library|<dl><dt>**core**</dt><dd>[DEFAULT] Dart core library (DateTime)</dd><dt>**timemachine**</dt><dd>Time Machine is date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.</dd></dl>|core|
|dioLibrary|Specify Dio library|<dl><dt>**dio_http**</dt><dd>dio_http 5.x</dd><dt>**dio**</dt><dd>[DEFAULT] dio 4.x</dd></dl>|dio|
|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|

View File

@ -40,7 +40,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>DateTime</li>
<li>array</li>
<li>bool</li>
<li>boolean</li>

View File

@ -39,7 +39,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>DateTime</li>
<li>\DateTime</li>
<li>\SplFileObject</li>
<li>array</li>
<li>bool</li>
<li>boolean</li>

View File

@ -39,7 +39,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>DateTime</li>
<li>\DateTime</li>
<li>\SplFileObject</li>
<li>array</li>
<li>bool</li>
<li>boolean</li>

View File

@ -40,7 +40,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>DateTime</li>
<li>array</li>
<li>bool</li>
<li>boolean</li>

View File

@ -39,7 +39,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>DateTime</li>
<li>\DateTime</li>
<li>\SplFileObject</li>
<li>array</li>
<li>bool</li>
<li>boolean</li>

View File

@ -40,7 +40,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>DateTime</li>
<li>\DateTime</li>
<li>\SplFileObject</li>
<li>array</li>
<li>bool</li>
<li>boolean</li>

View File

@ -45,6 +45,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>UploadedFile</li>
<li>\DateTime</li>
<li>array</li>
<li>bool</li>
<li>byte</li>

View File

@ -40,7 +40,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>DateTime</li>
<li>\DateTime</li>
<li>\SplFileObject</li>
<li>array</li>
<li>bool</li>
<li>boolean</li>

View File

@ -34,7 +34,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|projectName|Project name in Xcode| |null|
|readonlyProperties|Make properties readonly (default: false)| |null|
|removeMigrationProjectNameClass|Make properties removeMigrationProjectNameClass (default: false)| |null|
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift, Result, Combine are available.| |null|
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift, Result, Combine, AsyncAwait are available.| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|swiftPackagePath|Set a custom source path instead of OpenAPIClient/Classes/OpenAPIs.| |null|

View File

@ -13,7 +13,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|enumNameSuffix|Suffix that will be appended to all enum names.| |Enum|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
|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|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url of your private npmRepo in the package.json| |null|
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|

View File

@ -721,8 +721,9 @@ public class CodeGenMojo extends AbstractMojo {
getLog().warn("environmentVariables is deprecated and will be removed in version 5.1. Use globalProperties instead.");
}
for (String key : globalProperties.keySet()) {
String value = globalProperties.get(key);
for (Map.Entry<String, String> globalPropertiesEntry : globalProperties.entrySet()) {
String key = globalPropertiesEntry.getKey();
String value = globalPropertiesEntry.getValue();
if (value != null) {
configurator.addGlobalProperty(key, value);
}

View File

@ -132,8 +132,8 @@
</dependency>
<!-- Bean Validation API support -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>

View File

@ -161,6 +161,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
private boolean isModel;
private boolean hasRequiredVars;
private boolean hasDiscriminatorWithNonEmptyMapping;
private boolean isAnyType;
public String getAdditionalPropertiesType() {
return additionalPropertiesType;
@ -785,6 +786,30 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
this.hasDiscriminatorWithNonEmptyMapping = hasDiscriminatorWithNonEmptyMapping;
}
@Override
public boolean getIsString() { return isString; }
@Override
public void setIsString(boolean isString) {
this.isString = isString;
}
@Override
public boolean getIsNumber() { return isNumber; }
@Override
public void setIsNumber(boolean isNumber) {
this.isNumber = isNumber;
}
@Override
public boolean getIsAnyType() { return isAnyType; }
@Override
public void setIsAnyType(boolean isAnyType) {
this.isAnyType = isAnyType;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
@ -819,6 +844,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
isNull == that.isNull &&
hasValidation == that.hasValidation &&
hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() &&
getIsAnyType() == that.getIsAnyType() &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getUniqueItems() == that.getUniqueItems() &&
getExclusiveMinimum() == that.getExclusiveMinimum() &&
@ -895,7 +921,8 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
getAdditionalPropertiesType(), getMaxProperties(), getMinProperties(), getUniqueItems(), getMaxItems(),
getMinItems(), getMaxLength(), getMinLength(), getExclusiveMinimum(), getExclusiveMaximum(), getMinimum(),
getMaximum(), getPattern(), getMultipleOf(), getItems(), getAdditionalProperties(), getIsModel(),
getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping, anyOfProps, oneOfProps, allOfProps);
getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping, anyOfProps, oneOfProps, allOfProps,
isAnyType);
}
@Override
@ -989,6 +1016,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
sb.append(", hasValidation='").append(hasValidation);
sb.append(", getAdditionalPropertiesIsAnyType=").append(getAdditionalPropertiesIsAnyType());
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
sb.append(", getIsAnyType=").append(getIsAnyType());
sb.append('}');
return sb.toString();
}

View File

@ -682,5 +682,29 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
public void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping) {
this.hasDiscriminatorWithNonEmptyMapping = hasDiscriminatorWithNonEmptyMapping;
}
@Override
public boolean getIsString() { return isString; }
@Override
public void setIsString(boolean isString) {
this.isString = isString;
}
@Override
public boolean getIsNumber() { return isNumber; }
@Override
public void setIsNumber(boolean isNumber) {
this.isNumber = isNumber;
}
@Override
public boolean getIsAnyType() { return isAnyType; }
@Override
public void setIsAnyType(boolean isAnyType) {
this.isAnyType = isAnyType;
}
}

View File

@ -763,6 +763,30 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
this.hasDiscriminatorWithNonEmptyMapping = hasDiscriminatorWithNonEmptyMapping;
}
@Override
public boolean getIsString() { return isString; }
@Override
public void setIsString(boolean isString) {
this.isString = isString;
}
@Override
public boolean getIsNumber() { return isNumber; }
@Override
public void setIsNumber(boolean isNumber) {
this.isNumber = isNumber;
}
@Override
public boolean getIsAnyType() { return isAnyType; }
@Override
public void setIsAnyType(boolean isAnyType) {
this.isAnyType = isAnyType;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenProperty{");

View File

@ -546,4 +546,28 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
public void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping) {
this.hasDiscriminatorWithNonEmptyMapping = hasDiscriminatorWithNonEmptyMapping;
}
@Override
public boolean getIsString() { return isString; }
@Override
public void setIsString(boolean isString) {
this.isString = isString;
}
@Override
public boolean getIsNumber() { return isNumber; }
@Override
public void setIsNumber(boolean isNumber) {
this.isNumber = isNumber;
}
@Override
public boolean getIsAnyType() { return isAnyType; }
@Override
public void setIsAnyType(boolean isAnyType) {
this.isAnyType = isAnyType;
}
}

View File

@ -62,6 +62,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.time.ZonedDateTime;
import java.util.*;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -335,8 +336,9 @@ public class DefaultGenerator implements Generator {
private void generateModelTests(List<File> files, Map<String, Object> models, String modelName) throws IOException {
// to generate model test files
for (String templateName : config.modelTestTemplateFiles().keySet()) {
String suffix = config.modelTestTemplateFiles().get(templateName);
for (Map.Entry<String, String> configModelTestTemplateFilesEntry : config.modelTestTemplateFiles().entrySet()) {
String templateName = configModelTestTemplateFilesEntry.getKey();
String suffix = configModelTestTemplateFilesEntry.getValue();
String filename = config.modelTestFileFolder() + File.separator + config.toModelTestFilename(modelName) + suffix;
if (generateModelTests) {
@ -1055,8 +1057,9 @@ public class DefaultGenerator implements Generator {
if(paths == null) {
return ops;
}
for (String resourcePath : paths.keySet()) {
PathItem path = paths.get(resourcePath);
for (Map.Entry<String, PathItem> pathsEntry : paths.entrySet()) {
String resourcePath = pathsEntry.getKey();
PathItem path = pathsEntry.getValue();
processOperation(resourcePath, "get", path.getGet(), ops, path);
processOperation(resourcePath, "head", path.getHead(), ops, path);
processOperation(resourcePath, "put", path.getPut(), ops, path);
@ -1199,7 +1202,7 @@ public class DefaultGenerator implements Generator {
operations.put("operations", objs);
operations.put("package", config.apiPackage());
Set<String> allImports = new TreeSet<>();
Set<String> allImports = new ConcurrentSkipListSet<>();
for (CodegenOperation op : ops) {
allImports.addAll(op.imports);
}
@ -1267,8 +1270,9 @@ public class DefaultGenerator implements Generator {
objs.put("package", config.modelPackage());
List<Object> models = new ArrayList<>();
Set<String> allImports = new LinkedHashSet<>();
for (String key : definitions.keySet()) {
Schema schema = definitions.get(key);
for (Map.Entry<String, Schema> definitionsEntry : definitions.entrySet()) {
String key = definitionsEntry.getKey();
Schema schema = definitionsEntry.getValue();
if (schema == null)
throw new RuntimeException("schema cannot be null in processModels");
CodegenModel cm = config.fromModel(key, schema);
@ -1282,7 +1286,7 @@ public class DefaultGenerator implements Generator {
allImports.addAll(cm.imports);
}
objs.put("models", models);
Set<String> importSet = new TreeSet<>();
Set<String> importSet = new ConcurrentSkipListSet<>();
for (String nextImport : allImports) {
String mapping = config.importMapping().get(nextImport);
if (mapping == null) {

View File

@ -2,6 +2,9 @@ package org.openapitools.codegen;
import java.util.List;
import io.swagger.v3.oas.models.media.Schema;
import org.openapitools.codegen.utils.ModelUtils;
public interface IJsonSchemaValidationProperties {
String getPattern();
@ -71,6 +74,7 @@ public interface IJsonSchemaValidationProperties {
void setIsDateTime(boolean isDateTime);
// true when the schema type is object
boolean getIsMap();
void setIsMap(boolean isMap);
@ -128,4 +132,77 @@ public interface IJsonSchemaValidationProperties {
// discriminators are only supported in request bodies and response payloads per OpenApi
void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping);
boolean getIsString();
void setIsString(boolean isNumber);
boolean getIsNumber();
void setIsNumber(boolean isNumber);
boolean getIsAnyType();
void setIsAnyType(boolean isAnyType);
/**
* Syncs all the schema's type properties into the IJsonSchemaValidationProperties instance
* for now this only supports types without format information
* TODO: in the future move the format handling in here too
* @param p the schema which contains the type info
*/
default void setTypeProperties(Schema p) {
if (ModelUtils.isTypeObjectSchema(p)) {
setIsMap(true);
} else if (ModelUtils.isArraySchema(p)) {
setIsArray(true);
} else if (ModelUtils.isFileSchema(p) && !ModelUtils.isStringSchema(p)) {
// swagger v2 only, type file
;
} else if (ModelUtils.isStringSchema(p)) {
setIsString(true);
if (ModelUtils.isByteArraySchema(p)) {
;
} else if (ModelUtils.isBinarySchema(p)) {
// openapi v3 way of representing binary + file data
// for backward compatibility with 2.x file type
setIsString(false);
} else if (ModelUtils.isUUIDSchema(p)) {
// keep isString to true to make it backward compatible
;
} else if (ModelUtils.isURISchema(p)) {
;
} else if (ModelUtils.isEmailSchema(p)) {
;
} else if (ModelUtils.isDateSchema(p)) {
;
} else if (ModelUtils.isDateTimeSchema(p)) {
;
} else if (ModelUtils.isDecimalSchema(p)) { // type: string, format: number
;
}
} else if (ModelUtils.isNumberSchema(p)) {
if (ModelUtils.isFloatSchema(p)) { // float
;
} else if (ModelUtils.isDoubleSchema(p)) { // double
;
} else { // type is number and without format
setIsNumber(true);
}
} else if (ModelUtils.isIntegerSchema(p)) { // integer type
if (ModelUtils.isLongSchema(p)) { // int64/long format
;
} else if (ModelUtils.isShortSchema(p)) { // int32/short format
;
} else { // unbounded integer
setIsUnboundedInteger(true);
}
} else if (ModelUtils.isBooleanSchema(p)) { // boolean type
setIsBoolean(true);
} else if (ModelUtils.isNullType(p)) {
setIsNull(true);
} else if (ModelUtils.isAnyType(p)) {
setIsAnyType(true);
}
}
}

View File

@ -79,8 +79,9 @@ public class InlineModelResolver {
return;
}
for (String pathname : paths.keySet()) {
PathItem path = paths.get(pathname);
for (Map.Entry<String, PathItem> pathsEntry : paths.entrySet()) {
String pathname = pathsEntry.getKey();
PathItem path = pathsEntry.getValue();
List<Operation> operations = new ArrayList<>(path.readOperations());
// Include callback operation as well
@ -263,8 +264,9 @@ public class InlineModelResolver {
return;
}
for (String key : responses.keySet()) {
ApiResponse response = responses.get(key);
for (Map.Entry<String, ApiResponse> responsesEntry : responses.entrySet()) {
String key = responsesEntry.getKey();
ApiResponse response = responsesEntry.getValue();
if (ModelUtils.getSchemaFromResponse(response) == null) {
continue;
}
@ -561,8 +563,9 @@ public class InlineModelResolver {
}
Map<String, Schema> propsToUpdate = new HashMap<String, Schema>();
Map<String, Schema> modelsToAdd = new HashMap<String, Schema>();
for (String key : properties.keySet()) {
Schema property = properties.get(key);
for (Map.Entry<String, Schema> propertiesEntry : properties.entrySet()) {
String key = propertiesEntry.getKey();
Schema property = propertiesEntry.getValue();
if (property instanceof ObjectSchema && ((ObjectSchema) property).getProperties() != null
&& ((ObjectSchema) property).getProperties().size() > 0) {
ObjectSchema op = (ObjectSchema) property;

View File

@ -81,8 +81,9 @@ public class XmlExampleGenerator {
// TODO: map objects will not enter this block
Map<String, Schema> properties = schema.getProperties();
if (properties != null && !properties.isEmpty()) {
for (String pName : properties.keySet()) {
Schema property = properties.get(pName);
for (Map.Entry<String, Schema> propertiesEntry : properties.entrySet()) {
String pName = propertiesEntry.getKey();
Schema property = propertiesEntry.getValue();
if (property != null && property.getXml() != null && property.getXml().getAttribute() != null && property.getXml().getAttribute()) {
attributes.put(pName, property);
} else {
@ -93,14 +94,16 @@ public class XmlExampleGenerator {
sb.append(indent(indent)).append(TAG_START);
sb.append(name);
for (String pName : attributes.keySet()) {
Schema s = attributes.get(pName);
for (Map.Entry<String, Schema> attributesEntry : attributes.entrySet()) {
String pName = attributesEntry.getKey();
Schema s = attributesEntry.getValue();
sb.append(" ").append(pName).append("=").append(quote(toXml(null, s, 0, selfPath)));
}
sb.append(CLOSE_TAG);
sb.append(NEWLINE);
for (String pName : elements.keySet()) {
Schema s = elements.get(pName);
for (Map.Entry<String, Schema> elementsEntry : elements.entrySet()) {
String pName = elementsEntry.getKey();
Schema s = elementsEntry.getValue();
final String asXml = toXml(pName, s, indent + 1, selfPath);
if (StringUtils.isEmpty(asXml)) {
continue;

View File

@ -401,7 +401,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
if (ref != null && !ref.isEmpty()) {
type = toModelName(openAPIType);
} else if ("object".equals(openAPIType) && isAnyTypeSchema(p)) {
} else if ("object".equals(openAPIType) && ModelUtils.isAnyType(p)) {
// Arbitrary type. Note this is not the same thing as free-form object.
type = "interface{}";
} else if (typeMapping.containsKey(openAPIType)) {

View File

@ -40,6 +40,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.regex.Pattern;
import java.util.stream.Stream;
@ -1338,7 +1339,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 TreeSet<String>();
Collection<String> operationImports = new ConcurrentSkipListSet<String>();
for (CodegenParameter p : op.allParams) {
if (importMapping.containsKey(p.dataType)) {
operationImports.add(importMapping.get(p.dataType));
@ -1356,8 +1357,9 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
return;
}
if (openAPI.getPaths() != null) {
for (String pathname : openAPI.getPaths().keySet()) {
PathItem path = openAPI.getPaths().get(pathname);
for (Map.Entry<String, PathItem> openAPIGetPathsEntry : openAPI.getPaths().entrySet()) {
String pathname = openAPIGetPathsEntry.getKey();
PathItem path = openAPIGetPathsEntry.getValue();
if (path.readOperations() == null) {
continue;
}

View File

@ -142,8 +142,9 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
}
if (openAPI.getPaths() != null) {
for (String pathname : openAPI.getPaths().keySet()) {
PathItem path = openAPI.getPaths().get(pathname);
for (Map.Entry<String, PathItem> openAPIGetPathsEntry : openAPI.getPaths().entrySet()) {
String pathname = openAPIGetPathsEntry.getKey();
PathItem path = openAPIGetPathsEntry.getValue();
if (path.readOperations() != null) {
for (Operation operation : path.readOperations()) {
if (operation.getTags() != null) {

View File

@ -90,7 +90,8 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
"string",
"object",
"array",
"DateTime",
"\\DateTime",
"\\SplFileObject",
"mixed",
"number",
"void",
@ -111,6 +112,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
typeMapping.put("long", "int");
typeMapping.put("number", "float");
typeMapping.put("float", "float");
typeMapping.put("decimal", "float");
typeMapping.put("double", "double");
typeMapping.put("string", "string");
typeMapping.put("byte", "int");
@ -341,6 +343,12 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
public String getSchemaType(Schema p) {
String openAPIType = super.getSchemaType(p);
String type = null;
if (openAPIType == null) {
LOGGER.error("OpenAPI Type for {} is null. Default to UNKNOWN_OPENAPI_TYPE instead.", p.getName());
openAPIType = "UNKNOWN_OPENAPI_TYPE";
}
if (typeMapping.containsKey(openAPIType)) {
type = typeMapping.get(openAPIType);
if (languageSpecificPrimitives.contains(type)) {
@ -348,12 +356,18 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
} else if (instantiationTypes.containsKey(type)) {
return type;
}
/*
// comment out the following as php-dt, php-mezzio still need to treat DateTime, SplFileObject as objects
} else {
throw new RuntimeException("OpenAPI type `" + openAPIType + "` defined but can't mapped to language type." +
" Please report the issue via OpenAPI Generator github repo." +
" (if you're not using custom format with proper type mappings provided to openapi-generator)");
}
*/
} else {
type = openAPIType;
}
if (type == null) {
return null;
}
return toModelName(type);
}
@ -790,4 +804,9 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
return packageName;
}
@Override
public boolean isDataTypeString(String dataType) {
return "string".equals(dataType);
}
}

View File

@ -332,7 +332,7 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
PathItem path = paths.get(pathname);
// Fix path parameters to be in snake_case
if (pathname.contains("{")) {
String fixedPath = new String();
String fixedPath = "";
for (String token : pathname.substring(1).split("/")) {
if (token.startsWith("{")) {
String snake_case_token = "{" + this.toParamName(token.substring(1, token.length() - 1)) + "}";
@ -353,8 +353,9 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
}
Map<HttpMethod, Operation> operationMap = path.readOperationsMap();
if (operationMap != null) {
for (HttpMethod method : operationMap.keySet()) {
Operation operation = operationMap.get(method);
for (Map.Entry<HttpMethod, Operation> operationMapEntry : operationMap.entrySet()) {
HttpMethod method = operationMapEntry.getKey();
Operation operation = operationMapEntry.getValue();
String tag = "default";
if (operation.getTags() != null && operation.getTags().size() > 0) {
tag = operation.getTags().get(0);
@ -424,8 +425,9 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
Components components = openAPI.getComponents();
if (components != null && components.getSecuritySchemes() != null) {
Map<String, SecurityScheme> securitySchemes = components.getSecuritySchemes();
for (String securityName : securitySchemes.keySet()) {
SecurityScheme securityScheme = securitySchemes.get(securityName);
for (Map.Entry<String, SecurityScheme> securitySchemesEntry : securitySchemes.entrySet()) {
String securityName = securitySchemesEntry.getKey();
SecurityScheme securityScheme = securitySchemesEntry.getValue();
String baseFunctionName = controllerPackage + ".security_controller_.";
switch (securityScheme.getType()) {
case APIKEY:
@ -512,8 +514,9 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
Map<HttpMethod, Operation> operationMap = path.readOperationsMap();
if (operationMap != null) {
for (HttpMethod method : operationMap.keySet()) {
Operation operation = operationMap.get(method);
for (Map.Entry<HttpMethod, Operation> operationMapEntry : operationMap.entrySet()) {
HttpMethod method = operationMapEntry.getKey();
Operation operation = operationMapEntry.getValue();
if (operation.getParameters() != null) {
for (Parameter parameter : operation.getParameters()) {
Map<String, Object> parameterExtensions = parameter.getExtensions();

View File

@ -78,6 +78,7 @@ abstract public class AbstractRubyCodegen extends DefaultCodegen implements Code
typeMapping.put("float", "Float");
typeMapping.put("double", "Float");
typeMapping.put("number", "Float");
typeMapping.put("decimal", "Float");
typeMapping.put("date", "Date");
typeMapping.put("DateTime", "Time");
typeMapping.put("array", "Array");

View File

@ -546,7 +546,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
return UNDEFINED_VALUE;
} else if (ModelUtils.isStringSchema(p)) {
if (p.getDefault() != null) {
return "'" + (String) p.getDefault() + "'";
return "'" + escapeText((String) p.getDefault()) + "'";
}
return UNDEFINED_VALUE;
} else {

View File

@ -19,6 +19,7 @@ package org.openapitools.codegen.languages;
import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Mustache;
import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.ComposedSchema;
import io.swagger.v3.oas.models.media.Schema;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.*;
@ -1128,4 +1129,30 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
System.out.println("# Please support his work directly via https://patreon.com/jimschubert \uD83D\uDE4F #");
System.out.println("################################################################################");
}
@Override
protected void updateModelForObject(CodegenModel m, Schema schema) {
/**
* we have a custom version of this function so we only set isMap to true if
* ModelUtils.isMapSchema
* In other generators, isMap is true for all type object schemas
*/
if (schema.getProperties() != null || schema.getRequired() != null && !(schema instanceof ComposedSchema)) {
// passing null to allProperties and allRequired as there's no parent
addVars(m, unaliasPropertySchema(schema.getProperties()), schema.getRequired(), null, null);
}
if (ModelUtils.isMapSchema(schema)) {
// an object or anyType composed schema that has additionalProperties set
addAdditionPropertiesToCodeGenModel(m, schema);
} else {
m.setIsMap(false);
if (ModelUtils.isFreeFormObject(openAPI, schema)) {
// non-composed object type with no properties + additionalProperties
// additionalProperties must be null, ObjectSchema, or empty Schema
addAdditionPropertiesToCodeGenModel(m, schema);
}
}
// process 'additionalProperties'
setAddProps(schema, m);
}
}

View File

@ -39,6 +39,11 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
private final Logger LOGGER = LoggerFactory.getLogger(DartDioNextClientCodegen.class);
public static final String DIO_LIBRARY = "dioLibrary";
public static final String DIO_ORIGINAL = "dio";
public static final String DIO_HTTP = "dio_http";
public static final String DIO_LIBRARY_DEFAULT = DIO_ORIGINAL;
public static final String DATE_LIBRARY = "dateLibrary";
public static final String DATE_LIBRARY_CORE = "core";
public static final String DATE_LIBRARY_TIME_MACHINE = "timemachine";
@ -47,11 +52,13 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
public static final String SERIALIZATION_LIBRARY_BUILT_VALUE = "built_value";
public static final String SERIALIZATION_LIBRARY_DEFAULT = SERIALIZATION_LIBRARY_BUILT_VALUE;
private static final String DIO_IMPORT = "package:dio/dio.dart";
private static final String CLIENT_NAME = "clientName";
private String dateLibrary;
private String dioLibrary;
private String dioImport;
private String clientName;
public DartDioNextClientCodegen() {
@ -80,6 +87,7 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
serializationLibrary.setDefault(SERIALIZATION_LIBRARY_DEFAULT);
cliOptions.add(serializationLibrary);
// Date Library Option
final CliOption dateOption = CliOption.newString(DATE_LIBRARY, "Specify Date library");
dateOption.setDefault(DATE_LIBRARY_DEFAULT);
@ -88,6 +96,16 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
dateOptions.put(DATE_LIBRARY_TIME_MACHINE, "Time Machine is date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.");
dateOption.setEnum(dateOptions);
cliOptions.add(dateOption);
// Dio Library Option
final CliOption dioOption = CliOption.newString(DIO_LIBRARY, "Specify Dio library");
dioOption.setDefault(DIO_LIBRARY_DEFAULT);
final Map<String, String> dioOptions = new HashMap<>();
dioOptions.put(DIO_ORIGINAL, "[DEFAULT] dio 4.x");
dioOptions.put(DIO_HTTP, "dio_http 5.x");
dioOption.setEnum(dioOptions);
cliOptions.add(dioOption);
}
public String getDateLibrary() {
@ -98,6 +116,14 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
this.dateLibrary = library;
}
public String getDioLibrary() {
return dioLibrary;
}
public void setDioLibrary(String library) {
this.dioLibrary = library;
}
public String getClientName() {
return clientName;
}
@ -137,6 +163,12 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
}
setDateLibrary(additionalProperties.get(DATE_LIBRARY).toString());
if (!additionalProperties.containsKey(DIO_LIBRARY)) {
additionalProperties.put(DIO_LIBRARY, DIO_LIBRARY_DEFAULT);
LOGGER.debug("Dio library not set, using default {}", DIO_LIBRARY_DEFAULT);
}
setDioLibrary(additionalProperties.get(DIO_LIBRARY).toString());
if (!additionalProperties.containsKey(CLIENT_NAME)) {
final String name = org.openapitools.codegen.utils.StringUtils.camelize(pubName);
additionalProperties.put(CLIENT_NAME, name);
@ -162,15 +194,31 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
supportingFiles.add(new SupportingFile("auth/oauth.mustache", authFolder, "oauth.dart"));
supportingFiles.add(new SupportingFile("auth/auth.mustache", authFolder, "auth.dart"));
configureDioLibrary();
configureSerializationLibrary(srcFolder);
configureDateLibrary(srcFolder);
}
private void configureDioLibrary() {
switch (dioLibrary) {
case DIO_HTTP:
dioImport = "package:dio_http/dio_http.dart";
break;
case DIO_ORIGINAL:
default:
dioImport = "package:dio/dio.dart";
break;
}
}
private void configureSerializationLibrary(String srcFolder) {
switch (library) {
default:
case SERIALIZATION_LIBRARY_BUILT_VALUE:
additionalProperties.put("useBuiltValue", "true");
additionalProperties.put("useDioHttp", dioLibrary.equals(DIO_HTTP));
additionalProperties.put("dioImport", dioImport);
additionalProperties.put("dioLibrary", dioLibrary);
configureSerializationLibraryBuiltValue(srcFolder);
break;
}
@ -195,7 +243,7 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
imports.put("BuiltMap", "package:built_collection/built_collection.dart");
imports.put("JsonObject", "package:built_value/json_object.dart");
imports.put("Uint8List", "dart:typed_data");
imports.put("MultipartFile", DIO_IMPORT);
imports.put("MultipartFile", dioImport);
}
private void configureDateLibrary(String srcFolder) {
@ -367,7 +415,7 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
for (String modelImport : originalImports) {
if (imports.containsKey(modelImport)) {
String i = imports.get(modelImport);
if (Objects.equals(i, DIO_IMPORT) && !isModel) {
if (Objects.equals(i, dioImport) && !isModel) {
// Don't add imports to operations that are already imported
continue;
}

View File

@ -17,6 +17,8 @@
package org.openapitools.codegen.languages;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.utils.ModelUtils;
@ -88,6 +90,10 @@ public class DartJaguarClientCodegen extends AbstractDartCodegen {
)
);
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
.stability(Stability.DEPRECATED)
.build();
outputFolder = "generated-code/dart-jaguar";
embeddedTemplateDir = templateDir = "dart-jaguar";

View File

@ -17,8 +17,11 @@
package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.media.ComposedSchema;
import io.swagger.v3.oas.models.media.Schema;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -359,4 +362,30 @@ public class GoServerCodegen extends AbstractGoCodegen {
public void setAddResponseHeaders(Boolean addResponseHeaders) {
this.addResponseHeaders = addResponseHeaders;
}
@Override
protected void updateModelForObject(CodegenModel m, Schema schema) {
/**
* we have a custom version of this function so we only set isMap to true if
* ModelUtils.isMapSchema
* In other generators, isMap is true for all type object schemas
*/
if (schema.getProperties() != null || schema.getRequired() != null && !(schema instanceof ComposedSchema)) {
// passing null to allProperties and allRequired as there's no parent
addVars(m, unaliasPropertySchema(schema.getProperties()), schema.getRequired(), null, null);
}
if (ModelUtils.isMapSchema(schema)) {
// an object or anyType composed schema that has additionalProperties set
addAdditionPropertiesToCodeGenModel(m, schema);
} else {
m.setIsMap(false);
if (ModelUtils.isFreeFormObject(openAPI, schema)) {
// non-composed object type with no properties + additionalProperties
// additionalProperties must be null, ObjectSchema, or empty Schema
addAdditionPropertiesToCodeGenModel(m, schema);
}
}
// process 'additionalProperties'
setAddProps(schema, m);
}
}

View File

@ -32,6 +32,7 @@ import java.io.File;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Map;
public class JMeterClientCodegen extends DefaultCodegen implements CodegenConfig {
@ -149,8 +150,9 @@ public class JMeterClientCodegen extends DefaultCodegen implements CodegenConfig
@Override
public void preprocessOpenAPI(OpenAPI openAPI) {
if (openAPI != null && openAPI.getPaths() != null) {
for (String pathname : openAPI.getPaths().keySet()) {
PathItem path = openAPI.getPaths().get(pathname);
for (Map.Entry<String, PathItem> openAPIGetPathsEntry : openAPI.getPaths().entrySet()) {
String pathname = openAPIGetPathsEntry.getKey();
PathItem path = openAPIGetPathsEntry.getValue();
if (path.readOperations() != null) {
for (Operation operation : path.readOperations()) {
String pathWithDollars = pathname.replaceAll("\\{", "\\$\\{");

View File

@ -17,15 +17,20 @@
package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.media.ComposedSchema;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.languages.features.CXFServerFeatures;
import org.openapitools.codegen.languages.features.GzipTestFeatures;
import org.openapitools.codegen.languages.features.LoggingTestFeatures;
import org.openapitools.codegen.languages.features.UseGenericResponseFeatures;
import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.Set;
public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
implements CXFServerFeatures, GzipTestFeatures, LoggingTestFeatures, UseGenericResponseFeatures {
@ -124,7 +129,6 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
}
@Override
public void processOpts() {
super.processOpts();
@ -328,4 +332,29 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
this.useGenericResponse = useGenericResponse;
}
@Override
protected void updateModelForObject(CodegenModel m, Schema schema) {
/**
* we have a custom version of this function so we only set isMap to true if
* ModelUtils.isMapSchema
* In other generators, isMap is true for all type object schemas
*/
if (schema.getProperties() != null || schema.getRequired() != null && !(schema instanceof ComposedSchema)) {
// passing null to allProperties and allRequired as there's no parent
addVars(m, unaliasPropertySchema(schema.getProperties()), schema.getRequired(), null, null);
}
if (ModelUtils.isMapSchema(schema)) {
// an object or anyType composed schema that has additionalProperties set
addAdditionPropertiesToCodeGenModel(m, schema);
} else {
m.setIsMap(false);
if (ModelUtils.isFreeFormObject(openAPI, schema)) {
// non-composed object type with no properties + additionalProperties
// additionalProperties must be null, ObjectSchema, or empty Schema
addAdditionPropertiesToCodeGenModel(m, schema);
}
}
// process 'additionalProperties'
setAddProps(schema, m);
}
}

View File

@ -543,8 +543,9 @@ public class JavaPKMSTServerCodegen extends AbstractJavaCodegen {
this.additionalProperties.put("serverPort", URLPathUtils.getPort(url, 8080));
if (openAPI.getPaths() != null) {
for (String pathname : openAPI.getPaths().keySet()) {
PathItem path = openAPI.getPaths().get(pathname);
for (Map.Entry<String, PathItem> openAPIGetPathsEntry : openAPI.getPaths().entrySet()) {
String pathname = openAPIGetPathsEntry.getKey();
PathItem path = openAPIGetPathsEntry.getValue();
if (path.readOperations() != null) {
for (Operation operation : path.readOperations()) {
if (operation.getTags() != null) {

View File

@ -360,12 +360,14 @@ public class NodeJSExpressServerCodegen extends DefaultCodegen implements Codege
// need vendor extensions
Paths paths = openAPI.getPaths();
if (paths != null) {
for (String pathname : paths.keySet()) {
PathItem path = paths.get(pathname);
for (Map.Entry<String, PathItem> pathsEntry : paths.entrySet()) {
String pathname = pathsEntry.getKey();
PathItem path = pathsEntry.getValue();
Map<HttpMethod, Operation> operationMap = path.readOperationsMap();
if (operationMap != null) {
for (HttpMethod method : operationMap.keySet()) {
Operation operation = operationMap.get(method);
for (Map.Entry<HttpMethod, Operation> operationMapEntry : operationMap.entrySet()) {
HttpMethod method = operationMapEntry.getKey();
Operation operation = operationMapEntry.getValue();
String tag = "default";
if (operation.getTags() != null && operation.getTags().size() > 0) {
tag = toApiName(operation.getTags().get(0));

View File

@ -300,8 +300,9 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
@SuppressWarnings("unchecked")
private void collectEnumSchemas(String parentName, Map<String, Schema> schemas) {
for (String sName : schemas.keySet()) {
Schema schema = schemas.get(sName);
for (Map.Entry<String, Schema> schemasEntry : schemas.entrySet()) {
String sName = schemasEntry.getKey();
Schema schema = schemasEntry.getValue();
collectEnumSchemas(parentName, sName, schema);
@ -339,8 +340,9 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
}
}
if (operation.getResponses() != null) {
for (String s : operation.getResponses().keySet()) {
ApiResponse apiResponse = operation.getResponses().get(s);
for (Map.Entry<String, ApiResponse> operationGetResponsesEntry : operation.getResponses().entrySet()) {
String s = operationGetResponsesEntry.getKey();
ApiResponse apiResponse = operationGetResponsesEntry.getValue();
if (apiResponse.getContent() != null) {
Content content = apiResponse.getContent();
for (String p : content.keySet()) {
@ -349,8 +351,9 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
}
if (apiResponse.getHeaders() != null) {
Map<String, Header> headers = apiResponse.getHeaders();
for (String h : headers.keySet()) {
Header header = headers.get(h);
for (Map.Entry<String, Header> headersEntry : headers.entrySet()) {
String h = headersEntry.getKey();
Header header = headersEntry.getValue();
collectEnumSchemas(h, header.getSchema());
}
}
@ -404,8 +407,9 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
Paths paths = openAPI.getPaths();
if (paths != null && !paths.isEmpty()) {
for (String path : paths.keySet()) {
PathItem item = paths.get(path);
for (Map.Entry<String, PathItem> pathsEntry : paths.entrySet()) {
String path = pathsEntry.getKey();
PathItem item = pathsEntry.getValue();
collectEnumSchemas(item.getGet());
collectEnumSchemas(item.getPost());
collectEnumSchemas(item.getPut());

View File

@ -95,6 +95,10 @@ public class PhpDataTransferClientCodegen extends AbstractPhpCodegen {
//no point to use double - http://php.net/manual/en/language.types.float.php , especially because of PHP 7+ float type declaration
typeMapping.put("double", "float");
// remove these from primitive types to make the output works
languageSpecificPrimitives.remove("\\DateTime");
languageSpecificPrimitives.remove("\\SplFileObject");
apiTemplateFiles.clear();
apiTestTemplateFiles.clear();
apiDocTemplateFiles.clear();
@ -197,12 +201,14 @@ public class PhpDataTransferClientCodegen extends AbstractPhpCodegen {
protected void generateParameterSchemas(OpenAPI openAPI) {
Map<String, PathItem> paths = openAPI.getPaths();
if (paths != null) {
for (String pathname : paths.keySet()) {
PathItem path = paths.get(pathname);
for (Map.Entry<String, PathItem> pathsEntry : paths.entrySet()) {
String pathname = pathsEntry.getKey();
PathItem path = pathsEntry.getValue();
Map<HttpMethod, Operation> operationMap = path.readOperationsMap();
if (operationMap != null) {
for (HttpMethod method : operationMap.keySet()) {
Operation operation = operationMap.get(method);
for (Map.Entry<HttpMethod, Operation> operationMapEntry : operationMap.entrySet()) {
HttpMethod method = operationMapEntry.getKey();
Operation operation = operationMapEntry.getValue();
Map<String, Schema> propertySchemas = new HashMap<>();
if (operation == null || operation.getParameters() == null) {
continue;
@ -420,8 +426,9 @@ public class PhpDataTransferClientCodegen extends AbstractPhpCodegen {
protected void quoteMediaTypes(OpenAPI openAPI) {
Map<String, PathItem> paths = openAPI.getPaths();
if (paths != null) {
for (String pathname : paths.keySet()) {
PathItem path = paths.get(pathname);
for (Map.Entry<String, PathItem> pathsEntry : paths.entrySet()) {
String pathname = pathsEntry.getKey();
PathItem path = pathsEntry.getValue();
List<Operation> operations = path.readOperations();
if (operations != null) {
for (Operation operation : operations) {

View File

@ -87,6 +87,10 @@ public class PhpMezzioPathHandlerServerCodegen extends AbstractPhpCodegen {
//no point to use double - http://php.net/manual/en/language.types.float.php , especially because of PHP 7+ float type declaration
typeMapping.put("double", "float");
// remove these from primitive types to make the output works
languageSpecificPrimitives.remove("\\DateTime");
languageSpecificPrimitives.remove("\\SplFileObject");
embeddedTemplateDir = templateDir = "php-mezzio-ph";
invokerPackage = "App";
srcBasePath = "src" + File.separator + "App";
@ -193,12 +197,14 @@ public class PhpMezzioPathHandlerServerCodegen extends AbstractPhpCodegen {
protected void generateParameterSchemas(OpenAPI openAPI) {
Map<String, PathItem> paths = openAPI.getPaths();
if (paths != null) {
for (String pathname : paths.keySet()) {
PathItem path = paths.get(pathname);
for (Map.Entry<String, PathItem> pathsEntry : paths.entrySet()) {
String pathname = pathsEntry.getKey();
PathItem path = pathsEntry.getValue();
Map<HttpMethod, Operation> operationMap = path.readOperationsMap();
if (operationMap != null) {
for (HttpMethod method : operationMap.keySet()) {
Operation operation = operationMap.get(method);
for (Map.Entry<HttpMethod, Operation> operationMapEntry : operationMap.entrySet()) {
HttpMethod method = operationMapEntry.getKey();
Operation operation = operationMapEntry.getValue();
Map<String, Schema> propertySchemas = new HashMap<>();
if (operation == null || operation.getParameters() == null) {
continue;

View File

@ -151,7 +151,9 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg
"number",
"void",
"byte",
"array"
"array",
"\\DateTime",
"UploadedFile"
)
);
@ -174,6 +176,7 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg
typeMapping = new HashMap<String, String>();
typeMapping.put("integer", "int");
typeMapping.put("long", "int");
typeMapping.put("decimal", "float");
typeMapping.put("number", "float");
typeMapping.put("float", "float");
typeMapping.put("double", "double");

View File

@ -515,6 +515,7 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
typeMapping.put("long", "Int64");
typeMapping.put("double", "Double");
typeMapping.put("number", "Decimal");
typeMapping.put("decimal", "Decimal");
typeMapping.put("object", "System.Collections.Hashtable");
typeMapping.put("file", "System.IO.FileInfo");
typeMapping.put("ByteArray", "System.Byte[]");

View File

@ -849,7 +849,7 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
return prefix + modelName + fullSuffix;
}
}
if (isAnyTypeSchema(p)) {
if (ModelUtils.isAnyType(p)) {
// for v2 specs only, swagger-parser never generates an AnyType schemas even though it should generate them
// https://github.com/swagger-api/swagger-parser/issues/1378
// switch to v3 if you need AnyType to work
@ -1115,7 +1115,7 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
}
String refModelName = getModelName(schema);
return toExampleValueRecursive(refModelName, refSchema, objExample, indentationLevel, prefix, exampleLine, seenSchemas);
} else if (ModelUtils.isNullType(schema) || isAnyTypeSchema(schema)) {
} else if (ModelUtils.isNullType(schema) || ModelUtils.isAnyType(schema)) {
// The 'null' type is allowed in OAS 3.1 and above. It is not supported by OAS 3.0.x,
// though this tooling supports it.
return fullPrefix + "None" + closeChars;

View File

@ -133,6 +133,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
typeMapping.put("number", "numeric");
typeMapping.put("float", "numeric");
typeMapping.put("double", "numeric");
typeMapping.put("decimal", "numeric");
typeMapping.put("boolean", "character");
typeMapping.put("string", "character");
typeMapping.put("UUID", "character");

View File

@ -672,6 +672,12 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
private String constructExampleCode(CodegenProperty codegenProperty, HashMap<String, CodegenModel> modelMaps, HashMap<String, Integer> processedModelMap) {
if (codegenProperty.isArray) { // array
if (!StringUtils.isEmpty(codegenProperty.example) && !"null".equals(codegenProperty.example)) {
String value = codegenProperty.example;
value = value.replaceAll(",", ", ");
value = value.replaceAll(":", ": ");
return value;
}
return "[" + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + "]";
} else if (codegenProperty.isMap) {
return "{ key: " + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + "}";

View File

@ -1681,4 +1681,93 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
}
}
}
@Override
protected void updateRequestBodyForString(CodegenParameter codegenParameter, Schema schema, Set<String> imports, String bodyParameterName) {
/**
* we have a custom version of this function to set isString to false for isByteArray
*/
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
if (ModelUtils.isByteArraySchema(schema)) {
codegenParameter.isByteArray = true;
// custom code
codegenParameter.setIsString(false);
} else if (ModelUtils.isBinarySchema(schema)) {
codegenParameter.isBinary = true;
codegenParameter.isFile = true; // file = binary in OAS3
} else if (ModelUtils.isUUIDSchema(schema)) {
codegenParameter.isUuid = true;
} else if (ModelUtils.isURISchema(schema)) {
codegenParameter.isUri = true;
} else if (ModelUtils.isEmailSchema(schema)) {
codegenParameter.isEmail = true;
} else if (ModelUtils.isDateSchema(schema)) { // date format
codegenParameter.setIsString(false); // for backward compatibility with 2.x
codegenParameter.isDate = true;
} else if (ModelUtils.isDateTimeSchema(schema)) { // date-time format
codegenParameter.setIsString(false); // for backward compatibility with 2.x
codegenParameter.isDateTime = true;
} else if (ModelUtils.isDecimalSchema(schema)) { // type: string, format: number
codegenParameter.isDecimal = true;
codegenParameter.setIsString(false);
}
codegenParameter.pattern = toRegularExpression(schema.getPattern());
}
@Override
protected void updateParameterForString(CodegenParameter codegenParameter, Schema parameterSchema){
/**
* we have a custom version of this function to set isString to false for uuid
*/
if (ModelUtils.isEmailSchema(parameterSchema)) {
codegenParameter.isEmail = true;
} else if (ModelUtils.isUUIDSchema(parameterSchema)) {
codegenParameter.setIsString(false);
codegenParameter.isUuid = true;
} else if (ModelUtils.isByteArraySchema(parameterSchema)) {
codegenParameter.setIsString(false);
codegenParameter.isByteArray = true;
codegenParameter.isPrimitiveType = true;
} else if (ModelUtils.isBinarySchema(parameterSchema)) {
codegenParameter.isBinary = true;
codegenParameter.isFile = true; // file = binary in OAS3
codegenParameter.isPrimitiveType = true;
} else if (ModelUtils.isDateSchema(parameterSchema)) {
codegenParameter.setIsString(false); // for backward compatibility with 2.x
codegenParameter.isDate = true;
codegenParameter.isPrimitiveType = true;
} else if (ModelUtils.isDateTimeSchema(parameterSchema)) {
codegenParameter.setIsString(false); // for backward compatibility with 2.x
codegenParameter.isDateTime = true;
codegenParameter.isPrimitiveType = true;
} else if (ModelUtils.isDecimalSchema(parameterSchema)) { // type: string, format: number
codegenParameter.setIsString(false);
codegenParameter.isDecimal = true;
codegenParameter.isPrimitiveType = true;
}
if (Boolean.TRUE.equals(codegenParameter.isString)) {
codegenParameter.isPrimitiveType = true;
}
}
@Override
protected void updatePropertyForAnyType(CodegenProperty property, Schema p) {
/**
* we have a custom version of this function to not set isNullable to true
*/
// The 'null' value is allowed when the OAS schema is 'any type'.
// See https://github.com/OAI/OpenAPI-Specification/issues/1389
if (Boolean.FALSE.equals(p.getNullable())) {
LOGGER.warn("Schema '{}' is any type, which includes the 'null' value. 'nullable' cannot be set to 'false'", p.getName());
}
if (languageSpecificPrimitives.contains(property.dataType)) {
property.isPrimitiveType = true;
}
if (ModelUtils.isMapSchema(p)) {
// an object or anyType composed schema that has additionalProperties set
// some of our code assumes that any type schema with properties defined will be a map
// even though it should allow in any type and have map constraints for properties
updatePropertyForMap(property, p);
}
}
}

View File

@ -251,8 +251,9 @@ public class ScalaGatlingCodegen extends AbstractScalaCodegen implements Codegen
*/
@Override
public void preprocessOpenAPI(OpenAPI openAPI) {
for (String pathname : openAPI.getPaths().keySet()) {
PathItem path = openAPI.getPaths().get(pathname);
for (Map.Entry<String, PathItem> openAPIGetPathsEntry : openAPI.getPaths().entrySet()) {
String pathname = openAPIGetPathsEntry.getKey();
PathItem path = openAPIGetPathsEntry.getValue();
if (path.readOperations() == null) {
continue;
}

View File

@ -556,8 +556,9 @@ public class SpringCodegen extends AbstractJavaCodegen
}
if (openAPI.getPaths() != null) {
for (String pathname : openAPI.getPaths().keySet()) {
PathItem path = openAPI.getPaths().get(pathname);
for (Map.Entry<String, PathItem> openAPIGetPathsEntry : openAPI.getPaths().entrySet()) {
String pathname = openAPIGetPathsEntry.getKey();
PathItem path = openAPIGetPathsEntry.getValue();
if (path.readOperations() != null) {
for (Operation operation : path.readOperations()) {
if (operation.getTags() != null) {

View File

@ -76,7 +76,8 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
protected static final String RESPONSE_LIBRARY_RX_SWIFT = "RxSwift";
protected static final String RESPONSE_LIBRARY_RESULT = "Result";
protected static final String RESPONSE_LIBRARY_COMBINE = "Combine";
protected static final String[] RESPONSE_LIBRARIES = {RESPONSE_LIBRARY_PROMISE_KIT, RESPONSE_LIBRARY_RX_SWIFT, RESPONSE_LIBRARY_RESULT, RESPONSE_LIBRARY_COMBINE};
protected static final String RESPONSE_LIBRARY_ASYNC_AWAIT = "AsyncAwait";
protected static final String[] RESPONSE_LIBRARIES = {RESPONSE_LIBRARY_PROMISE_KIT, RESPONSE_LIBRARY_RX_SWIFT, RESPONSE_LIBRARY_RESULT, RESPONSE_LIBRARY_COMBINE, RESPONSE_LIBRARY_ASYNC_AWAIT};
protected String projectName = "OpenAPIClient";
protected boolean nonPublicApi = false;
protected boolean objcCompatible = false;
@ -443,6 +444,9 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
if (ArrayUtils.contains(responseAs, RESPONSE_LIBRARY_COMBINE)) {
additionalProperties.put("useCombine", true);
}
if (ArrayUtils.contains(responseAs, RESPONSE_LIBRARY_ASYNC_AWAIT)) {
additionalProperties.put("useAsyncAwait", true);
}
// Setup readonlyProperties option, which declares properties so they can only
// be set at initialization

View File

@ -293,7 +293,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
// Set the typescript version compatible to the Angular version
if (ngVersion.atLeast("12.0.0")) {
additionalProperties.put("tsVersion", ">=4.2.3 <4.3.0");
additionalProperties.put("tsVersion", ">=4.3.0 <4.4.0");
} else if (ngVersion.atLeast("11.0.0")) {
additionalProperties.put("tsVersion", ">=4.0.0 <4.1.0");
} else if (ngVersion.atLeast("10.0.0")) {

View File

@ -22,6 +22,8 @@ import io.swagger.v3.parser.util.SchemaTypeUtil;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.DocumentationFeature;
import org.openapitools.codegen.utils.ModelUtils;
import java.util.*;
public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodegen {
@ -53,6 +55,8 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
this.cliOptions.add(new CliOption(SEPARATE_MODELS_AND_API, "Put the model and api in separate folders and in separate classes", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(WITHOUT_PREFIX_ENUMS, "Don't prefix enum names with class names", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(USE_SINGLE_REQUEST_PARAMETER, "Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
// Templates have no mapping between formatted property names and original base names so use only "original" and remove this option
removeOption(CodegenConstants.MODEL_PROPERTY_NAMING);
}
@Override
@ -255,4 +259,19 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json"));
}
@Override
protected void updatePropertyForAnyType(CodegenProperty property, Schema p) {
// The 'null' value is allowed when the OAS schema is 'any type'.
// See https://github.com/OAI/OpenAPI-Specification/issues/1389
// custom line here, do not set property.isNullable = true
if (languageSpecificPrimitives.contains(property.dataType)) {
property.isPrimitiveType = true;
}
if (ModelUtils.isMapSchema(p)) {
// an object or anyType composed schema that has additionalProperties set
// some of our code assumes that any type schema with properties defined will be a map
// even though it should allow in any type and have map constraints for properties
updatePropertyForMap(property, p);
}
}
}

View File

@ -1100,7 +1100,7 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
}
String refModelName = getModelName(schema);
return toExampleValueRecursive(refModelName, refSchema, objExample, indentationLevel, prefix, exampleLine, seenSchemas);
} else if (ModelUtils.isNullType(schema) || isAnyTypeSchema(schema)) {
} else if (ModelUtils.isNullType(schema) || ModelUtils.isAnyType(schema)) {
// The 'null' type is allowed in OAS 3.1 and above. It is not supported by OAS 3.0.x,
// though this tooling supports it.
return fullPrefix + "null" + closeChars;

View File

@ -309,7 +309,7 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen
return toApiFilename(name);
}
@Override
@Override
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) {
super.addAdditionPropertiesToCodeGenModel(codegenModel, schema);
Schema additionalProperties = getAdditionalProperties(schema);
@ -319,4 +319,13 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen
}
addImport(codegenModel, codegenModel.additionalPropertiesType);
}
@Override
public String toDefaultValue(Schema p) {
String def = super.toDefaultValue(p);
if ("undefined".equals(def)) {
return null;
}
return def;
}
}

View File

@ -407,6 +407,21 @@ public class ModelUtils {
return ref;
}
/**
* Return true if the specified schema is type object
* We can't use isObjectSchema because it requires properties to exist which is not required
* We can't use isMap because it is true for AnyType use cases
*
* @param schema the OAS schema
* @return true if the specified schema is an Object schema.
*/
public static boolean isTypeObjectSchema(Schema schema) {
if (SchemaTypeUtil.OBJECT_TYPE.equals(schema.getType())) {
return true;
}
return false;
}
/**
* Return true if the specified schema is an object with a fixed number of properties.
*
@ -1487,18 +1502,23 @@ public class ModelUtils {
return false;
}
/**
* For when a type is not defined on a schema
* Note: properties, additionalProperties, enums, validations, items, and composed schemas (oneOf/anyOf/allOf)
* can be defined or omitted on these any type schemas
* @param schema the schema that we are checking
* @return boolean
*/
public static boolean isAnyType(Schema schema) {
return (schema.get$ref() == null && schema.getType() == null);
}
public static void syncValidationProperties(Schema schema, IJsonSchemaValidationProperties target) {
// TODO move this method to IJsonSchemaValidationProperties
if (schema != null && target != null) {
if (isNullType(schema) || schema.get$ref() != null || isBooleanSchema(schema)) {
return;
}
boolean isAnyType = (schema.getClass().equals(Schema.class) && schema.get$ref() == null && schema.getType() == null &&
(schema.getProperties() == null || schema.getProperties().isEmpty()) &&
schema.getAdditionalProperties() == null && schema.getNot() == null &&
schema.getEnum() == null);
if (isAnyType) {
return;
}
Integer minItems = schema.getMinItems();
Integer maxItems = schema.getMaxItems();
Boolean uniqueItems = schema.getUniqueItems();
@ -1515,7 +1535,7 @@ public class ModelUtils {
if (isArraySchema(schema)) {
setArrayValidations(minItems, maxItems, uniqueItems, target);
} else if (isMapSchema(schema) || isObjectSchema(schema)) {
} else if (isTypeObjectSchema(schema)) {
setObjectValidations(minProperties, maxProperties, target);
} else if (isStringSchema(schema)) {
setStringValidations(minLength, maxLength, pattern, target);
@ -1524,8 +1544,8 @@ public class ModelUtils {
}
} else if (isNumberSchema(schema) || isIntegerSchema(schema)) {
setNumericValidations(schema, multipleOf, minimum, maximum, exclusiveMinimum, exclusiveMaximum, target);
} else if (isComposedSchema(schema)) {
// this could be composed out of anything so set all validations here
} else if (isAnyType(schema)) {
// anyType can have any validations set on it
setArrayValidations(minItems, maxItems, uniqueItems, target);
setObjectValidations(minProperties, maxProperties, target);
setStringValidations(minLength, maxLength, pattern, target);

View File

@ -56,7 +56,7 @@ if(hasProperty('target') && target == 'android') {
}
dependencies {
provided 'javax.annotation:jsr250-api:1.0'
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
}
}
@ -129,6 +129,7 @@ ext {
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.1"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
{{#threetenbp}}
jackson_threetenbp_version = "2.9.10"
{{/threetenbp}}
@ -161,6 +162,6 @@ dependencies {
{{^java8}}
implementation "com.brsanthu:migbase64:2.2"
{{/java8}}
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "junit:junit:$junit_version"
}

View File

@ -321,9 +321,9 @@
{{#useBeanValidation}}
<!-- Bean Validation API support -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>${beanvalidation-version}</version>
<scope>provided</scope>
</dependency>
{{/useBeanValidation}}
@ -345,9 +345,9 @@
</dependency>
{{/parcelableModel}}
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
<!-- test dependencies -->
@ -366,7 +366,10 @@
{{#threetenbp}}
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
{{/threetenbp}}
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
{{#useBeanValidation}}
<beanvalidation-version>2.0.2</beanvalidation-version>
{{/useBeanValidation}}
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.13.1</junit-version>
</properties>

View File

@ -49,7 +49,7 @@ if(hasProperty('target') && target == 'android') {
}
dependencies {
provided 'javax.annotation:jsr250-api:1.0'
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
}
}
@ -105,6 +105,7 @@ ext {
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.1"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
{{#threetenbp}}
jackson_threetenbp_version = "2.9.10"
{{/threetenbp}}
@ -140,7 +141,7 @@ dependencies {
implementation "com.brsanthu:migbase64:2.2"
implementation "com.github.scribejava:scribejava-core:$scribejava_version"
implementation "com.brsanthu:migbase64:2.2"
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "org.junit.jupiter:junit-jupiter:$junit_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version"

View File

@ -23,7 +23,7 @@ lazy val root = (project in file(".")).
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile",
"com.github.scribejava" % "scribejava-core" % "8.0.0" % "compile",
"com.brsanthu" % "migbase64" % "2.2" % "compile",
"javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"org.junit.jupiter" % "junit-jupiter" % "5.7.0" % "test",
"org.junit.jupiter" % "junit-jupiter-params" % "5.7.0" % "test",
"com.github.tomakehurst" % "wiremock-jre8" % "2.27.2" % "test",

View File

@ -311,9 +311,9 @@
<version>${scribejava-version}</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
@ -371,7 +371,7 @@
{{#threetenbp}}
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
{{/threetenbp}}
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>5.7.0</junit-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<scribejava-version>8.0.0</scribejava-version>

View File

@ -55,7 +55,7 @@ if(hasProperty('target') && target == 'android') {
}
dependencies {
provided 'javax.annotation:jsr250-api:1.0'
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
}
}
@ -113,6 +113,7 @@ ext {
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.1"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
google_api_client_version = "1.23.0"
jersey_common_version = "2.25.1"
jodatime_version = "2.9.9"
@ -147,6 +148,6 @@ dependencies {
{{#withXml}}
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version"
{{/withXml}}
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "junit:junit:$junit_version"
}

View File

@ -27,7 +27,7 @@ lazy val root = (project in file(".")).
{{#threetenbp}}
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile",
{{/threetenbp}}
"javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"junit" % "junit" % "4.13.1" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
)

View File

@ -298,9 +298,9 @@
</dependency>
{{/threetenbp}}
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
@ -328,7 +328,7 @@
{{#threetenbp}}
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
{{/threetenbp}}
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.13.1</junit-version>
</properties>

View File

@ -55,7 +55,7 @@ if(hasProperty('target') && target == 'android') {
}
dependencies {
provided 'javax.annotation:jsr250-api:1.0'
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
}
}
@ -112,6 +112,7 @@ ext {
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.1"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
jersey_version = "2.27"
junit_version = "4.13.1"
{{#threetenbp}}
@ -157,7 +158,7 @@ dependencies {
{{^java8}}
implementation "com.brsanthu:migbase64:2.2"
{{/java8}}
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "junit:junit:$junit_version"
}

View File

@ -36,7 +36,7 @@ lazy val root = (project in file(".")).
{{^java8}}
"com.brsanthu" % "migbase64" % "2.2",
{{/java8}}
"javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"junit" % "junit" % "4.13.1" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
)

View File

@ -344,16 +344,16 @@
{{#useBeanValidation}}
<!-- Bean Validation API support -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>${beanvalidation-version}</version>
<scope>provided</scope>
</dependency>
{{/useBeanValidation}}
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -379,7 +379,10 @@
{{#threetenbp}}
<threetenbp-version>2.9.10</threetenbp-version>
{{/threetenbp}}
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
{{#useBeanValidation}}
<beanvalidation-version>2.0.2</beanvalidation-version>
{{/useBeanValidation}}
<junit-version>4.13.1</junit-version>
{{#hasHttpSignatureMethods}}
<http-signature-version>1.5</http-signature-version>

View File

@ -67,8 +67,8 @@
{{#useBeanValidation}}
<!-- Bean Validation API support -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>${beanvalidation-version}</version>
<scope>provided</scope>
</dependency>
@ -82,9 +82,9 @@
<!-- JAX-RS -->
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>${jakarta.ws.rs-version}</version>
<scope>provided</scope>
</dependency>
@ -109,19 +109,19 @@
</dependency>
{{/disableMultipart}}
<dependency>
<groupId>javax.json.bind</groupId>
<artifactId>javax.json.bind-api</artifactId>
<version>1.0</version>
<groupId>jakarta.json.bind</groupId>
<artifactId>jakarta.json.bind-api</artifactId>
<version>${jakarta.json.bind-version}</version>
</dependency>
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.1.4</version>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>${jakarta.json-version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.11</version>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${jakarta.xml.bind-version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
@ -134,9 +134,9 @@
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
<version>${jakarta.activation-version}</version>
</dependency>
{{#java8}}
@ -161,9 +161,9 @@
</dependency>
{{/useBeanValidationFeature}}
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
@ -184,13 +184,17 @@
<jetty-version>9.2.9.v20150224</jetty-version>
<junit-version>4.13.1</junit-version>
<logback-version>1.2.0</logback-version>
<servlet-api-version>2.5</servlet-api-version>
{{#useBeanValidation}}
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
<beanvalidation-version>2.0.2</beanvalidation-version>
{{/useBeanValidation}}
<cxf-version>3.2.7</cxf-version>
<jackson-jaxrs-version>2.9.7</jackson-jaxrs-version>
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta.activation-version>1.2.2</jakarta.activation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<jakarta.json.bind-version>1.0.2</jakarta.json.bind-version>
<jakarta.json-version>1.1.6</jakarta.json-version>
<jakarta.ws.rs-version>2.1.6</jakarta.ws.rs-version>
<jakarta.xml.bind-version>2.3.3</jakarta.xml.bind-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -63,6 +63,7 @@ artifacts {
ext {
swagger_annotations_version = "1.5.22"
jackson_version = "2.10.4"
jakarta_annotation_version = "1.3.5"
junit_version = "4.13.1"
{{#threetenbp}}
threetenbp_version = "2.9.10"
@ -77,7 +78,7 @@ dependencies {
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
implementation "org.openapitools:jackson-databind-nullable:0.2.1"
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
{{#threetenbp}}
implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version"
{{/threetenbp}}

View File

@ -208,9 +208,9 @@
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
@ -230,7 +230,7 @@
<maven.compiler.target>11</maven.compiler.target>
<jackson-version>2.10.4</jackson-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
{{#threetenbp}}
<threetenbp-version>2.9.10</threetenbp-version>
{{/threetenbp}}

View File

@ -56,7 +56,7 @@ if(hasProperty('target') && target == 'android') {
}
dependencies {
provided 'javax.annotation:javax.annotation-api:1.3.2'
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
}
}
@ -101,6 +101,10 @@ if(hasProperty('target') && target == 'android') {
}
}
ext {
jakarta_annotation_version = "1.3.5"
}
dependencies {
implementation 'io.swagger:swagger-annotations:1.5.24'
implementation "com.google.code.findbugs:jsr305:3.0.2"
@ -124,7 +128,7 @@ dependencies {
{{#dynamicOperations}}
implementation 'io.swagger.parser.v3:swagger-parser-v3:2.0.23'
{{/dynamicOperations}}
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation 'junit:junit:4.13.1'
}

View File

@ -30,9 +30,9 @@ lazy val root = (project in file(".")).
"io.swagger.parser.v3" % "swagger-parser-v3" "2.0.23" % "compile"
{{/dynamicOperations}}
"io.gsonfire" % "gson-fire" % "1.8.3" % "compile",
"javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile",
"javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"junit" % "junit" % "4.13.1" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
)

View File

@ -284,9 +284,9 @@
{{#useBeanValidation}}
<!-- Bean Validation API support -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>${beanvalidation-version}</version>
<scope>provided</scope>
</dependency>
{{/useBeanValidation}}
@ -298,9 +298,9 @@
<version>5.4.1.Final</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>2.2</version>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
<version>${jakarta.el-version}</version>
</dependency>
{{/performBeanValidation}}
{{#parcelableModel}}
@ -313,9 +313,9 @@
</dependency>
{{/parcelableModel}}
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
{{#openApiNullable}}
@ -357,7 +357,13 @@
{{#threetenbp}}
<threetenbp-version>1.5.0</threetenbp-version>
{{/threetenbp}}
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
{{#performBeanValidation}}
<jakarta.el-version>3.0.3</jakarta.el-version>
{{/performBeanValidation}}
{{#useBeanValidation}}
<beanvalidation-version>2.0.2</beanvalidation-version>
{{/useBeanValidation}}
<junit-version>4.13.1</junit-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

View File

@ -49,7 +49,7 @@ if(hasProperty('target') && target == 'android') {
}
dependencies {
provided 'javax.annotation:jsr250-api:1.0'
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
}
}
@ -104,6 +104,7 @@ ext {
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.1"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
{{#threetenbp}}
jackson_threetenbp_version = "2.10.0"
{{/threetenbp}}
@ -158,11 +159,11 @@ dependencies {
{{/threetenbp}}
implementation "com.squareup.okio:okio:$okio_version"
{{#useBeanValidation}}
implementation "javax.validation:validation-api:2.0.1.Final"
implementation "jakarta.validation:jakarta.validation-api:2.0.2"
{{/useBeanValidation}}
{{#performBeanValidation}}
implementation "org.hibernate:hibernate-validator:6.0.19.Final"
{{/performBeanValidation}}
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "junit:junit:$junit_version"
}

View File

@ -45,12 +45,12 @@ lazy val root = (project in file(".")).
{{/threetenbp}}
"com.squareup.okio" % "okio" % "1.17.5" % "compile",
{{#useBeanValidation}}
"javax.validation" % "validation-api" % "2.0.1.Final" % "compile",
"jakarta.validation" % "jakarta.validation-api" % "2.0.2" % "compile",
{{/useBeanValidation}}
{{#performBeanValidation}}
"org.hibernate" % "hibernate-validator" % "6.0.19.Final" % "compile",
{{/performBeanValidation}}
"javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"junit" % "junit" % "4.13.1" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
)

View File

@ -231,9 +231,9 @@
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -322,9 +322,9 @@
{{#useBeanValidation}}
<!-- Bean Validation API support -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>${beanvalidation-version}</version>
<scope>provided</scope>
</dependency>
{{/useBeanValidation}}
@ -363,7 +363,10 @@
<jackson-threetenbp-version>2.10.0</jackson-threetenbp-version>
{{/threetenbp}}
{{/jackson}}
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
{{#useBeanValidation}}
<beanvalidation-version>2.0.2</beanvalidation-version>
{{/useBeanValidation}}
<okio-version>1.17.5</okio-version>
<junit-version>4.13.1</junit-version>
</properties>

View File

@ -49,7 +49,7 @@ if(hasProperty('target') && target == 'android') {
}
dependencies {
provided 'javax.annotation:jsr250-api:1.0'
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
}
}
@ -100,6 +100,7 @@ ext {
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.1"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
threetenbp_version = "2.9.10"
resteasy_version = "4.5.11.Final"
junit_version = "4.13"
@ -119,6 +120,6 @@ dependencies {
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
{{/openApiNullable}}
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "junit:junit:$junit_version"
}

View File

@ -18,7 +18,7 @@ lazy val root = (project in file(".")).
"com.fasterxml.jackson.core" % "jackson-databind" % "2.10.5.1" % "compile",
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.10" % "compile",
"javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"junit" % "junit" % "4.13" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
)

View File

@ -191,14 +191,6 @@
<groupId>net.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.spec.javax.annotation</groupId>
<artifactId>jboss-annotations-api_1.2_spec</artifactId>
</exclusion>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
@ -214,10 +206,6 @@
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- JSON processing: jackson -->
@ -269,9 +257,9 @@
<version>${threetenbp-version}</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
<!-- test dependencies -->
@ -289,7 +277,7 @@
<jackson-version>2.10.5</jackson-version>
<jackson-databind-version>2.10.5.1</jackson-databind-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<threetenbp-version>2.9.10</threetenbp-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.13</junit-version>

View File

@ -55,7 +55,7 @@ if(hasProperty('target') && target == 'android') {
}
dependencies {
provided 'javax.annotation:jsr250-api:1.0'
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
}
}
@ -113,6 +113,7 @@ ext {
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.1"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
spring_web_version = "5.2.5.RELEASE"
jodatime_version = "2.9.9"
junit_version = "4.13.1"
@ -146,6 +147,6 @@ dependencies {
{{#withXml}}
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version"
{{/withXml}}
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "junit:junit:$junit_version"
}

View File

@ -299,9 +299,9 @@
</dependency>
{{/threetenbp}}
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
@ -320,7 +320,7 @@
<jackson-version>2.10.5</jackson-version>
<jackson-databind-version>2.10.5.1</jackson-databind-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
{{#joda}}
<jodatime-version>2.9.9</jodatime-version>
{{/joda}}

View File

@ -55,7 +55,7 @@ if(hasProperty('target') && target == 'android') {
}
dependencies {
provided 'javax.annotation:jsr250-api:1.0'
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
}
}
@ -105,6 +105,7 @@ ext {
oltu_version = "1.0.1"
retrofit_version = "1.9.0"
swagger_annotations_version = "1.5.21"
jakarta_annotation_version = "1.3.5"
junit_version = "4.13.1"
jodatime_version = "2.9.3"
{{#threetenbp}}
@ -122,6 +123,6 @@ dependencies {
{{#threetenbp}}
implementation "org.threeten:threetenbp:$threetenbp_version"
{{/threetenbp}}
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "junit:junit:$junit_version"
}

View File

@ -17,7 +17,7 @@ lazy val root = (project in file(".")).
{{#threetenbp}}
"org.threeten" % "threetenbp" % "1.4.0" % "compile",
{{/threetenbp}}
"javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"junit" % "junit" % "4.13.1" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
)

View File

@ -265,9 +265,9 @@
</dependency>
{{/parcelableModel}}
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
<!-- test dependencies -->
@ -288,7 +288,7 @@
<threetenbp-version>1.4.0</threetenbp-version>
{{/threetenbp}}
<oltu-version>1.0.1</oltu-version>
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.13.1</junit-version>
</properties>

View File

@ -55,7 +55,7 @@ if(hasProperty('target') && target == 'android') {
}
dependencies {
provided 'javax.annotation:jsr250-api:1.0'
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
}
}
@ -115,6 +115,7 @@ ext {
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.1"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
{{#play24}}
play_version = "2.4.11"
{{/play24}}
@ -176,7 +177,7 @@ dependencies {
{{#usePlayWS}}
{{#play26}}
implementation "com.typesafe.play:play-ahc-ws_2.12:$play_version"
implementation "javax.validation:validation-api:1.1.0.Final"
implementation "jakarta.validation:jakarta.validation-api:2.0.2"
{{/play26}}
{{^play26}}
implementation "com.typesafe.play:play-java-ws_2.11:$play_version"
@ -190,6 +191,6 @@ dependencies {
{{/openApiNullable}}
implementation "com.fasterxml.jackson.datatype:jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}:$jackson_version"
{{/usePlayWS}}
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "junit:junit:$junit_version"
}

View File

@ -23,7 +23,7 @@ lazy val root = (project in file(".")).
{{/play25}}
{{#play26}}
"com.typesafe.play" % "play-ahc-ws_2.12" % "2.6.7" % "compile",
"javax.validation" % "validation-api" % "1.1.0.Final" % "compile",
"jakarta.validation" % "jakarta.validation-api" % "2.0.2" % "compile",
{{/play26}}
"com.squareup.retrofit2" % "converter-jackson" % "2.3.0" % "compile",
"com.fasterxml.jackson.core" % "jackson-core" % "2.10.5" % "compile",
@ -51,7 +51,7 @@ lazy val root = (project in file(".")).
"org.threeten" % "threetenbp" % "1.4.0" % "compile",
{{/threetenbp}}
"io.gsonfire" % "gson-fire" % "1.8.0" % "compile",
"javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"junit" % "junit" % "4.13.1" % "test",
"com.novocode" % "junit-interface" % "0.11" % "test"
)

View File

@ -372,9 +372,9 @@
<version>${play-version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>${beanvalidation-version}</version>
</dependency>
{{/play26}}
{{/usePlayWS}}
@ -388,9 +388,9 @@
</dependency>
{{/parcelableModel}}
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
<!-- test dependencies -->
@ -439,7 +439,10 @@
{{#threetenbp}}
<threetenbp-version>1.4.0</threetenbp-version>
{{/threetenbp}}
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
{{#useBeanValidation}}
<beanvalidation-version>2.0.2</beanvalidation-version>
{{/useBeanValidation}}
<oltu-version>1.0.1</oltu-version>
<junit-version>4.13.1</junit-version>
</properties>

View File

@ -35,6 +35,7 @@ ext {
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.1"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
{{#threetenbp}}
jackson_threeten_version = "2.9.10"
{{/threetenbp}}
@ -60,7 +61,7 @@ dependencies {
{{#openApiNullable}}
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
{{/openApiNullable}}
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "junit:junit:$junit_version"
testImplementation "io.vertx:vertx-unit:$vertx_version"
}

View File

@ -281,9 +281,9 @@
</dependency>
{{/threetenbp}}
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
@ -309,7 +309,7 @@
<jackson-version>2.10.5</jackson-version>
<jackson-databind>2.10.5.1</jackson-databind>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>4.13.1</junit-version>
</properties>
</project>

View File

@ -56,7 +56,7 @@ if(hasProperty('target') && target == 'android') {
}
dependencies {
provided 'javax.annotation:jsr250-api:1.0'
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
}
}
@ -130,7 +130,7 @@ ext {
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.1"
{{/openApiNullable}}
javax_annotation_version = "1.3.2"
jakarta_annotation_version = "1.3.5"
reactor_version = "3.4.3"
reactor_netty_version = "0.7.15.RELEASE"
jodatime_version = "2.9.9"
@ -159,6 +159,6 @@ dependencies {
{{^java8}}
implementation "com.brsanthu:migbase64:2.2"
{{/java8}}
implementation "javax.annotation:javax.annotation-api:$javax_annotation_version"
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "junit:junit:$junit_version"
}

View File

@ -132,9 +132,9 @@
</dependency>
{{/joda}}
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
@ -155,7 +155,7 @@
{{#openApiNullable}}
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
{{/openApiNullable}}
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>4.13.1</junit-version>
<reactor-version>3.4.3</reactor-version>
<reactor-netty-version>0.7.15.RELEASE</reactor-netty-version>

View File

@ -16,6 +16,7 @@ import java.io.Serializable;
{{/serializableModel}}
{{#jackson}}
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
{{#withXml}}
import com.fasterxml.jackson.dataformat.xml.annotation.*;
{{/withXml}}

View File

@ -321,9 +321,9 @@
{{#useBeanValidation}}
<!-- Bean Validation API support -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>${beanvalidation-version}</version>
<scope>provided</scope>
</dependency>
{{/useBeanValidation}}
@ -345,9 +345,9 @@
</dependency>
{{/parcelableModel}}
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
<!-- test dependencies -->
@ -366,7 +366,10 @@
{{#threetenbp}}
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
{{/threetenbp}}
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
{{#useBeanValidation}}
<beanvalidation-version>2.0.2</beanvalidation-version>
{{/useBeanValidation}}
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.13.1</junit-version>
</properties>

View File

@ -127,9 +127,9 @@
<version>${swagger-inflector-version}</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-version}</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
@ -148,7 +148,7 @@
<swagger-inflector-version>1.0.14</swagger-inflector-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<logback-version>1.0.1</logback-version>
<javax-annotation-version>1.3.2</javax-annotation-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>4.13.1</junit-version>
<slf4j-version>1.6.3</slf4j-version>
</properties>

Some files were not shown because too many files have changed in this diff Show More