Compare commits

...

91 Commits

Author SHA1 Message Date
William Cheng
fa3d863c8c uncomment haskell test 2020-07-31 15:00:23 +08:00
William Cheng
c93fcd7514 Add a link to conference paper (#7086) 2020-07-31 11:19:51 +08:00
William Cheng
b2293cc363 Add a link to the blog post at qiita (#7084) 2020-07-31 10:42:44 +08:00
William Cheng
e12009907e migrate typescript.sh to new config format (#7078) 2020-07-30 22:55:52 +08:00
William Cheng
6621f46d70 update protobuf samples 2020-07-30 11:30:29 +08:00
k0ral
0494d27f73 [Protobuf] Generate enum fields (#7073) 2020-07-30 11:22:32 +08:00
sbu
472ff9c657 Fix 2d list generation for dart (#6913) 2020-07-30 10:19:43 +08:00
William Cheng
720f864b64 surpress warnings in plantuml generator (#7071) 2020-07-29 19:01:26 +08:00
William Cheng
8a3994e000 update doc 2020-07-29 16:56:08 +08:00
William Cheng
4e59122264 Merge branch 'master' of https://github.com/openapitools/openapi-generator 2020-07-29 15:44:53 +08:00
William Cheng
f64a4d1a4f update samples 2020-07-29 15:44:28 +08:00
William Cheng
789b158cd4 Add "Allow edits from maintainers" tips to the doc (#7068)
Add "Allow edits from maintainers" tips to the doc
2020-07-29 15:41:19 +08:00
Marcus Berndt
0c173fb519 typescript-axios: add Set as language primitive (#6931)
* fix(typescript-axios): add Set as language primitive

* fix(typemapping): added lowercased set as primitive type

* fix(samples): regenerated ts samples and added Set as language primitive to ts docs
2020-07-29 15:35:30 +08:00
William Cheng
fdc0b5b0e2 [PHP] Fix sending array of files with multipart/form-data in PHP template (#7067)
* Fix sending array of files with multipart/form-data in PHP template

* update php samples

Co-authored-by: Aleh Tanasiuk <atanasiuk@hubspot.com>
2020-07-29 15:07:51 +08:00
William Cheng
adc3fef247 improve travis in R client (#7063) 2020-07-29 09:56:11 +08:00
Justin Black
798ad2f87d [python-experimental] simplifies json serialization (#7061)
* Requires python >= 3.5, adds type hints to call_api method

* Adds type hints to files_parameters and __call_api

* Adds and uses a new json encoded to prepare data before it is sent

* Removes nose name from gitlab testing invocations

* Also updates travis to py>=3.5

* Collapses encoder back into sanitize_for_serialization
2020-07-28 08:16:19 -07:00
Calvin Young
fa75469828 Export models package when using withSeparateModelsAndApi flag (#6873)
* Export models package when using withSeparateModelsAndApi flag

* Update typescript-axios samples

* Revert "Update typescript-axios samples"

This reverts commit ac0db6ba940bb78d37b41a5655918cbef9bc2f26.

* Update typescript-axios samples

* update samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-07-28 16:54:52 +08:00
Dragos CIULICA
86eb1b9112 Bugfix/5.0.0 beta/6853 fixed reactor conditions in template (#6993)
* fixed flux<part> generation

* updated petstore samples

* fixed flux<part> generation

* updated petstore samples

* update samples

Co-authored-by: Dragos CIULICA <atlassian-masernet@bit-factor.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-07-28 16:02:08 +08:00
Benjamin Seiller
1cb34be8fe [Java][okhttp-gson] prevent UnsupportedOperationException by removal from ImmutableList on setDebugging(false) (#7024)
* fix https://github.com/OpenAPITools/openapi-generator/issues/6934

* fix https://github.com/OpenAPITools/openapi-generator/issues/6934

* update samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-07-28 10:22:46 +08:00
William Cheng
321ad3c820 fix string comparison in cpp ue4 generator (#7029) 2020-07-28 10:15:46 +08:00
Justin Black
ee0686e13f Python-exp clean up model classnames (#7054)
* Adds lazy_import, removes python-exp java class renaming code, partial removal of getPythonClassName call sites

Fixes PythonClientExperimentalTest.java

Python-exp smaples regeneration

Revers makefile

Reverst pom.xml

Fixes model imports in models.__init__

Updates docstring, omits lazy import in additional properties if we dont need it

Improves additional_properties_type assignment if None

Removes getPythonClassName

Fixes python-exp tests

* Removes unused makefiles
2020-07-27 18:35:41 -07:00
William Cheng
2743242ef4 fix string comparison in fsharp test (#7052) 2020-07-27 22:56:42 +08:00
Moshe Elisha
39c4a123b3 #6715 - Use Resource interface instead of AbstractResource when useAbstractionForFiles=true. (#7051) 2020-07-27 22:54:00 +08:00
William Cheng
312082c168 Add a link to Laracon EU presentation (#7055)
* Add a link to Laracon EU presentation

* add url
2020-07-27 13:53:46 +08:00
William Cheng
08612d8e52 fix string comparison in java pkmst generator (#7050) 2020-07-26 23:14:28 +08:00
k0ral
8d63f75966 [Protobuf] Make it possible to override field index using x-protobuf-index (#7002) 2020-07-26 17:25:35 +08:00
Andrew Kehrig
9bfd9545cc Add empty checks using hasAuthMethods (#6983)
* Add empty checks using hasAuthMethods

* Add regenerated sample for kotlin multiplatform
2020-07-26 17:10:06 +08:00
QP Hou
dba14f5ac6 [Go] support problem details HTTP API (#6793)
Based on https://tools.ietf.org/html/draft-ietf-appsawg-http-problem-00, the content-type would be `application/problem+json`
2020-07-26 15:36:19 +08:00
TIm Clark
9592754e57 [Java][jersey2] Test HttpSignature verification (#7047)
* [Java][jersey2] Test HttpSignature verification

Tests that `HttpSignatureAuth` headers can be verified after
signing.

* Fix formatting
2020-07-26 15:24:59 +08:00
patst
468d80be4b typescript-angular: Angular 10 support (#7037)
* 7036- angular 10 support

* update example files

* fix jersey exmaple file bc of circle ci fail

* add ./ to FILES manually to pass tests
2020-07-24 14:30:58 +02:00
William Cheng
a00521f260 add justin to core team in public page (#7043) 2020-07-24 18:46:48 +08:00
William Cheng
04c41d47a2 [Java][jersey2] fix query parameters in applyToParams (#7028)
* fix query parameters in applyToParams

* update samples
2020-07-24 18:44:15 +08:00
Matthew Davis
9139f91b48 add missing space for flask basic auth header (#7031)
Co-authored-by: Matthew Davis <Matthew.Davis.2@team.telstra.com>
2020-07-24 16:44:50 +08:00
William Cheng
5f8e28a39d Fix string comparison in Python generator's abstract class (#7030)
* fix string comparison in PythonAbstractConnexionServerCodegen.java

* rename abstract class

* put public first
2020-07-24 16:43:39 +08:00
Ravisankar-Challa
276a983fe8 Add property additionalModelTypeAnnotations on the top of pojo class (#6037) 2020-07-24 12:08:30 +08:00
William Cheng
1897f6f96c update samples 2020-07-24 12:07:23 +08:00
Alexandre
83f64dbc15 [Swift5] Fix Datetime default value (#7003)
* [Swift5] Fix Datetime default value

If a default value is provided by the API spec for a date-time attribute,
this commit fixes the generation code to build a correct Swift `Date` object.

* update samples with swiftlint

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-07-24 11:56:18 +08:00
William Cheng
8e150ab94e fix string comparison (#7027) 2020-07-23 23:01:57 +08:00
Slavek Kabrda
03e8aee8ea [java][jersey2-client] Disable coercion of scalars (#6811)
* [java][jersey2-client] Disable coercion of scalars

* Respect the coercion objectmapper setting in deserializers

* Update jackson in maven plugin to get version that has ALLOW_COERCION_OF_SCALARS
2020-07-23 16:33:15 +08:00
Slavek Kabrda
3199ddc615 Add 'x-generate-alias-as-model' extension to allow enabling generating alias as model per-schema (#6937) 2020-07-23 16:26:18 +08:00
William Cheng
d1fe2e17f1 update samples 2020-07-23 15:01:22 +08:00
Michał Zubkowicz
1bfd86a350 typescript-inversify: client compile error, type casting warning and apostrophes (#6970) 2020-07-23 08:09:27 +02:00
agilob
90d8c32906 [Dart] Fix enum generation (#6729)
* [Dart] Fix enum generation

* Update generated Order file

* Re-add constructor

* Generate dart2 files

* Dart - nicer enum formatting

* Dart - generate enum name as className+enumName

* Dart - dont initialize vars to null by default

Fixes #3633

* Dart - Generate inlined enums and deserialize them

* Merge branch 'master' of github.com:agilob/openapi-generator into 6727

* Dart - Fix using default value

* Fix typo

* Regenerate add dart files

* dart Revert override for dart dio and jaguar

* Fix dart model tests

* Fix dart1 generated template

* Use {{{datatypeWithEnum}}}

* Dart - throw when enum not known

* Fix generating enum with datatype from list
2020-07-23 11:26:25 +08:00
William Cheng
d6549f78b4 Add a link to the dev.to article (#7026) 2020-07-23 11:20:37 +08:00
William Cheng
9899315aab [Java][jersey2] Fix serializeToString (#6956)
* fix empty get body in serializeToString, add tests

* add new file

* fix serialize to better handle null string

* update test comments
2020-07-23 10:39:04 +08:00
William Cheng
6e21ca5930 Add a link to datadog blog (#7025) 2020-07-23 10:32:52 +08:00
Slavek Kabrda
763b8fbe3e [go-experimental] Fix generating array aliases as models (#6939)
Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-07-23 00:27:02 +08:00
William Cheng
e9c231b50a rollback feign version to 10.11 (#7012) 2020-07-22 21:21:11 +08:00
agilob
df2c927dcb [Dart] Annotate required named parameters in model (#6798) 2020-07-22 17:14:36 +08:00
mvistein
454ceb45fa Enabling forward declarations also for cpp-restsdk generator (#6996) 2020-07-22 17:06:14 +08:00
agilob
a59e506c9e [dart] fix toJson does not handle complex type (#6730)
Co-authored-by: arndt <17650715+dont1like1this@users.noreply.github.com>
2020-07-22 16:52:54 +08:00
Dheeraj Nalluri
3784f459e9 [typescript-angular] Unify authorization lookup (#6953)
* [typescript-angular] Unify authorization lookup

* [typescript-angular] Update samples.

* [typescript-angular] Fix typo.

* [typescript-angular] Revert changes to some of the sample files.

* [typescript-angular] Fixed compile error.

* [typescript-angular] Use arrow functions to avoid "this" issues

* Document usage of credentials map.
2020-07-22 10:29:28 +02:00
William Cheng
5e2306446f add occ to the user list (#7011) 2020-07-22 15:55:25 +08:00
Patrice De Saint Steban
b1dcf65c5b [Avro] Default value for no required fields to null (#7006)
* Default value for the non required fields to null

When a field is not required, the avro schema has no default value.
Has described in an [avro issues](https://issues.apache.org/jira/browse/AVRO-1803), the property default: null must be set.

If we don't do this in the avro file, when we generate java code from generated avro schema, the builder fail if the data isn't set in the avro data class.

* Update generated avro sample
2020-07-22 13:13:59 +08:00
William Cheng
2ab35e0386 add JsonTypeName (#6995) 2020-07-21 14:21:10 +08:00
William Cheng
6053f7b17b add ~/.sbt to circleci cache (#7000) 2020-07-21 14:01:52 +08:00
William Cheng
3305ac962a add nokia as the user (#7005) 2020-07-21 13:09:49 +08:00
Moshe Elisha
0a394bc883 [Java][RestTemplate] Use abstraction for files (#6912)
* Fix dir path in PR request template

* Add "useAbstractionForFiles" config option for Java/RestTemplate to allow flexible options in generated client when a file is needed (#6715)

* Add "useAbstractionForFiles" config option for Java/RestTemplate to allow flexible options in generated client when a file is needed (#6715)

* Add "useAbstractionForFiles" config option for Java/RestTemplate to allow flexible options in generated client when a file is needed (#6715)

* #6715 - Add "useAbstractionForFiles" config option for Java/RestTemplate to allow flexible options in generated client when a file is needed.
2020-07-20 22:54:14 +08:00
daiscog
95bd845f79 Typescript-angular generator: Mark deprecated operations with @deprecated JSDoc tag (#6973) 2020-07-20 16:12:42 +02:00
Kim T
383b1e9db8 [NodeJS] nodejs-express-server fix /api-docs path (#6977) 2020-07-20 18:57:50 +08:00
William Cheng
1cfa8141a8 fix config path in pull request template 2020-07-20 15:48:28 +08:00
Justin Black
0e0f8eb74c [python-experimental] Removes python2 (#6991)
* Removes future from python-exp v3 sample

* Removes future from python-exp v2 sample

* Deletes future from remaining python-exp files

* Removes six from python-exp templates

* Removes six from python-exp samples

* Removes mock from python-exp

* Python-exp switched to py3

* Removes python 2.7 for python-exp ci testing

* Requires python>=3.3 for python-exp

* Reverts unnecessary changes to two templates
2020-07-19 09:45:56 -07:00
Justin Black
ed84280108 Python-exp remove codegemodel mutation, allow mixed OneOf types (#6797)
* Stops converting primitive models into object models, adds ComposedSchemas with mixed type

* Samples update for python-exp
2020-07-18 10:13:22 -07:00
William Cheng
44d3f717f8 update java samples 2020-07-18 22:02:16 +08:00
Sebastien Rosset
968f32b55e [Java][Jersey2] Add JsonTypeName annotation (#6551)
* Mustache template should use invokerPackage tag to generate import

* add JsonSubTypes annotation to handle scenario when OAS name has special characters

* add JsonSubTypes annotation to handle scenario when OAS name has special characters. Add unit test

* run sample scripts

* fix unit test

* run sample scripts

* add minimal openapi document to show issue with special characters and discriminators

* Add 'isClassnameSanitized' tag

* Add 'isClassnameSanitized' tag

* Add 'isClassnameSanitized' tag

* Add 'isClassnameSanitized' tag

* Add 'isClassnameSanitized' tag

* Add 'isClassnameSanitized' tag

* Add unit tests for unmarshaling of discriminators with special characters

* Add unit tests for unmarshaling of discriminators with special characters

* use JsonTypeName

Co-authored-by: Vikrant Balyan (vvb) <vvb@cisco.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-07-18 21:56:41 +08:00
William Cheng
8a774f636b add coinapi logo (#6984) 2020-07-18 18:04:03 +08:00
William Cheng
dd6e8ccc3d replace ~ with $user.home (#6985) 2020-07-18 17:07:03 +08:00
William Cheng
0707b4bb20 [Scala] setup Ivy cache directory (#6978)
* use ivy2 cache

* use ~/.ivy2 cache dir

* add pom.xml to openapi-generator-ignore

* update scala-akka sample

* use ~ for home directory
2020-07-18 15:48:47 +08:00
William Cheng
49f088ec8e [CircleCI] rebalance tests (#6981)
* rearrange tests

* move java tests to others
2020-07-18 15:47:46 +08:00
Artur Pietrzyk
da50523f3b Update README.md (#6974) 2020-07-18 14:00:30 +08:00
William Cheng
d2161c8ad1 update c# samples 2020-07-18 11:18:21 +08:00
mh03r932
ffdd7000a4 fix: make accept header consistent with sync vers. (#6922)
* fix: make accept header of async apis consistent with sync version

* make sync and async version use same logic
* generate samples for csharp-netcore using generate-samples.sh

* fix: make accept header of async apis consistent with sync version

* change tabs to spaces to match existing code
2020-07-17 18:08:51 +08:00
bgong-mdsol
8cd52033e4 [Java][Native] added WithHttpInfo method for async-native (#6903)
* [java-asyncNative] add withHttpInfo

* update api template for async-native
2020-07-17 15:30:02 +08:00
Tomohiro Suwa
9318833fa5 [Ruby] ruby client build from hash nullable (#6945)
* Ruby Client: nullable for build_from_hash

* Generate sameples with a8eed9ce38
2020-07-17 00:39:21 +09:00
Bodo Graumann
7cb8766a5c [Typescript] Fix array model of alias to array (#6888)
* Add failing test

* Add model unaliasing

* Regenerate samples

Not really related to this bug fix, but probably necessary for ci
checks.
2020-07-16 16:31:41 +02:00
翠 / green
fce74884f8 [typescript-axios] switched to new URL API (#6960)
* [typescript-axios] switched to new URL API

* [typescript-axios] fix tests
2020-07-16 15:35:41 +02:00
William Cheng
a348f5a170 [Go] fix unmarshal for models with parents (#6946)
* set disallowAdditionalPropertiesIfNotPresent to false in go exp oas3

* fix unmarshal in go

* remove fields from embedded structs

* fix typo
2020-07-16 14:52:30 +08:00
William Cheng
02a8207b91 skip test for enum model, update readme (#6936) 2020-07-15 19:00:14 +08:00
William Cheng
cef1bec466 fix null payload in java jersey2 (#6933) 2020-07-15 00:50:37 +08:00
Sebastien Rosset
38368c9bda [Java][jersey2] Fix format of Date header in HTTP signature (#6925)
* Use RFC 1123 date format for Date header in HTTP signature

* Use RFC 1123 date format for Date header in HTTP signature
2020-07-15 00:19:55 +08:00
William Cheng
9d76ca291e add nullable body support to powershell (#6930) 2020-07-15 00:19:13 +08:00
Sebastien Rosset
b86a51ae17 fix typo (#6928) 2020-07-14 14:03:04 +08:00
William Cheng
5980c420e3 minor fix to sample code (java jersey2) (#6921) 2020-07-14 12:36:05 +08:00
Justin Black
dad931a25a Python exp sample component renaming + additions (#6917)
* Stops converting primitive models into object models, adds ComposedSchemas with mixed type

* Reverts java and mustache changes

* Reverts mroe files

* Samples regen

* Fixes remaining tests
2020-07-13 10:22:03 -07:00
William Cheng
29183e0280 [PowerShell] support default value in models (#6920)
* support default value in ps

* revert changes to the spec
2020-07-13 13:41:10 +08:00
William Cheng
1044c30293 add cake addin (#6918) 2020-07-13 10:19:06 +08:00
William Cheng
a7446983e8 Add a link to Go article in Qiita Blog (#6919) 2020-07-13 10:18:43 +08:00
William Cheng
53950f8aff Add a link to DreamFactory blog (#6910) 2020-07-11 23:09:52 +08:00
William Cheng
6a49c4ec02 add option disallowAdditionalPropertiesIfNotPresent to ps generator (#6909) 2020-07-11 22:41:24 +08:00
William Cheng
57bf9e85a1 [Go][Experimental] Add the option disallowAdditionalPropertiesIfNotPresent (#6908)
* add disallowAdditionalPropertiesIfNotPresent to go exp generator

* update cache key

* fix spring.xml with 5.0.0-SNAPSHOT
2020-07-11 16:53:28 +08:00
William Cheng
47b4e16420 Remove JDK7 tests in CircleCI (#6890)
* remove jdk7 tests in circleci

* test microprofile-rest-client in jdk8
2020-07-09 17:46:52 +08:00
2266 changed files with 35879 additions and 10368 deletions

View File

@@ -5,6 +5,6 @@
- [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md). - [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
- [ ] If contributing template-only or documentation-only changes which will change sample output, [build the project](https://github.com/OpenAPITools/openapi-generator#14---build-projects) beforehand. - [ ] If contributing template-only or documentation-only changes which will change sample output, [build the project](https://github.com/OpenAPITools/openapi-generator#14---build-projects) beforehand.
- [ ] Run the shell script `./bin/generate-samples.sh`to update all Petstore samples related to your fix. This is important, as CI jobs will verify _all_ generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example `./bin/generate-samples.sh bin/config/java*`. For Windows users, please run the script in [Git BASH](https://gitforwindows.org/). - [ ] Run the shell script `./bin/generate-samples.sh`to update all Petstore samples related to your fix. This is important, as CI jobs will verify _all_ generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example `./bin/generate-samples.sh bin/configs/java*`. For Windows users, please run the script in [Git BASH](https://gitforwindows.org/).
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master` - [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`
- [ ] Copy the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language. - [ ] Copy the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language.

1
.gitignore vendored
View File

@@ -177,6 +177,7 @@ samples/client/petstore/python-tornado/.venv/
samples/client/petstore/typescript-angular2/npm/npm-debug.log samples/client/petstore/typescript-angular2/npm/npm-debug.log
samples/client/petstore/typescript-node/npm/npm-debug.log samples/client/petstore/typescript-node/npm/npm-debug.log
samples/client/petstore/typescript-angular/tsd-debug.log samples/client/petstore/typescript-angular/tsd-debug.log
samples/client/petstore/typescript-axios/tests/**/dist/
samples/client/petstore/typescript-fetch/tests/**/dist/ samples/client/petstore/typescript-fetch/tests/**/dist/
# aspnetcore # aspnetcore

View File

@@ -17,15 +17,11 @@ trap cleanup EXIT
if [ "$NODE_INDEX" = "1" ]; then if [ "$NODE_INDEX" = "1" ]; then
echo "Running node $NODE_INDEX to test 'samples.circleci' defined in pom.xml ..." echo "Running node $NODE_INDEX to test 'samples.circleci' defined in pom.xml ..."
java -version java -version
# Install golang version 1.14
go version
sudo mkdir /usr/local/go1.14
wget -c https://dl.google.com/go/go1.14.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.14
export PATH="/usr/local/go1.14/go/bin:$PATH"
go version
mvn --no-snapshot-updates --quiet verify -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error mvn --no-snapshot-updates --quiet verify -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
echo "show ivy2 cache"
ls -l /home/circleci/.ivy2/cache
elif [ "$NODE_INDEX" = "2" ]; then elif [ "$NODE_INDEX" = "2" ]; then
# run ensure-up-to-date sample script on SNAPSHOT version only # run ensure-up-to-date sample script on SNAPSHOT version only
@@ -40,7 +36,6 @@ elif [ "$NODE_INDEX" = "2" ]; then
# look for outdated samples # look for outdated samples
./bin/utils/ensure-up-to-date ./bin/utils/ensure-up-to-date
fi fi
#elif [ "$NODE_INDEX" = "3" ]; then
echo "Running node $NODE_INDEX to test haskell" echo "Running node $NODE_INDEX to test haskell"
# install haskell # install haskell
curl -sSL https://get.haskellstack.org/ | sh curl -sSL https://get.haskellstack.org/ | sh
@@ -60,10 +55,17 @@ elif [ "$NODE_INDEX" = "2" ]; then
# run integration tests # run integration tests
mvn --no-snapshot-updates --quiet verify -Psamples.misc -Dorg.slf4j.simpleLogger.defaultLogLevel=error mvn --no-snapshot-updates --quiet verify -Psamples.misc -Dorg.slf4j.simpleLogger.defaultLogLevel=error
else else
echo "Running node $NODE_INDEX to test 'samples.circleci.jdk7' defined in pom.xml ..." echo "Running node $NODE_INDEX to test 'samples.circleci.others' defined in pom.xml ..."
sudo update-java-alternatives -s java-1.7.0-openjdk-amd64 #sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
java -version java -version
# Install golang version 1.14
go version
sudo mkdir /usr/local/go1.14
wget -c https://dl.google.com/go/go1.14.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.14
export PATH="/usr/local/go1.14/go/bin:$PATH"
go version
# install dart2 # install dart2
sudo apt-get update sudo apt-get update
sudo apt-get install apt-transport-https sudo apt-get install apt-transport-https
@@ -73,7 +75,8 @@ else
sudo apt-get install dart sudo apt-get install dart
export PATH="$PATH:/usr/lib/dart/bin" export PATH="$PATH:/usr/lib/dart/bin"
mvn --no-snapshot-updates --quiet verify -Psamples.circleci.jdk7 -Dorg.slf4j.simpleLogger.defaultLogLevel=error mvn --no-snapshot-updates --quiet verify -Psamples.circleci.others -Dorg.slf4j.simpleLogger.defaultLogLevel=error
mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
fi fi

View File

@@ -110,7 +110,8 @@ See [OpenAPI Tools wiki](https://github.com/OpenAPITools/openapi-generator/wiki/
- Add test case(s) to cover the change - Add test case(s) to cover the change
- Document the fix in the code to make the code more readable - Document the fix in the code to make the code more readable
- Make sure test cases passed after the change (one way is to leverage https://travis-ci.org/ to run the CI tests) - Make sure test cases passed after the change (one way is to leverage https://travis-ci.org/ to run the CI tests)
- File a PR with meaningful title, description and commit messages. - File a PR with meaningful title, description and commit messages
- Make sure the option "Allow edits from maintainers" in the PR is selected so that the maintainers can update your PRs with minor fixes, if needed.
- Recommended git settings - Recommended git settings
- `git config core.autocrlf input` to tell Git convert CRLF to LF on commit but not the other way around - `git config core.autocrlf input` to tell Git convert CRLF to LF on commit but not the other way around
- To close an issue (e.g. issue 1542) automatically after a PR is merged, use keywords "fix", "close", "resolve" in the PR description, e.g. `fix #1542`. (Ref: [closing issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/)) - To close an issue (e.g. issue 1542) automatically after a PR is merged, use keywords "fix", "close", "resolve" in the PR description, e.g. `fix #1542`. (Ref: [closing issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/))

View File

@@ -578,6 +578,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [Camptocamp](https://www.camptocamp.com/en) - [Camptocamp](https://www.camptocamp.com/en)
- [Cisco](https://www.cisco.com/) - [Cisco](https://www.cisco.com/)
- [codecentric AG](https://www.codecentric.de/) - [codecentric AG](https://www.codecentric.de/)
- [CoinAPI](https://www.coinapi.io/)
- [Commencis](https://www.commencis.com/) - [Commencis](https://www.commencis.com/)
- [Crossover Health](https://crossoverhealth.com/) - [Crossover Health](https://crossoverhealth.com/)
- [Cupix](https://www.cupix.com/) - [Cupix](https://www.cupix.com/)
@@ -614,6 +615,8 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [MoonVision](https://www.moonvision.io/) - [MoonVision](https://www.moonvision.io/)
- [Myworkout](https://myworkout.com) - [Myworkout](https://myworkout.com)
- [NamSor](https://www.namsor.com/) - [NamSor](https://www.namsor.com/)
- [Nokia](https://www.nokia.com/)
- [Options Clearing Corporation (OCC)](https://www.theocc.com/)
- [Openet](https://www.openet.com/) - [Openet](https://www.openet.com/)
- [openVALIDATION](https://openvalidation.io/) - [openVALIDATION](https://openvalidation.io/)
- [Oracle](https://www.oracle.com/) - [Oracle](https://www.oracle.com/)
@@ -756,7 +759,14 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- 2020-05-19 - [Dead Simple APIs with Open API](https://www.youtube.com/watch?v=sIaXmR6xRAw) by [Chris Tankersley](https://github.com/dragonmantank) at [Nexmo](https://developer.nexmo.com/) - 2020-05-19 - [Dead Simple APIs with Open API](https://www.youtube.com/watch?v=sIaXmR6xRAw) by [Chris Tankersley](https://github.com/dragonmantank) at [Nexmo](https://developer.nexmo.com/)
- 2020-05-22 - [TypeScript REST API Client](https://dev.to/unhurried/typescript-rest-api-client-4in3) by ["unhurried"](https://dev.to/unhurried) - 2020-05-22 - [TypeScript REST API Client](https://dev.to/unhurried/typescript-rest-api-client-4in3) by ["unhurried"](https://dev.to/unhurried)
- 2020-05-28 - [【使用 lotify + Swagger 建置可共用的 LINE Notify bot】 - #NiJia @ Chatbot Developer Taiwan 第 #19 小聚](https://www.youtube.com/watch?v=agYVz6dzh1I) by [Chatbot Developer Taiwan](https://www.youtube.com/channel/UCxeYUyZNnHmpX23YNF-ewvw) - 2020-05-28 - [【使用 lotify + Swagger 建置可共用的 LINE Notify bot】 - #NiJia @ Chatbot Developer Taiwan 第 #19 小聚](https://www.youtube.com/watch?v=agYVz6dzh1I) by [Chatbot Developer Taiwan](https://www.youtube.com/channel/UCxeYUyZNnHmpX23YNF-ewvw)
- 2020-05-28 - [Building APIs with Laravel using OpenAPI](https://www.youtube.com/watch?v=xexLvQqAhiA) by [Chris Tankersley](https://github.com/dragonmantank) at [Laracon EU](https://laracon.eu/)
- 2020-06-23 - [新規サーバーアプリケーションにTypeScriptを採用してみた](https://www.cam-inc.co.jp/news/20200623) at [CAM Tech Blog](https://www.cam-inc.co.jp/news/tech-blog/) - 2020-06-23 - [新規サーバーアプリケーションにTypeScriptを採用してみた](https://www.cam-inc.co.jp/news/20200623) at [CAM Tech Blog](https://www.cam-inc.co.jp/news/tech-blog/)
- 2020-06-29 - [Artifact Abstract: Deployment of APIs on Android Mobile Devices and Microcontrollers](https://ieeexplore.ieee.org/document/9127353) by [Sergio Laso ; Marino Linaje ; Jose Garcia-Alonso ; Juan M. Murillo ; Javier Berrocal](https://ieeexplore.ieee.org/document/9127353/authors#authors) at [2020 IEEE International Conference on Pervasive Computing and Communications (PerCom)](https://ieeexplore.ieee.org/xpl/conhome/9125449/proceeding)
- 2020-07-07 - [5 Best API Documentation Tools](https://blog.dreamfactory.com/5-best-api-documentation-tools/) by Susanna Bouse at [DreamFactory Blog](https://blog.dreamfactory.com/)
- 2020-07-12 - [Open API 3.0の定義からgolangのサーバコードのスケルトンを作成する](https://qiita.com/professor/items/4cbd04ec084d13057bc2) by [@professor (Qiita Blog)](https://qiita.com/professor)
- 2020-07-20 - [Datadog API client libraries now available for Java and Go](https://www.datadoghq.com/blog/java-go-libraries/) by Jordan Obey at [Datadog Blog](https://www.datadoghq.com/blog)
- 2020-07-23 - [Generate Client SDK for .NET Core using Open Api](https://dev.to/no0law1/generate-client-sdk-for-net-core-using-open-api-2dgh) by [Nuno Reis](https://dev.to/no0law1)
- 2020-07-26 - [Dartのhttp_interceptorライブラリを使うと配列のクエリパラメータが消えてしまう件の応急処置](https://qiita.com/gyamoto/items/eeeff81b6770487319ed) by [@gyamoto](https://qiita.com/gyamoto)
## [6 - About Us](#table-of-contents) ## [6 - About Us](#table-of-contents)

View File

@@ -5,3 +5,4 @@ templateDir: modules/openapi-generator/src/main/resources/go-experimental
additionalProperties: additionalProperties:
enumClassPrefix: "true" enumClassPrefix: "true"
packageName: petstore packageName: petstore
disallowAdditionalPropertiesIfNotPresent: false

View File

@@ -0,0 +1,15 @@
generatorName: java
outputDir: samples/openapi3/client/petstore/java/jersey2-java8-special-characters
library: jersey2
inputSpec: modules/openapi-generator/src/test/resources/3_0/schema-with-special-characters.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-openapi3-jersey2-java8-special-characters
hideGenerationTimestamp: true
serverPort: "8082"
dateLibrary: java8
useOneOfDiscriminatorLookup: true
disallowAdditionalPropertiesIfNotPresent: false
systemProperties:
skipValidateSpec: "false"

View File

@@ -0,0 +1,9 @@
generatorName: typescript-angular
outputDir: samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
additionalProperties:
ngVersion: 10.0.0
npmVersion: 1.0.0
npmName: '@openapitools/typescript-angular-petstore'
npmRepository: https://skimdb.npmjs.com/registry
snapshot: false

View File

@@ -0,0 +1,5 @@
generatorName: typescript-angular
outputDir: samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
additionalProperties:
ngVersion: 10.0.0

View File

@@ -0,0 +1,9 @@
generatorName: typescript-angular
outputDir: samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
additionalProperties:
ngVersion: 9.0.0
npmVersion: 1.0.0
npmName: '@openapitools/typescript-angular-petstore'
npmRepository: https://skimdb.npmjs.com/registry
snapshot: false

View File

@@ -0,0 +1,5 @@
generatorName: typescript-angular
outputDir: samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
additionalProperties:
ngVersion: 9.0.0

View File

@@ -0,0 +1,6 @@
generatorName: typescript
outputDir: samples/openapi3/client/petstore/typescript/builds/deno
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
additionalProperties:
platform: deno
npmName: ts-petstore-client

View File

@@ -0,0 +1,7 @@
generatorName: typescript
outputDir: samples/openapi3/client/petstore/typescript/builds/inversify
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
additionalProperties:
platform: node
npmName: ts-petstore-client
useInversify: true

View File

@@ -0,0 +1,6 @@
generatorName: typescript
outputDir: samples/openapi3/client/petstore/typescript/builds/jquery
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
additionalProperties:
framework: jquery
npmName: ts-petstore-client

View File

@@ -0,0 +1,7 @@
generatorName: typescript
outputDir: samples/openapi3/client/petstore/typescript/builds/object_params
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
additionalProperties:
platform: node
npmName: ts-petstore-client
useObjectParameters: true

View File

@@ -0,0 +1,6 @@
generatorName: typescript
outputDir: samples/openapi3/client/petstore/typescript/builds/default
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
additionalProperties:
platform: node
npmName: ts-petstore-client

View File

@@ -1,51 +0,0 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
common_args="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript"
samples="samples/openapi3/client/petstore/typescript/builds"
if [ ! -f "$executable" ]
then
mvn -B clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
printf "\033[32m## Creating default (fetch) client!\033[0m\n"
args="-o $samples/default --additional-properties=platform=node,npmName=ts-petstore-client $@"
java $JAVA_OPTS -jar $executable $common_args $args
printf "\033[32m## Creating jquery client!\033[0m\n"
args="-o $samples/jquery --additional-properties=framework=jquery,npmName=ts-petstore-client $@"
java $JAVA_OPTS -jar $executable $common_args $args
printf "\033[32m## Creating fetch object client!\033[0m\n"
args="-o $samples/object_params --additional-properties=platform=node,npmName=ts-petstore-client,useObjectParameters=true $@"
java $JAVA_OPTS -jar $executable $common_args $args
printf "\033[32m## Creating fetch client with InversifyJS support!\033[0m\n"
args="-o $samples/inversify --additional-properties=platform=node,npmName=ts-petstore-client,useInversify=true $@"
java $JAVA_OPTS -jar $executable $common_args $args
printf "\033[32m## Creating Deno (fetch) client!\033[0m\n"
args="-o $samples/deno --additional-properties=platform=deno $@"
java $JAVA_OPTS -jar $executable $common_args $args

View File

@@ -22,9 +22,9 @@ jobs:
- restore_cache: - restore_cache:
keys: keys:
# Default branch if not # Default branch if not
- source-v1-{{ .Branch }}-{{ .Revision }} - source-v2-{{ .Branch }}-{{ .Revision }}
- source-v1-{{ .Branch }}- - source-v2-{{ .Branch }}-
- source-v1- - source-v2-
# Machine Setup # Machine Setup
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each # If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
# The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out. # The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out.
@@ -70,7 +70,7 @@ jobs:
- run: ./CI/circle_parallel.sh - run: ./CI/circle_parallel.sh
# Save dependency cache # Save dependency cache
- save_cache: - save_cache:
key: source-v1-{{ .Branch }}-{{ .Revision }} key: source-v2-{{ .Branch }}-{{ .Revision }}
paths: paths:
# This is a broad list of cache paths to include many possible development environments # This is a broad list of cache paths to include many possible development environments
# You can probably delete some of these entries # You can probably delete some of these entries
@@ -78,6 +78,7 @@ jobs:
- ~/virtualenvs - ~/virtualenvs
- ~/.m2 - ~/.m2
- ~/.ivy2 - ~/.ivy2
- ~/.sbt
- ~/.bundle - ~/.bundle
- ~/.go_workspace - ~/.go_workspace
- ~/.gradle - ~/.gradle

View File

@@ -114,7 +114,8 @@ See [OpenAPI Tools wiki](https://github.com/OpenAPITools/openapi-generator/wiki/
- Add test case(s) to cover the change - Add test case(s) to cover the change
- Document the fix in the code to make the code more readable - Document the fix in the code to make the code more readable
- Make sure test cases passed after the change (one way is to leverage https://travis-ci.org/ to run the CI tests) - Make sure test cases passed after the change (one way is to leverage https://travis-ci.org/ to run the CI tests)
- File a PR with meaningful title, description and commit messages. - File a PR with meaningful title, description and commit messages
- Make sure the option "Allow edits from maintainers" in the PR is selected so that the maintainers can update your PRs with minor fixes, if needed.
- Recommended git settings - Recommended git settings
- `git config core.autocrlf input` to tell Git convert CRLF to LF on commit but not the other way around - `git config core.autocrlf input` to tell Git convert CRLF to LF on commit but not the other way around
- To close an issue (e.g. issue 1542) automatically after a PR is merged, use keywords "fix", "close", "resolve" in the PR description, e.g. `fix #1542`. (Ref: [closing issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/)) - To close an issue (e.g. issue 1542) automatically after a PR is merged, use keywords "fix", "close", "resolve" in the PR description, e.g. `fix #1542`. (Ref: [closing issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/))

View File

@@ -5,6 +5,7 @@ sidebar_label: go-experimental
| Option | Description | Values | Default | | Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- | | ------ | ----------- | ------ | ------- |
|disallowAdditionalPropertiesIfNotPresent|Specify the behavior when the 'additionalProperties' keyword is not present in the OAS document. If false: the 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications. If true: when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.This setting is currently ignored for OAS 2.0 documents: 1) When the 'additionalProperties' keyword is not present in a 2.0 schema, additional properties are NOT allowed. 2) Boolean values of the 'additionalProperties' keyword are ignored. It's as if additional properties are NOT allowed.Note: the root cause are issues #1369 and #1371, which must be resolved in the swagger-parser project.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.</dd></dl>|true|
|enumClassPrefix|Prefix enum with class name| |false| |enumClassPrefix|Prefix enum with class name| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|isGoSubmodule|whether the generated Go module is a submodule| |false| |isGoSubmodule|whether the generated Go module is a submodule| |false|

View File

@@ -31,7 +31,7 @@ sidebar_label: java
|invokerPackage|root package for generated code| |org.openapitools.client| |invokerPackage|root package for generated code| |org.openapitools.client|
|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|true| |java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|true|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<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| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<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|
|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 11.x. JSON processing: Jackson 2.9.x.</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: Jackson 2.9.x</dd></dl>|okhttp-gson| |library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x.</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: Jackson 2.9.x</dd></dl>|okhttp-gson|
|licenseName|The name of the license| |Unlicense| |licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org| |licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.client.model| |modelPackage|package for generated models| |org.openapitools.client.model|
@@ -52,6 +52,7 @@ sidebar_label: java
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src/main/java| |sourceFolder|source folder for generated code| |src/main/java|
|supportJava6|Whether to support Java6 with the Jersey1 library. This option has been deprecated and will be removed in the 5.x release| |false| |supportJava6|Whether to support Java6 with the Jersey1 library. This option has been deprecated and will be removed in the 5.x release| |false|
|useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate library| |false|
|useBeanValidation|Use BeanValidation API annotations| |false| |useBeanValidation|Use BeanValidation API annotations| |false|
|useGzipFeature|Send gzip-encoded requests| |false| |useGzipFeature|Send gzip-encoded requests| |false|
|usePlayWS|Use Play! Async HTTP client (Play WS API)| |false| |usePlayWS|Use Play! Async HTTP client (Play WS API)| |false|

View File

@@ -7,6 +7,7 @@ sidebar_label: powershell
| ------ | ----------- | ------ | ------- | | ------ | ----------- | ------ | ------- |
|apiNamePrefix|Prefix that will be appended to all PS objects. Default: empty string. e.g. Pet =&gt; PSPet.| |null| |apiNamePrefix|Prefix that will be appended to all PS objects. Default: empty string. e.g. Pet =&gt; PSPet.| |null|
|commonVerbs|PS common verb mappings. e.g. Delete=Remove:Patch=Update to map Delete with Remove and Patch with Update accordingly.| |null| |commonVerbs|PS common verb mappings. e.g. Delete=Remove:Patch=Update to map Delete with Remove and Patch with Update accordingly.| |null|
|disallowAdditionalPropertiesIfNotPresent|Specify the behavior when the 'additionalProperties' keyword is not present in the OAS document. If false: the 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications. If true: when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.This setting is currently ignored for OAS 2.0 documents: 1) When the 'additionalProperties' keyword is not present in a 2.0 schema, additional properties are NOT allowed. 2) Boolean values of the 'additionalProperties' keyword are ignored. It's as if additional properties are NOT allowed.Note: the root cause are issues #1369 and #1371, which must be resolved in the swagger-parser project.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.</dd></dl>|true|
|discardReadOnly|Set discardReadonly to true to generate the Initialize cmdlet without readonly parameters| |null| |discardReadOnly|Set discardReadonly to true to generate the Initialize cmdlet without readonly parameters| |null|
|packageGuid|GUID for PowerShell module (e.g. a27b908d-2a20-467f-bc32-af6f3a654ac5). A random GUID will be generated by default.| |null| |packageGuid|GUID for PowerShell module (e.g. a27b908d-2a20-467f-bc32-af6f3a654ac5). A random GUID will be generated by default.| |null|
|packageName|Client package name (e.g. PSTwitter).| |PSOpenAPITools| |packageName|Client package name (e.g. PSTwitter).| |PSOpenAPITools|

View File

@@ -16,7 +16,7 @@ sidebar_label: typescript-angular
|modelFileSuffix|The suffix of the file of the generated model (model&lt;suffix&gt;.ts).| |null| |modelFileSuffix|The suffix of the file of the generated model (model&lt;suffix&gt;.ts).| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|modelSuffix|The suffix of the generated model.| |null| |modelSuffix|The suffix of the generated model.| |null|
|ngVersion|The version of Angular. (At least 6.0.0)| |9.0.0| |ngVersion|The version of Angular. (At least 6.0.0)| |10.0.0|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null| |npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null| |npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0| |npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
@@ -64,6 +64,7 @@ sidebar_label: typescript-angular
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -46,6 +46,7 @@ sidebar_label: typescript-angularjs-deprecated
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -47,6 +47,7 @@ sidebar_label: typescript-angularjs
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>String</li> <li>String</li>
<li>Set</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>
<li>number</li> <li>number</li>

View File

@@ -49,6 +49,7 @@ sidebar_label: typescript-aurelia
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -54,6 +54,7 @@ sidebar_label: typescript-axios
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -54,6 +54,7 @@ sidebar_label: typescript-fetch
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -55,6 +55,7 @@ sidebar_label: typescript-inversify
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -51,6 +51,7 @@ sidebar_label: typescript-jquery
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -54,6 +54,7 @@ sidebar_label: typescript-node
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>RequestDetailedFile</li> <li>RequestDetailedFile</li>
<li>RequestFile</li> <li>RequestFile</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -52,6 +52,7 @@ sidebar_label: typescript-redux-query
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -52,6 +52,7 @@ sidebar_label: typescript-rxjs
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -27,6 +27,10 @@ Please refer to https://github.com/upstart-commerce/sbt-openapi-generator
Please refer to https://github.com/OpenAPITools/openapi-generator-bazel Please refer to https://github.com/OpenAPITools/openapi-generator-bazel
### Cake Addin
3rd-party Cake Addin provided by [Lukas Körfer](https://github.com/lukoerfer): https://github.com/lukoerfer/cake-openapi-generator
### GitHub Integration ### GitHub Integration
To push the auto-generated SDK to GitHub, we provide `git_push.sh` to streamline the process. For example: To push the auto-generated SDK to GitHub, we provide `git_push.sh` to streamline the process. For example:

View File

@@ -185,7 +185,7 @@
<properties> <properties>
<swagger-annotations-version>1.5.8</swagger-annotations-version> <swagger-annotations-version>1.5.8</swagger-annotations-version>
<jersey-version>2.27</jersey-version> <jersey-version>2.27</jersey-version>
<jackson-version>2.8.9</jackson-version> <jackson-version>2.9.10</jackson-version>
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version> <jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
<jodatime-version>2.7</jodatime-version> <jodatime-version>2.7</jodatime-version>
<maven-plugin-version>1.0.0</maven-plugin-version> <maven-plugin-version>1.0.0</maven-plugin-version>

View File

@@ -224,7 +224,7 @@
<properties> <properties>
<swagger-annotations-version>1.5.8</swagger-annotations-version> <swagger-annotations-version>1.5.8</swagger-annotations-version>
<jersey-version>2.27</jersey-version> <jersey-version>2.27</jersey-version>
<jackson-version>2.8.9</jackson-version> <jackson-version>2.9.10</jackson-version>
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version> <jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
<jodatime-version>2.7</jodatime-version> <jodatime-version>2.7</jodatime-version>
<maven-plugin-version>1.0.0</maven-plugin-version> <maven-plugin-version>1.0.0</maven-plugin-version>

View File

@@ -15,7 +15,7 @@
<properties> <properties>
<swagger-annotations-version>1.5.8</swagger-annotations-version> <swagger-annotations-version>1.5.8</swagger-annotations-version>
<jersey-version>2.27</jersey-version> <jersey-version>2.27</jersey-version>
<jackson-version>2.8.9</jackson-version> <jackson-version>2.9.10</jackson-version>
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version> <jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
<jodatime-version>2.7</jodatime-version> <jodatime-version>2.7</jodatime-version>
<maven-plugin-version>1.0.0</maven-plugin-version> <maven-plugin-version>1.0.0</maven-plugin-version>

View File

@@ -20,7 +20,7 @@
<groupId>org.openapitools</groupId> <groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId> <artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION --> <!-- RELEASE_VERSION -->
<version>4.3.1-SNAPSHOT</version> <version>5.0.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION --> <!-- /RELEASE_VERSION -->
<executions> <executions>
<execution> <execution>

View File

@@ -49,9 +49,11 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public Set<String> oneOf = new TreeSet<String>(); public Set<String> oneOf = new TreeSet<String>();
public Set<String> allOf = new TreeSet<String>(); public Set<String> allOf = new TreeSet<String>();
// The schema name as written in the OpenAPI document.
public String name; public String name;
// The language-specific name of the class that implements this schema. // The language-specific name of the class that implements this schema.
// The name of the class is derived from the OpenAPI schema name with formatting rules applied. // The name of the class is derived from the OpenAPI schema name with formatting rules applied.
// The classname is derived from the OpenAPI schema name, with sanitization and escaping rules applied.
public String classname; public String classname;
// The value of the 'title' attribute in the OpenAPI document. // The value of the 'title' attribute in the OpenAPI document.
public String title; public String title;
@@ -220,6 +222,17 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
this.classVarName = classVarName; this.classVarName = classVarName;
} }
/**
* Return true if the classname property is sanitized, false if it is the same as the OpenAPI schema name.
* The OpenAPI schema name may be any valid JSON schema name, including non-ASCII characters.
* The name of the class may have to be sanitized with character escaping.
*
* @return true if the classname property is sanitized
*/
public boolean getIsClassnameSanitized() {
return !classname.equals(name);
}
public String getClassname() { public String getClassname() {
return classname; return classname;
} }

View File

@@ -1768,7 +1768,7 @@ public class DefaultCodegen implements CodegenConfig {
if (encoding != null) { if (encoding != null) {
codegenParameter.contentType = encoding.getContentType(); codegenParameter.contentType = encoding.getContentType();
} else { } else {
LOGGER.debug("encoding not specified for " + codegenParameter.baseName); LOGGER.debug("encoding not specified for {}", codegenParameter.baseName);
} }
} }
} }
@@ -1790,6 +1790,9 @@ public class DefaultCodegen implements CodegenConfig {
/** /**
* Return the default value of the property * Return the default value of the property
* *
* Return null if you do NOT want a default value.
* Any non-null value will cause {{#defaultValue} check to pass.
*
* @param schema Property schema * @param schema Property schema
* @return string presentation of the default value of the property * @return string presentation of the default value of the property
*/ */
@@ -1810,7 +1813,7 @@ public class DefaultCodegen implements CodegenConfig {
*/ */
@SuppressWarnings("squid:S3923") @SuppressWarnings("squid:S3923")
private String getPropertyDefaultValue(Schema schema) { private String getPropertyDefaultValue(Schema schema) {
/** /*
* Although all branches return null, this is left intentionally as examples for new contributors * Although all branches return null, this is left intentionally as examples for new contributors
*/ */
if (ModelUtils.isBooleanSchema(schema)) { if (ModelUtils.isBooleanSchema(schema)) {
@@ -1960,10 +1963,10 @@ public class DefaultCodegen implements CodegenConfig {
/** /**
* Return a string representation of the schema type, resolving aliasing and references if necessary. * Return a string representation of the schema type, resolving aliasing and references if necessary.
* *
* @param schema * @param schema input
* @return the string representation of the schema type. * @return the string representation of the schema type.
*/ */
private String getSingleSchemaType(Schema schema) { protected String getSingleSchemaType(Schema schema) {
Schema unaliasSchema = ModelUtils.unaliasSchema(this.openAPI, schema, importMapping); Schema unaliasSchema = ModelUtils.unaliasSchema(this.openAPI, schema, importMapping);
if (StringUtils.isNotBlank(unaliasSchema.get$ref())) { // reference to another definition/schema if (StringUtils.isNotBlank(unaliasSchema.get$ref())) { // reference to another definition/schema
@@ -2514,7 +2517,11 @@ public class DefaultCodegen implements CodegenConfig {
// process 'additionalProperties' // process 'additionalProperties'
if (schema.getAdditionalProperties() == null) { if (schema.getAdditionalProperties() == null) {
m.isAdditionalPropertiesTrue = false; // TODO fix the old (incorrect) behaviour (likely with an option) if (disallowAdditionalPropertiesIfNotPresent) {
m.isAdditionalPropertiesTrue = false;
} else {
m.isAdditionalPropertiesTrue = true;
}
} else if (schema.getAdditionalProperties() instanceof Boolean) { } else if (schema.getAdditionalProperties() instanceof Boolean) {
if (Boolean.TRUE.equals(schema.getAdditionalProperties())) { if (Boolean.TRUE.equals(schema.getAdditionalProperties())) {
m.isAdditionalPropertiesTrue = true; m.isAdditionalPropertiesTrue = true;
@@ -5902,7 +5909,7 @@ public class DefaultCodegen implements CodegenConfig {
if (ModelUtils.isMapSchema(schema)) { if (ModelUtils.isMapSchema(schema)) {
// Schema with additionalproperties: true (including composed schemas with additionalproperties: true) // Schema with additionalproperties: true (including composed schemas with additionalproperties: true)
if (ModelUtils.isGenerateAliasAsModel() && StringUtils.isNotBlank(name)) { if (ModelUtils.isGenerateAliasAsModel(schema) && StringUtils.isNotBlank(name)) {
this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, true); this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, true);
} else { } else {
Schema inner = getAdditionalProperties(schema); Schema inner = getAdditionalProperties(schema);
@@ -5943,7 +5950,7 @@ public class DefaultCodegen implements CodegenConfig {
setParameterNullable(codegenParameter, codegenProperty); setParameterNullable(codegenParameter, codegenProperty);
} }
} else if (ModelUtils.isArraySchema(schema)) { } else if (ModelUtils.isArraySchema(schema)) {
if (ModelUtils.isGenerateAliasAsModel() && StringUtils.isNotBlank(name)) { if (ModelUtils.isGenerateAliasAsModel(schema) && StringUtils.isNotBlank(name)) {
this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, true); this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, true);
} else { } else {
final ArraySchema arraySchema = (ArraySchema) schema; final ArraySchema arraySchema = (ArraySchema) schema;

View File

@@ -452,13 +452,13 @@ public class DefaultGenerator implements Generator {
// A composed schema (allOf, oneOf, anyOf) is considered a Map schema if the additionalproperties attribute is set // A composed schema (allOf, oneOf, anyOf) is considered a Map schema if the additionalproperties attribute is set
// for that composed schema. However, in the case of a composed schema, the properties are defined or referenced // for that composed schema. However, in the case of a composed schema, the properties are defined or referenced
// in the inner schemas, and the outer schema does not have properties. // in the inner schemas, and the outer schema does not have properties.
if (!ModelUtils.isGenerateAliasAsModel() && !ModelUtils.isComposedSchema(schema) && (schema.getProperties() == null || schema.getProperties().isEmpty())) { if (!ModelUtils.isGenerateAliasAsModel(schema) && !ModelUtils.isComposedSchema(schema) && (schema.getProperties() == null || schema.getProperties().isEmpty())) {
// schema without property, i.e. alias to map // schema without property, i.e. alias to map
LOGGER.info("Model {} not generated since it's an alias to map (without property) and `generateAliasAsModel` is set to false (default)", name); LOGGER.info("Model {} not generated since it's an alias to map (without property) and `generateAliasAsModel` is set to false (default)", name);
continue; continue;
} }
} else if (ModelUtils.isArraySchema(schema)) { // check to see if it's an "array" model } else if (ModelUtils.isArraySchema(schema)) { // check to see if it's an "array" model
if (!ModelUtils.isGenerateAliasAsModel() && (schema.getProperties() == null || schema.getProperties().isEmpty())) { if (!ModelUtils.isGenerateAliasAsModel(schema) && (schema.getProperties() == null || schema.getProperties().isEmpty())) {
// schema without property, i.e. alias to array // schema without property, i.e. alias to array
LOGGER.info("Model {} not generated since it's an alias to array (without property) and `generateAliasAsModel` is set to false (default)", name); LOGGER.info("Model {} not generated since it's an alias to array (without property) and `generateAliasAsModel` is set to false (default)", name);
continue; continue;

View File

@@ -469,6 +469,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
importMapping.put("JsonProperty", "com.fasterxml.jackson.annotation.JsonProperty"); importMapping.put("JsonProperty", "com.fasterxml.jackson.annotation.JsonProperty");
importMapping.put("JsonSubTypes", "com.fasterxml.jackson.annotation.JsonSubTypes"); importMapping.put("JsonSubTypes", "com.fasterxml.jackson.annotation.JsonSubTypes");
importMapping.put("JsonTypeInfo", "com.fasterxml.jackson.annotation.JsonTypeInfo"); importMapping.put("JsonTypeInfo", "com.fasterxml.jackson.annotation.JsonTypeInfo");
importMapping.put("JsonTypeName", "com.fasterxml.jackson.annotation.JsonTypeName");
importMapping.put("JsonCreator", "com.fasterxml.jackson.annotation.JsonCreator"); importMapping.put("JsonCreator", "com.fasterxml.jackson.annotation.JsonCreator");
importMapping.put("JsonValue", "com.fasterxml.jackson.annotation.JsonValue"); importMapping.put("JsonValue", "com.fasterxml.jackson.annotation.JsonValue");
importMapping.put("JsonIgnore", "com.fasterxml.jackson.annotation.JsonIgnore"); importMapping.put("JsonIgnore", "com.fasterxml.jackson.annotation.JsonIgnore");

View File

@@ -43,8 +43,8 @@ import java.util.*;
import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.camelize;
import static org.openapitools.codegen.utils.StringUtils.underscore; import static org.openapitools.codegen.utils.StringUtils.underscore;
public class PythonAbstractConnexionServerCodegen extends DefaultCodegen implements CodegenConfig { public abstract class AbstractPythonConnexionServerCodegen extends DefaultCodegen implements CodegenConfig {
private static final Logger LOGGER = LoggerFactory.getLogger(PythonAbstractConnexionServerCodegen.class); private static final Logger LOGGER = LoggerFactory.getLogger(AbstractPythonConnexionServerCodegen.class);
public static final String CONTROLLER_PACKAGE = "controllerPackage"; public static final String CONTROLLER_PACKAGE = "controllerPackage";
public static final String DEFAULT_CONTROLLER = "defaultController"; public static final String DEFAULT_CONTROLLER = "defaultController";
@@ -64,7 +64,7 @@ public class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme
protected boolean useNose = Boolean.FALSE; protected boolean useNose = Boolean.FALSE;
protected String pythonSrcRoot; protected String pythonSrcRoot;
public PythonAbstractConnexionServerCodegen(String templateDirectory, boolean fixBodyNameValue) { public AbstractPythonConnexionServerCodegen(String templateDirectory, boolean fixBodyNameValue) {
super(); super();
modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme)); modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme));
@@ -248,7 +248,7 @@ public class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme
pySrcRoot = val.replaceAll("[/\\\\]+$", ""); pySrcRoot = val.replaceAll("[/\\\\]+$", "");
} }
if (pySrcRoot.isEmpty() || pySrcRoot == ".") { if (pySrcRoot.isEmpty() || ".".equals(pySrcRoot)) {
this.pythonSrcRoot = ""; this.pythonSrcRoot = "";
} else { } else {
this.pythonSrcRoot = pySrcRoot + File.separator; this.pythonSrcRoot = pySrcRoot + File.separator;

View File

@@ -130,7 +130,8 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
"File", "File",
"Error", "Error",
"Map", "Map",
"object" "object",
"Set"
)); ));
languageGenericTypes = new HashSet<>(Collections.singletonList( languageGenericTypes = new HashSet<>(Collections.singletonList(
@@ -140,6 +141,8 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
instantiationTypes.put("array", "Array"); instantiationTypes.put("array", "Array");
typeMapping = new HashMap<String, String>(); typeMapping = new HashMap<String, String>();
typeMapping.put("Set", "Set");
typeMapping.put("set", "Set");
typeMapping.put("Array", "Array"); typeMapping.put("Array", "Array");
typeMapping.put("array", "Array"); typeMapping.put("array", "Array");
typeMapping.put("boolean", "boolean"); typeMapping.put("boolean", "boolean");
@@ -846,7 +849,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
*/ */
protected List<String> getTypesFromSchemas(List<Schema> schemas) { protected List<String> getTypesFromSchemas(List<Schema> schemas) {
List<Schema> filteredSchemas = schemas.size() > 1 List<Schema> filteredSchemas = schemas.size() > 1
? schemas.stream().filter(schema -> super.getSchemaType(schema) != "AnyType").collect(Collectors.toList()) ? schemas.stream().filter(schema -> !"AnyType".equals(super.getSchemaType(schema))).collect(Collectors.toList())
: schemas; : schemas;
return filteredSchemas.stream().map(schema -> { return filteredSchemas.stream().map(schema -> {

View File

@@ -335,7 +335,7 @@ public class CppUE4ClientCodegen extends AbstractCppCodegen {
public String modelFilename(String templateName, String modelName) { public String modelFilename(String templateName, String modelName) {
String suffix = modelTemplateFiles().get(templateName); String suffix = modelTemplateFiles().get(templateName);
String folder = privateFolder; String folder = privateFolder;
if (suffix == ".h") { if (".h".equals(suffix)) {
folder = publicFolder; folder = publicFolder;
} }

View File

@@ -17,6 +17,7 @@
package org.openapitools.codegen.languages; package org.openapitools.codegen.languages;
import com.google.common.collect.Sets;
import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.Schema;
@@ -30,9 +31,8 @@ import org.slf4j.LoggerFactory;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.nio.charset.Charset; import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.camelize;
@@ -50,6 +50,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
public static final String PUB_HOMEPAGE = "pubHomepage"; public static final String PUB_HOMEPAGE = "pubHomepage";
public static final String USE_ENUM_EXTENSION = "useEnumExtension"; public static final String USE_ENUM_EXTENSION = "useEnumExtension";
public static final String SUPPORT_DART2 = "supportDart2"; public static final String SUPPORT_DART2 = "supportDart2";
protected boolean browserClient = true; protected boolean browserClient = true;
protected String pubName = "openapi"; protected String pubName = "openapi";
protected String pubVersion = "1.0.0"; protected String pubVersion = "1.0.0";
@@ -106,9 +107,11 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
modelTestTemplateFiles.put("model_test.mustache", ".dart"); modelTestTemplateFiles.put("model_test.mustache", ".dart");
apiTestTemplateFiles.put("api_test.mustache", ".dart"); apiTestTemplateFiles.put("api_test.mustache", ".dart");
List<String> reservedWordsList = new ArrayList<String>(); List<String> reservedWordsList = new ArrayList<>();
try { try {
BufferedReader reader = new BufferedReader(new InputStreamReader(DartClientCodegen.class.getResourceAsStream("/dart/dart-keywords.txt"), Charset.forName("UTF-8"))); BufferedReader reader = new BufferedReader(
new InputStreamReader(DartClientCodegen.class.getResourceAsStream("/dart/dart-keywords.txt"),
StandardCharsets.UTF_8));
while (reader.ready()) { while (reader.ready()) {
reservedWordsList.add(reader.readLine()); reservedWordsList.add(reader.readLine());
} }
@@ -118,18 +121,17 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
} }
setReservedWordsLowerCase(reservedWordsList); setReservedWordsLowerCase(reservedWordsList);
languageSpecificPrimitives = new HashSet<String>( languageSpecificPrimitives = Sets.newHashSet(
Arrays.asList( "String",
"String", "bool",
"bool", "int",
"int", "num",
"num", "double"
"double")
); );
instantiationTypes.put("array", "List"); instantiationTypes.put("array", "List");
instantiationTypes.put("map", "Map"); instantiationTypes.put("map", "Map");
typeMapping = new HashMap<String, String>(); typeMapping = new HashMap<>();
typeMapping.put("Array", "List"); typeMapping.put("Array", "List");
typeMapping.put("array", "List"); typeMapping.put("array", "List");
typeMapping.put("List", "List"); typeMapping.put("List", "List");
@@ -329,7 +331,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
// replace - with _ e.g. created-at => created_at // replace - with _ e.g. created-at => created_at
name = name.replaceAll("-", "_"); name = name.replaceAll("-", "_");
// if it's all uppper case, do nothing // if it's all upper case, do nothing
if (name.matches("^[A-Z_]*$")) { if (name.matches("^[A-Z_]*$")) {
return name; return name;
} }
@@ -403,9 +405,9 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
@Override @Override
public String toDefaultValue(Schema schema) { public String toDefaultValue(Schema schema) {
if (ModelUtils.isMapSchema(schema)) { if (ModelUtils.isMapSchema(schema)) {
return "{}"; return "const {}";
} else if (ModelUtils.isArraySchema(schema)) { } else if (ModelUtils.isArraySchema(schema)) {
return "[]"; return "const []";
} }
if (schema.getDefault() != null) { if (schema.getDefault() != null) {
@@ -414,7 +416,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
} }
return schema.getDefault().toString(); return schema.getDefault().toString();
} else { } else {
return "null"; return null;
} }
} }
@@ -435,7 +437,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
@Override @Override
public String getSchemaType(Schema p) { public String getSchemaType(Schema p) {
String openAPIType = super.getSchemaType(p); String openAPIType = super.getSchemaType(p);
String type = null; String type;
if (typeMapping.containsKey(openAPIType)) { if (typeMapping.containsKey(openAPIType)) {
type = typeMapping.get(openAPIType); type = typeMapping.get(openAPIType);
if (languageSpecificPrimitives.contains(type)) { if (languageSpecificPrimitives.contains(type)) {
@@ -495,19 +497,16 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
return false; return false;
} }
Object extension = cm.vendorExtensions.get("x-enum-values"); Object extension = cm.vendorExtensions.get("x-enum-values");
List<Map<String, Object>> values = List<Map<String, Object>> values = (List<Map<String, Object>>) extension;
(List<Map<String, Object>>) extension; List<Map<String, String>> enumVars = new ArrayList<>();
List<Map<String, String>> enumVars =
new ArrayList<Map<String, String>>();
for (Map<String, Object> value : values) { for (Map<String, Object> value : values) {
Map<String, String> enumVar = new HashMap<String, String>(); Map<String, String> enumVar = new HashMap<>();
String name = camelize((String) value.get("identifier"), true); String name = camelize((String) value.get("identifier"), true);
if (isReservedWord(name)) { if (isReservedWord(name)) {
name = escapeReservedWord(name); name = escapeReservedWord(name);
} }
enumVar.put("name", name); enumVar.put("name", name);
enumVar.put("value", toEnumValue( enumVar.put("value", toEnumValue(value.get("numericValue").toString(), cm.dataType));
value.get("numericValue").toString(), cm.dataType));
if (value.containsKey("description")) { if (value.containsKey("description")) {
enumVar.put("description", value.get("description").toString()); enumVar.put("description", value.get("description").toString());
} }
@@ -611,13 +610,12 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
} }
// only procees the following type (or we can simply rely on the file extension to check if it's a Dart file) // only procees the following type (or we can simply rely on the file extension to check if it's a Dart file)
Set<String> supportedFileType = new HashSet<String>( Set<String> supportedFileType = Sets.newHashSet(
Arrays.asList( "supporting-mustache",
"supporting-mustache", "model-test",
"model-test", "model",
"model", "api-test",
"api-test", "api");
"api"));
if (!supportedFileType.contains(fileType)) { if (!supportedFileType.contains(fileType)) {
return; return;
} }
@@ -632,7 +630,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
if (exitValue != 0) { if (exitValue != 0) {
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue); LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: {}", command);
} }
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());

View File

@@ -130,13 +130,21 @@ public class DartDioClientCodegen extends DartClientCodegen {
} }
@Override @Override
public String toDefaultValue(Schema p) { public String toDefaultValue(Schema schema) {
if (ModelUtils.isMapSchema(p)) { if (ModelUtils.isMapSchema(schema)) {
return "const {}"; return "const {}";
} else if (ModelUtils.isArraySchema(p)) { } else if (ModelUtils.isArraySchema(schema)) {
return "const []"; return "const []";
} }
return super.toDefaultValue(p);
if (schema.getDefault() != null) {
if (ModelUtils.isStringSchema(schema)) {
return "\"" + schema.getDefault().toString().replaceAll("\"", "\\\"") + "\"";
}
return schema.getDefault().toString();
} else {
return "null";
}
} }
@Override @Override

View File

@@ -132,13 +132,21 @@ public class DartJaguarClientCodegen extends DartClientCodegen {
} }
@Override @Override
public String toDefaultValue(Schema p) { public String toDefaultValue(Schema schema) {
if (ModelUtils.isMapSchema(p)) { if (ModelUtils.isMapSchema(schema)) {
return "const {}"; return "const {}";
} else if (ModelUtils.isArraySchema(p)) { } else if (ModelUtils.isArraySchema(schema)) {
return "const []"; return "const []";
} }
return super.toDefaultValue(p);
if (schema.getDefault() != null) {
if (ModelUtils.isStringSchema(schema)) {
return "\"" + schema.getDefault().toString().replaceAll("\"", "\\\"") + "\"";
}
return schema.getDefault().toString();
} else {
return "null";
}
} }
@Override @Override

View File

@@ -47,6 +47,21 @@ public class GoClientExperimentalCodegen extends GoClientCodegen {
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata).stability(Stability.EXPERIMENTAL).build(); generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata).stability(Stability.EXPERIMENTAL).build();
cliOptions.add(new CliOption(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC).defaultValue("false")); cliOptions.add(new CliOption(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC).defaultValue("false"));
// option to change how we process + set the data in the 'additionalProperties' keyword.
CliOption disallowAdditionalPropertiesIfNotPresentOpt = CliOption.newBoolean(
CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT,
CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT_DESC).defaultValue(Boolean.TRUE.toString());
Map<String, String> disallowAdditionalPropertiesIfNotPresentOpts = new HashMap<>();
disallowAdditionalPropertiesIfNotPresentOpts.put("false",
"The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.");
disallowAdditionalPropertiesIfNotPresentOpts.put("true",
"when the 'additionalProperties' keyword is not present in a schema, " +
"the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. " +
"Note: this mode is not compliant with the JSON schema specification. " +
"This is the original openapi-generator behavior.");
disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts);
cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt);
this.setDisallowAdditionalPropertiesIfNotPresent(true);
} }
/** /**
@@ -102,6 +117,11 @@ public class GoClientExperimentalCodegen extends GoClientCodegen {
additionalProperties.put(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, useOneOfDiscriminatorLookup); additionalProperties.put(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, useOneOfDiscriminatorLookup);
} }
if (additionalProperties.containsKey(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT)) {
this.setDisallowAdditionalPropertiesIfNotPresent(Boolean.valueOf(additionalProperties
.get(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT).toString()));
}
} }
public void setUseOneOfDiscriminatorLookup(boolean useOneOfDiscriminatorLookup) { public void setUseOneOfDiscriminatorLookup(boolean useOneOfDiscriminatorLookup) {
@@ -222,6 +242,13 @@ public class GoClientExperimentalCodegen extends GoClientCodegen {
if (model.anyOf != null && !model.anyOf.isEmpty()) { if (model.anyOf != null && !model.anyOf.isEmpty()) {
imports.add(createMapping("import", "fmt")); imports.add(createMapping("import", "fmt"));
} }
// additionalProperties: true and parent
if (model.isAdditionalPropertiesTrue && model.parent != null && Boolean.FALSE.equals(model.isMapModel)) {
imports.add(createMapping("import", "reflect"));
imports.add(createMapping("import", "strings"));
}
} }
} }
return objs; return objs;

View File

@@ -1400,7 +1400,7 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
@Override @Override
public String toDefaultValue(Schema p) { public String toDefaultValue(Schema p) {
if (ModelUtils.isGenerateAliasAsModel() && StringUtils.isNotEmpty(p.get$ref())) { if (ModelUtils.isGenerateAliasAsModel(p) && StringUtils.isNotEmpty(p.get$ref())) {
Schema<?> ref = ModelUtils.getReferencedSchema(this.openAPI, p); Schema<?> ref = ModelUtils.getReferencedSchema(this.openAPI, p);
if (ModelUtils.isArraySchema(ref) || ModelUtils.isMapSchema(ref)) { if (ModelUtils.isArraySchema(ref) || ModelUtils.isMapSchema(ref)) {
String typeDeclaration = getTypeDeclaration(p); String typeDeclaration = getTypeDeclaration(p);

View File

@@ -60,6 +60,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
public static final String USE_RUNTIME_EXCEPTION = "useRuntimeException"; public static final String USE_RUNTIME_EXCEPTION = "useRuntimeException";
public static final String USE_REFLECTION_EQUALS_HASHCODE = "useReflectionEqualsHashCode"; public static final String USE_REFLECTION_EQUALS_HASHCODE = "useReflectionEqualsHashCode";
public static final String CASE_INSENSITIVE_RESPONSE_HEADERS = "caseInsensitiveResponseHeaders"; public static final String CASE_INSENSITIVE_RESPONSE_HEADERS = "caseInsensitiveResponseHeaders";
public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles";
public static final String PLAY_24 = "play24"; public static final String PLAY_24 = "play24";
public static final String PLAY_25 = "play25"; public static final String PLAY_25 = "play25";
@@ -99,6 +100,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
protected boolean useRuntimeException = false; protected boolean useRuntimeException = false;
protected boolean useReflectionEqualsHashCode = false; protected boolean useReflectionEqualsHashCode = false;
protected boolean caseInsensitiveResponseHeaders = false; protected boolean caseInsensitiveResponseHeaders = false;
protected boolean useAbstractionForFiles = false;
protected String authFolder; protected String authFolder;
protected String serializationLibrary = null; protected String serializationLibrary = null;
@@ -140,10 +142,11 @@ public class JavaClientCodegen extends AbstractJavaCodegen
cliOptions.add(CliOption.newBoolean(ASYNC_NATIVE, "If true, async handlers will be used, instead of the sync version")); cliOptions.add(CliOption.newBoolean(ASYNC_NATIVE, "If true, async handlers will be used, instead of the sync version"));
cliOptions.add(CliOption.newBoolean(USE_REFLECTION_EQUALS_HASHCODE, "Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.")); cliOptions.add(CliOption.newBoolean(USE_REFLECTION_EQUALS_HASHCODE, "Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact."));
cliOptions.add(CliOption.newBoolean(CASE_INSENSITIVE_RESPONSE_HEADERS, "Make API response's headers case-insensitive. Available on " + OKHTTP_GSON + ", " + JERSEY2 + " libraries")); cliOptions.add(CliOption.newBoolean(CASE_INSENSITIVE_RESPONSE_HEADERS, "Make API response's headers case-insensitive. Available on " + OKHTTP_GSON + ", " + JERSEY2 + " libraries"));
cliOptions.add(CliOption.newBoolean(USE_ABSTRACTION_FOR_FILES, "Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on " + RESTTEMPLATE + " library"));
supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead."); supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.");
supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x"); supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x");
supportedLibraries.put(FEIGN, "HTTP client: OpenFeign 11.x. JSON processing: Jackson 2.9.x."); supportedLibraries.put(FEIGN, "HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x.");
supportedLibraries.put(OKHTTP_GSON, "[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'."); supportedLibraries.put(OKHTTP_GSON, "[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.");
supportedLibraries.put(RETROFIT_2, "HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)"); supportedLibraries.put(RETROFIT_2, "HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)");
supportedLibraries.put(RESTTEMPLATE, "HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x"); supportedLibraries.put(RESTTEMPLATE, "HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x");
@@ -285,6 +288,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
this.setUseReflectionEqualsHashCode(convertPropertyToBooleanAndWriteBack(CASE_INSENSITIVE_RESPONSE_HEADERS)); this.setUseReflectionEqualsHashCode(convertPropertyToBooleanAndWriteBack(CASE_INSENSITIVE_RESPONSE_HEADERS));
} }
if (additionalProperties.containsKey(USE_ABSTRACTION_FOR_FILES)) {
this.setUseAbstractionForFiles(convertPropertyToBooleanAndWriteBack(USE_ABSTRACTION_FOR_FILES));
}
final String invokerFolder = (sourceFolder + '/' + invokerPackage).replace(".", "/"); final String invokerFolder = (sourceFolder + '/' + invokerPackage).replace(".", "/");
final String apiFolder = (sourceFolder + '/' + apiPackage).replace(".", "/"); final String apiFolder = (sourceFolder + '/' + apiPackage).replace(".", "/");
authFolder = (sourceFolder + '/' + invokerPackage + ".auth").replace(".", "/"); authFolder = (sourceFolder + '/' + invokerPackage + ".auth").replace(".", "/");
@@ -392,9 +399,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
} else if (NATIVE.equals(getLibrary())) { } else if (NATIVE.equals(getLibrary())) {
setJava8Mode(true); setJava8Mode(true);
additionalProperties.put("java8", "true"); additionalProperties.put("java8", "true");
if (!asyncNative) { supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java"));
supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java"));
}
forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON); forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON);
} else if (RESTEASY.equals(getLibrary())) { } else if (RESTEASY.equals(getLibrary())) {
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java")); supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
@@ -682,6 +687,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
model.imports.add("JsonProperty"); model.imports.add("JsonProperty");
model.imports.add("JsonValue"); model.imports.add("JsonValue");
model.imports.add("JsonInclude"); model.imports.add("JsonInclude");
model.imports.add("JsonTypeName");
} }
if (additionalProperties.containsKey(SERIALIZATION_LIBRARY_GSON)) { if (additionalProperties.containsKey(SERIALIZATION_LIBRARY_GSON)) {
model.imports.add("SerializedName"); model.imports.add("SerializedName");
@@ -865,6 +871,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
this.caseInsensitiveResponseHeaders = caseInsensitiveResponseHeaders; this.caseInsensitiveResponseHeaders = caseInsensitiveResponseHeaders;
} }
public void setUseAbstractionForFiles(boolean useAbstractionForFiles) {
this.useAbstractionForFiles = useAbstractionForFiles;
}
/** /**
* Serialization library. * Serialization library.
* *

View File

@@ -203,4 +203,16 @@ public class PlantumlDocumentationCodegen extends DefaultCodegen implements Code
return value; return value;
} }
@Override
public String escapeQuotationMark(String input) {
// to surpress the warning message
return input;
}
@Override
public String escapeUnsafeCharacters(String input) {
// to surpress the warning message
return input;
}
} }

View File

@@ -501,6 +501,21 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
cliOptions.add(new CliOption("commonVerbs", "PS common verb mappings. e.g. Delete=Remove:Patch=Update to map Delete with Remove and Patch with Update accordingly.")); cliOptions.add(new CliOption("commonVerbs", "PS common verb mappings. e.g. Delete=Remove:Patch=Update to map Delete with Remove and Patch with Update accordingly."));
cliOptions.add(new CliOption(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC)); cliOptions.add(new CliOption(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC));
cliOptions.add(new CliOption("discardReadOnly", "Set discardReadonly to true to generate the Initialize cmdlet without readonly parameters")); cliOptions.add(new CliOption("discardReadOnly", "Set discardReadonly to true to generate the Initialize cmdlet without readonly parameters"));
// option to change how we process + set the data in the 'additionalProperties' keyword.
CliOption disallowAdditionalPropertiesIfNotPresentOpt = CliOption.newBoolean(
CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT,
CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT_DESC).defaultValue(Boolean.TRUE.toString());
Map<String, String> disallowAdditionalPropertiesIfNotPresentOpts = new HashMap<>();
disallowAdditionalPropertiesIfNotPresentOpts.put("false",
"The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.");
disallowAdditionalPropertiesIfNotPresentOpts.put("true",
"when the 'additionalProperties' keyword is not present in a schema, " +
"the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. " +
"Note: this mode is not compliant with the JSON schema specification. " +
"This is the original openapi-generator behavior.");
disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts);
cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt);
this.setDisallowAdditionalPropertiesIfNotPresent(true);
// default value in the template // default value in the template
additionalProperties.put("powershellVersion", "6.2"); // minimal PS version additionalProperties.put("powershellVersion", "6.2"); // minimal PS version
@@ -550,7 +565,7 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
public boolean getUseOneOfDiscriminatorLookup() { public boolean getUseOneOfDiscriminatorLookup() {
return this.useOneOfDiscriminatorLookup; return this.useOneOfDiscriminatorLookup;
} }
public void setDiscardReadOnly(boolean discardReadOnly) { public void setDiscardReadOnly(boolean discardReadOnly) {
this.discardReadOnly = discardReadOnly; this.discardReadOnly = discardReadOnly;
} }
@@ -632,6 +647,11 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
LOGGER.warn(CodegenConstants.API_PACKAGE + " with " + this.getName() + " generator is ignored. Setting this value independently of " + CodegenConstants.PACKAGE_NAME + " is not currently supported."); LOGGER.warn(CodegenConstants.API_PACKAGE + " with " + this.getName() + " generator is ignored. Setting this value independently of " + CodegenConstants.PACKAGE_NAME + " is not currently supported.");
} }
if (additionalProperties.containsKey(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT)) {
this.setDisallowAdditionalPropertiesIfNotPresent(Boolean.valueOf(additionalProperties
.get(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT).toString()));
}
additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage()); additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage());
additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage()); additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage());
@@ -931,13 +951,13 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
for (CodegenProperty cp : model.allVars) { for (CodegenProperty cp : model.allVars) {
cp.vendorExtensions.put("x-powershell-data-type", getPSDataType(cp)); cp.vendorExtensions.put("x-powershell-data-type", getPSDataType(cp));
if(this.discardReadOnly && !cp.isReadOnly) { if (this.discardReadOnly && !cp.isReadOnly) {
lastWritableProperty = cp; lastWritableProperty = cp;
} }
} }
// Mark the last readonly false property // Mark the last readonly false property
if(this.discardReadOnly && lastWritableProperty != null) { if (this.discardReadOnly && lastWritableProperty != null) {
lastWritableProperty.vendorExtensions.put("x-powershell-last-writable", true); lastWritableProperty.vendorExtensions.put("x-powershell-last-writable", true);
model.allVars.set(model.allVars.indexOf(lastWritableProperty), lastWritableProperty); model.allVars.set(model.allVars.indexOf(lastWritableProperty), lastWritableProperty);
} }
@@ -1181,4 +1201,29 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
return escapeText(pattern); return escapeText(pattern);
} }
@Override
public String toDefaultValue(Schema p) {
if (p.getDefault() != null) {
if (ModelUtils.isBooleanSchema(p)) {
if (Boolean.valueOf(p.getDefault().toString())) {
return "$true";
} else {
return "$false";
}
} else if (ModelUtils.isDateSchema(p)) {
LOGGER.warn("Default value for `date` not yet supported. Please open an issue with https://github.com/openapitools/openapi-generator");
} else if (ModelUtils.isDateTimeSchema(p)) {
LOGGER.warn("Default value for `datetime` not yet supported. Please open an issue with https://github.com/openapitools/openapi-generator");
} else if (ModelUtils.isNumberSchema(p)) {
return p.getDefault().toString();
} else if (ModelUtils.isIntegerSchema(p)) {
return p.getDefault().toString();
} else if (ModelUtils.isStringSchema(p)) {
return "\"" + p.getDefault() + "\"";
}
}
return null;
}
} }

View File

@@ -28,7 +28,6 @@ import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.meta.features.DocumentationFeature;
import org.openapitools.codegen.meta.features.SecurityFeature; import org.openapitools.codegen.meta.features.SecurityFeature;
import org.openapitools.codegen.meta.features.WireFormatFeature; import org.openapitools.codegen.meta.features.WireFormatFeature;
import org.openapitools.codegen.utils.ProcessUtils;
import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ModelUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -216,13 +215,12 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf
public Map<String, Object> postProcessModels(Map<String, Object> objs) { public Map<String, Object> postProcessModels(Map<String, Object> objs) {
objs = postProcessModelsEnum(objs); objs = postProcessModelsEnum(objs);
List<Object> models = (List<Object>) objs.get("models"); List<Object> models = (List<Object>) objs.get("models");
// add x-index to properties
ProcessUtils.addIndexToProperties(models, 1);
for (Object _mo : models) { for (Object _mo : models) {
Map<String, Object> mo = (Map<String, Object>) _mo; Map<String, Object> mo = (Map<String, Object>) _mo;
CodegenModel cm = (CodegenModel) mo.get("model"); CodegenModel cm = (CodegenModel) mo.get("model");
int index = 1;
for (CodegenProperty var : cm.vars) { for (CodegenProperty var : cm.vars) {
// add x-protobuf-type: repeated if it's an array // add x-protobuf-type: repeated if it's an array
if (Boolean.TRUE.equals(var.isListContainer)) { if (Boolean.TRUE.equals(var.isListContainer)) {
@@ -247,6 +245,10 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf
enumIndex++; enumIndex++;
} }
} }
// Add x-protobuf-index, unless already specified
var.vendorExtensions.putIfAbsent("x-protobuf-index", index);
index++;
} }
} }
return objs; return objs;
@@ -422,7 +424,7 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf
} }
} }
p.vendorExtensions.put("x-index", index); p.vendorExtensions.putIfAbsent("x-protobuf-index", index);
index++; index++;
} }

View File

@@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory;
import java.util.EnumSet; import java.util.EnumSet;
public class PythonAiohttpConnexionServerCodegen extends PythonAbstractConnexionServerCodegen { public class PythonAiohttpConnexionServerCodegen extends AbstractPythonConnexionServerCodegen {
private static final Logger LOGGER = LoggerFactory.getLogger(PythonAiohttpConnexionServerCodegen.class); private static final Logger LOGGER = LoggerFactory.getLogger(PythonAiohttpConnexionServerCodegen.class);
public PythonAiohttpConnexionServerCodegen() { public PythonAiohttpConnexionServerCodegen() {

View File

@@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.util.EnumSet; import java.util.EnumSet;
public class PythonBluePlanetServerCodegen extends PythonAbstractConnexionServerCodegen { public class PythonBluePlanetServerCodegen extends AbstractPythonConnexionServerCodegen {
private static final Logger LOGGER = LoggerFactory.getLogger(PythonBluePlanetServerCodegen.class); private static final Logger LOGGER = LoggerFactory.getLogger(PythonBluePlanetServerCodegen.class);
protected String modelDocPath = ""; protected String modelDocPath = "";

View File

@@ -140,6 +140,20 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
supportingFiles.remove(new SupportingFile("__init__model.mustache", packagePath() + File.separatorChar + "models", "__init__.py")); supportingFiles.remove(new SupportingFile("__init__model.mustache", packagePath() + File.separatorChar + "models", "__init__.py"));
supportingFiles.add(new SupportingFile("python-experimental/__init__model.mustache", packagePath() + File.separatorChar + "model", "__init__.py")); supportingFiles.add(new SupportingFile("python-experimental/__init__model.mustache", packagePath() + File.separatorChar + "model", "__init__.py"));
supportingFiles.remove(new SupportingFile("configuration.mustache", packagePath(), "configuration.py"));
supportingFiles.add(new SupportingFile("python-experimental/configuration.mustache", packagePath(), "configuration.py"));
supportingFiles.remove(new SupportingFile("__init__api.mustache", packagePath() + File.separatorChar + "api", "__init__.py"));
supportingFiles.add(new SupportingFile("python-experimental/__init__api.mustache", packagePath() + File.separatorChar + "api", "__init__.py"));
supportingFiles.remove(new SupportingFile("exceptions.mustache", packagePath(), "exceptions.py"));
supportingFiles.add(new SupportingFile("python-experimental/exceptions.mustache", packagePath(), "exceptions.py"));
if ("urllib3".equals(getLibrary())) {
supportingFiles.remove(new SupportingFile("rest.mustache", packagePath(), "rest.py"));
supportingFiles.add(new SupportingFile("python-experimental/rest.mustache", packagePath(), "rest.py"));
}
supportingFiles.remove(new SupportingFile("__init__package.mustache", packagePath(), "__init__.py")); supportingFiles.remove(new SupportingFile("__init__package.mustache", packagePath(), "__init__.py"));
supportingFiles.add(new SupportingFile("python-experimental/__init__package.mustache", packagePath(), "__init__.py")); supportingFiles.add(new SupportingFile("python-experimental/__init__package.mustache", packagePath(), "__init__.py"));
@@ -176,12 +190,18 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
supportingFiles.add(new SupportingFile(readmeTemplate, "", readmePath)); supportingFiles.add(new SupportingFile(readmeTemplate, "", readmePath));
if (!generateSourceCodeOnly) { if (!generateSourceCodeOnly) {
supportingFiles.remove(new SupportingFile("setup.mustache", "", "setup.py")); supportingFiles.remove(new SupportingFile("travis.mustache", "", ".travis.yml"));
supportingFiles.add(new SupportingFile("python-experimental/setup.mustache", "", "setup.py")); supportingFiles.add(new SupportingFile("python-experimental/travis.mustache", "", ".travis.yml"));
supportingFiles.remove(new SupportingFile("requirements.mustache", "", "requirements.txt")); supportingFiles.remove(new SupportingFile("gitlab-ci.mustache", "", ".gitlab-ci.yml"));
supportingFiles.add(new SupportingFile("python-experimental/requirements.mustache", "", "requirements.txt")); supportingFiles.add(new SupportingFile("python-experimental/gitlab-ci.mustache", "", ".gitlab-ci.yml"));
supportingFiles.remove(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt")); supportingFiles.remove(new SupportingFile("tox.mustache", "", "tox.ini"));
supportingFiles.add(new SupportingFile("python-experimental/test-requirements.mustache", "", "test-requirements.txt")); supportingFiles.add(new SupportingFile("python-experimental/tox.mustache", "", "tox.ini"));
supportingFiles.remove(new SupportingFile("setup.mustache", "", "setup.py"));
supportingFiles.add(new SupportingFile("python-experimental/setup.mustache", "", "setup.py"));
supportingFiles.remove(new SupportingFile("requirements.mustache", "", "requirements.txt"));
supportingFiles.add(new SupportingFile("python-experimental/requirements.mustache", "", "requirements.txt"));
supportingFiles.remove(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt"));
supportingFiles.add(new SupportingFile("python-experimental/test-requirements.mustache", "", "test-requirements.txt"));
} }
// default this to true so the python ModelSimple models will be generated // default this to true so the python ModelSimple models will be generated
@@ -309,133 +329,72 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
@Override @Override
public String toModelImport(String name) { public String toModelImport(String name) {
// name looks like cat.Cat // name looks like Cat
String moduleName = name.split("\\.")[0]; return "from " + modelPackage() + "." + toModelFilename(name) + " import "+ name;
// https://exceptionshub.com/circular-or-cyclic-imports-in-python.html
return "from " + modelPackage() + " import "+ moduleName;
}
private String robustImport(String name) {
// name looks like cat.Cat
String moduleName = name.split("\\.")[0];
// https://exceptionshub.com/circular-or-cyclic-imports-in-python.html
String modelImport = "try:\n from " + modelPackage() +
" import " + moduleName+ "\nexcept ImportError:\n " +
moduleName + " = sys.modules[\n '" + modelPackage() + "." + moduleName + "']";
return modelImport;
}
private String getPythonClassName(String name) {
// name looks like cat.Cat or Cat
String[] pieces = name.split("\\.");
if (pieces.length == 1) {
return pieces[0];
}
return pieces[1];
}
private void fixOperationImports(Set<String> imports) {
if (imports.size() == 0) {
return;
}
String[] modelNames = imports.toArray(new String[0]);
imports.clear();
// loops through imports and converts them all from 'module.Class' to 'from models.module import module'
for (String modelName : modelNames) {
// if a modelName lacks the module (Pet) then we convert it to pet.Pet
if (modelName.indexOf(".") == -1) {
modelName = toModelName(modelName);
}
imports.add(toModelImport(modelName));
}
} }
@Override @Override
@SuppressWarnings("static-method") @SuppressWarnings("static-method")
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) { public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
// fix the imports that each model has, add the module reference to the model
// loops through imports and converts them all
// from 'Pet' to 'from petstore_api.model.pet import Pet'
HashMap<String, Object> val = (HashMap<String, Object>)objs.get("operations"); HashMap<String, Object> val = (HashMap<String, Object>)objs.get("operations");
ArrayList<CodegenOperation> operations = (ArrayList<CodegenOperation>) val.get("operation"); ArrayList<CodegenOperation> operations = (ArrayList<CodegenOperation>) val.get("operation");
ArrayList<HashMap<String, String>> imports = (ArrayList<HashMap<String, String>>)objs.get("imports"); ArrayList<HashMap<String, String>> imports = (ArrayList<HashMap<String, String>>)objs.get("imports");
imports.clear();
for (CodegenOperation operation : operations) { for (CodegenOperation operation : operations) {
fixOperationImports(operation.imports); if (operation.imports.size() == 0) {
for (String thisImport : operation.imports) { continue;
HashMap<String, String> higherImport = new HashMap<String, String>(); }
higherImport.put("import", thisImport); String[] modelNames = operation.imports.toArray(new String[0]);
if (!imports.contains(higherImport)) { operation.imports.clear();
imports.add(higherImport); for (String modelName : modelNames) {
} operation.imports.add(toModelImport(modelName));
} }
} }
return objs; return objs;
} }
private void fixModelImports(Set<String> imports) {
// loops through imports and converts them all from 'module.Class' to 'import models.module as module'
if (imports.size() == 0) {
return;
}
String[] modelNames = imports.toArray(new String[0]);
imports.clear();
for (String modelName : modelNames) {
imports.add(robustImport(modelName));
}
}
/** /**
* Override with special post-processing for all models. * Override with special post-processing for all models.
*/ */
@SuppressWarnings({"static-method", "unchecked"}) @SuppressWarnings({"static-method", "unchecked"})
public Map<String, Object> postProcessAllModels(Map<String, Object> objs) { public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
super.postProcessAllModels(objs);
// loop through all models and delete ones where type!=object and the model has no validations and enums // loop through all models and delete ones where type!=object and the model has no validations and enums
// we will remove them because they are not needed // we will remove them because they are not needed
Map<String, Schema> modelSchemasToRemove = new HashMap<String, Schema>(); Map<String, Schema> modelSchemasToRemove = new HashMap<String, Schema>();
for (Map.Entry<String, Object> entry : objs.entrySet()) {
Map<String, Object> inner = (Map<String, Object>) entry.getValue();
List<Map<String, Object>> models = (List<Map<String, Object>>) inner.get("models");
for (Map<String, Object> mo : models) {
CodegenModel cm = (CodegenModel) mo.get("model");
// make sure discriminator models are included in imports for (Object objModel: objs.values()) {
CodegenDiscriminator discriminator = cm.discriminator; HashMap<String, Object> hmModel = (HashMap<String, Object>) objModel;
if (discriminator != null) { List<Map<String, Object>> models = (List<Map<String, Object>>) hmModel.get("models");
Set<CodegenDiscriminator.MappedModel> mappedModels = discriminator.getMappedModels(); for (Map<String, Object> model : models) {
for (CodegenDiscriminator.MappedModel mappedModel : mappedModels) { CodegenModel cm = (CodegenModel) model.get("model");
String otherModelName = mappedModel.getModelName();
cm.imports.add(otherModelName);
}
}
// add imports for anyOf, allOf, oneOf
ArrayList<Set<String>> composedSchemaSets = new ArrayList<Set<String>>();
composedSchemaSets.add(cm.allOf);
composedSchemaSets.add(cm.anyOf);
composedSchemaSets.add(cm.oneOf);
for (Set<String> importSet : composedSchemaSets) {
for (String otherModelName : importSet) {
if (!languageSpecificPrimitives.contains(otherModelName)) {
cm.imports.add(otherModelName);
}
}
}
Schema modelSchema = ModelUtils.getSchema(this.openAPI, cm.name);
CodegenProperty modelProperty = fromProperty("value", modelSchema);
// import complex type from additional properties
if (cm.additionalPropertiesType != null && modelProperty.items != null && modelProperty.items.complexType != null) {
cm.imports.add(modelProperty.items.complexType);
}
// fix the imports that each model has, change them to absolute
fixModelImports(cm.imports);
// remove model if it is a primitive with no validations
if (cm.isEnum || cm.isAlias) { if (cm.isEnum || cm.isAlias) {
Schema modelSchema = ModelUtils.getSchema(this.openAPI, cm.name);
CodegenProperty modelProperty = fromProperty("_value", modelSchema);
if (!modelProperty.isEnum && !modelProperty.hasValidation && !cm.isArrayModel) { if (!modelProperty.isEnum && !modelProperty.hasValidation && !cm.isArrayModel) {
// remove these models because they are aliases and do not have any enums or validations // remove these models because they are aliases and do not have any enums or validations
modelSchemasToRemove.put(cm.name, modelSchema); modelSchemasToRemove.put(cm.name, modelSchema);
continue;
} }
} }
// fix model imports
if (cm.imports.size() == 0) {
continue;
}
String[] modelNames = cm.imports.toArray(new String[0]);
cm.imports.clear();
for (String modelName : modelNames) {
cm.imports.add(toModelImport(modelName));
String globalImportFixer = "globals()['" + modelName + "'] = " + modelName;
cm.imports.add(globalImportFixer);
}
} }
} }
@@ -529,9 +488,7 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
if (modelProp.isPrimitiveType && (modelProp.hasValidation || modelProp.isEnum)) { if (modelProp.isPrimitiveType && (modelProp.hasValidation || modelProp.isEnum)) {
String simpleDataType = result.dataType; String simpleDataType = result.dataType;
result.dataType = toModelName(modelName); result.dataType = toModelName(modelName);
result.baseType = getPythonClassName(result.dataType); result.baseType = result.dataType;
imports.remove(modelName);
imports.add(result.dataType);
// set the example value // set the example value
if (modelProp.isEnum) { if (modelProp.isEnum) {
String value = modelProp._enum.get(0).toString(); String value = modelProp._enum.get(0).toString();
@@ -539,9 +496,6 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
} else { } else {
result.example = result.dataType + "(" + result.example + ")"; result.example = result.dataType + "(" + result.example + ")";
} }
} else if (!result.isPrimitiveType) {
// fix the baseType for the api docs so the .md link to the class's documentation file is correct
result.baseType = getPythonClassName(result.baseType);
} }
return result; return result;
} }
@@ -570,7 +524,7 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
if (responseSchema != null) { if (responseSchema != null) {
CodegenProperty cp = fromProperty("response", responseSchema); CodegenProperty cp = fromProperty("response", responseSchema);
if (cp.complexType != null) { if (cp.complexType != null) {
String modelName = getPythonClassName(cp.complexType); String modelName = cp.complexType;
Schema modelSchema = ModelUtils.getSchema(this.openAPI, modelName); Schema modelSchema = ModelUtils.getSchema(this.openAPI, modelName);
if (modelSchema != null && !"object".equals(modelSchema.getType())) { if (modelSchema != null && !"object".equals(modelSchema.getType())) {
CodegenProperty modelProp = fromProperty("response", modelSchema); CodegenProperty modelProp = fromProperty("response", modelSchema);
@@ -583,19 +537,16 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
if (cp.isEnum == true || cp.hasValidation == true) { if (cp.isEnum == true || cp.hasValidation == true) {
// this model has validations and/or enums so we will generate it // this model has validations and/or enums so we will generate it
Schema sc = ModelUtils.getSchemaFromResponse(response); Schema sc = ModelUtils.getSchemaFromResponse(response);
newBaseType = ModelUtils.getSimpleRef(sc.get$ref()); newBaseType = toModelName(ModelUtils.getSimpleRef(sc.get$ref()));
} }
} }
} }
CodegenResponse result = super.fromResponse(responseCode, response); CodegenResponse result = super.fromResponse(responseCode, response);
if (newBaseType != null) { if (newBaseType != null) {
result.dataType = toModelName(newBaseType); result.dataType = newBaseType;
// baseType is used to set the link to the model .md documentation // baseType is used to set the link to the model .md documentation
result.baseType = getPythonClassName(newBaseType); result.baseType = newBaseType;
} else if (!result.primitiveType) {
// fix the baseType for the api docs so the .md link to the class's documentation file is correct
result.baseType = getPythonClassName(result.baseType);
} }
return result; return result;
@@ -713,28 +664,18 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
public void postProcessModelProperty(CodegenModel model, CodegenProperty p) { public void postProcessModelProperty(CodegenModel model, CodegenProperty p) {
postProcessPattern(p.pattern, p.vendorExtensions); postProcessPattern(p.pattern, p.vendorExtensions);
// set property.complexType so the model docs will link to the ClassName.md // set property.complexType so the model docs will link to the ClassName.md
if (p.complexType != null && !languageSpecificPrimitives.contains(p.complexType)) { if (p.complexType == null && p.isListContainer && p.mostInnerItems.complexType != null && !languageSpecificPrimitives.contains(p.mostInnerItems.complexType)) {
p.complexType = getPythonClassName(p.complexType);
} else if (p.isListContainer && p.mostInnerItems.complexType != null && !languageSpecificPrimitives.contains(p.mostInnerItems.complexType)) {
// fix ListContainers // fix ListContainers
p.complexType = getPythonClassName(p.mostInnerItems.complexType); p.complexType = p.mostInnerItems.complexType;
}
// if a model has a property that is of type self, remove the module name from the dataType
if (p.complexType != null && p.dataType.contains(model.classname)) {
String classNameNoModule = getPythonClassName(model.classname);
p.dataType = p.dataType.replace(model.classname, classNameNoModule);
} }
} }
@Override @Override
public void postProcessParameter(CodegenParameter p) { public void postProcessParameter(CodegenParameter p) {
postProcessPattern(p.pattern, p.vendorExtensions); postProcessPattern(p.pattern, p.vendorExtensions);
// set baseType to null so the api docs will not point to a model for languageSpecificPrimitives
if (p.baseType != null && languageSpecificPrimitives.contains(p.baseType)){ if (p.baseType != null && languageSpecificPrimitives.contains(p.baseType)){
// set baseType to null so the api docs will not point to a model for languageSpecificPrimitives
p.baseType = null; p.baseType = null;
} else if (p.isListContainer && p.mostInnerItems.complexType != null && !languageSpecificPrimitives.contains(p.mostInnerItems.complexType)) {
// fix ListContainers
p.baseType = getPythonClassName(p.mostInnerItems.complexType);
} }
} }
@@ -789,6 +730,18 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
} }
} }
/**
* Sets the value of the 'model.parent' property in CodegenModel
* We have a custom version of this function so we can add the dataType on the ArrayModel
*/
@Override
protected void addParentContainer(CodegenModel model, String name, Schema schema) {
super.addParentContainer(model, name, schema);
List<String> referencedModelNames = new ArrayList<String>();
model.dataType = getTypeString(schema, "", "", referencedModelNames);
}
/** /**
* Convert OAS Model object to Codegen Model object * Convert OAS Model object to Codegen Model object
* *
@@ -800,9 +753,11 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
public CodegenModel fromModel(String name, Schema schema) { public CodegenModel fromModel(String name, Schema schema) {
// we have a custom version of this function so we can produce // we have a custom version of this function so we can produce
// models for components whose type != object and which have validations and enums // models for components whose type != object and which have validations and enums
// this ensures that endpoint (operation) responses with validations and enums // this ensures that:
// will generate models, and when those endpoint responses are received in python // - endpoint (operation) responses with validations and type!=(object or array)
// the response is cast as a model, and the model will validate the response using the enums and validations // - oneOf $ref components with validations and type!=(object or array)
// when endpoints receive payloads of these models
// that they will be converted into instances of these models
Map<String, String> propertyToModelName = new HashMap<String, String>(); Map<String, String> propertyToModelName = new HashMap<String, String>();
Map<String, Schema> propertiesMap = schema.getProperties(); Map<String, Schema> propertiesMap = schema.getProperties();
if (propertiesMap != null) { if (propertiesMap != null) {
@@ -820,7 +775,7 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
continue; continue;
} }
CodegenProperty modelProperty = fromProperty("_fake_name", refSchema); CodegenProperty modelProperty = fromProperty("_fake_name", refSchema);
if (modelProperty.isEnum == false && modelProperty.hasValidation == false) { if (modelProperty.isEnum == true || modelProperty.hasValidation == false) {
continue; continue;
} }
String modelName = ModelUtils.getSimpleRef(ref); String modelName = ModelUtils.getSimpleRef(ref);
@@ -828,37 +783,94 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
} }
} }
CodegenModel result = super.fromModel(name, schema); CodegenModel result = super.fromModel(name, schema);
// use this to store the model name like Cat
// we can't use result.name because that is used to lookup models in the spec
// we can't use result.classname because that stores cat.Cat
// we can't use result.classVarName because that stores the variable for making example instances
result.unescapedDescription = simpleModelName(name);
// make non-object type models have one property so we can use it to store enums and validations // have oneOf point to the correct model
if (result.isAlias || result.isEnum || result.isArrayModel) { if (ModelUtils.isComposedSchema(schema)) {
Schema modelSchema = ModelUtils.getSchema(this.openAPI, result.name); ComposedSchema cs = (ComposedSchema) schema;
CodegenProperty modelProperty = fromProperty("value", modelSchema); Map<String, Integer> importCounts = new HashMap<String, Integer>();
if (modelProperty.isEnum == true || modelProperty.hasValidation == true || result.isArrayModel) { List<Schema> oneOfSchemas = cs.getOneOf();
// these models are non-object models with enums and/or validations if (oneOfSchemas != null) {
// add a single property to the model so we can have a way to access validations for (int i = 0; i < oneOfSchemas.size(); i++) {
result.isAlias = true; Schema oneOfSchema = oneOfSchemas.get(i);
modelProperty.required = true; String languageType = getTypeDeclaration(oneOfSchema);
List<CodegenProperty> theProperties = Arrays.asList(modelProperty); String ref = oneOfSchema.get$ref();
result.setAllVars(theProperties); if (ref == null) {
result.setVars(theProperties); Integer currVal = importCounts.getOrDefault(languageType, 0);
result.setRequiredVars(theProperties); importCounts.put(languageType, currVal+1);
// post process model properties continue;
if (result.vars != null) {
for (CodegenProperty prop : result.vars) {
postProcessModelProperty(result, prop);
} }
Schema refSchema = ModelUtils.getReferencedSchema(this.openAPI, oneOfSchema);
String refType = refSchema.getType();
if (refType == null || refType.equals("object")) {
Integer currVal = importCounts.getOrDefault(languageType, 0);
importCounts.put(languageType, currVal+1);
continue;
}
CodegenProperty modelProperty = fromProperty("_oneOfSchema", refSchema);
if (modelProperty.isEnum == true) {
Integer currVal = importCounts.getOrDefault(languageType, 0);
importCounts.put(languageType, currVal+1);
continue;
}
languageType = getTypeDeclaration(refSchema);
if (modelProperty.hasValidation == false) {
Integer currVal = importCounts.getOrDefault(languageType, 0);
importCounts.put(languageType, currVal+1);
continue;
}
Integer currVal = importCounts.getOrDefault(languageType, 0);
importCounts.put(languageType, currVal);
String modelName = toModelName(ModelUtils.getSimpleRef(ref));
result.imports.add(modelName);
result.oneOf.add(modelName);
currVal = importCounts.getOrDefault(modelName, 0);
importCounts.put(modelName, currVal+1);
}
}
for (Map.Entry<String, Integer> entry : importCounts.entrySet()) {
String importName = entry.getKey();
Integer importCount = entry.getValue();
if (importCount == 0) {
result.oneOf.remove(importName);
} }
} }
} }
// set regex values, before it was only done on model.vars // this block handles models which have the python base class ModelSimple
// fix all property references to non-object models, make those properties non-primitive and // which are responsible for storing validations, enums, and an unnamed value
Schema modelSchema = ModelUtils.getSchema(this.openAPI, result.name);
CodegenProperty modelProperty = fromProperty("_value", modelSchema);
Boolean isPythonModelSimpleModel = (result.isEnum || result.isArrayModel || result.isAlias && modelProperty.hasValidation);
if (isPythonModelSimpleModel) {
// In python, classes which inherit from our ModelSimple class store one value,
// like a str, int, list and extra data about that value like validations and enums
if (result.isEnum) {
// if there is only one allowed value then we know that it should be set, so value is optional
// -> hasRequired = false
// if there are more than one allowed value then value is positional and required so
// -> hasRequired = true
ArrayList values = (ArrayList) result.allowableValues.get("values");
if (values != null && values.size() > 1) {
result.hasRequired = true;
}
if (modelProperty.defaultValue != null && result.defaultValue == null) {
result.defaultValue = modelProperty.defaultValue;
}
} else {
if (result.defaultValue == null) {
result.hasRequired = true;
}
}
}
// fix all property references to ModelSimple models, make those properties non-primitive and
// set their dataType and complexType to the model name, so documentation will refer to the correct model // set their dataType and complexType to the model name, so documentation will refer to the correct model
// set regex values, before it was only done on model.vars
// NOTE: this is done for models of type != object which are not enums and have validations
ArrayList<List<CodegenProperty>> listOfLists = new ArrayList<List<CodegenProperty>>(); ArrayList<List<CodegenProperty>> listOfLists = new ArrayList<List<CodegenProperty>>();
listOfLists.add(result.vars); listOfLists.add(result.vars);
listOfLists.add(result.allVars); listOfLists.add(result.allVars);
@@ -876,13 +888,14 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
} }
cp.isPrimitiveType = false; cp.isPrimitiveType = false;
String modelName = propertyToModelName.get(cp.name); String modelName = propertyToModelName.get(cp.name);
cp.complexType = getPythonClassName(modelName); cp.complexType = modelName;
cp.dataType = modelName; cp.dataType = modelName;
cp.isEnum = false; cp.isEnum = false;
cp.hasValidation = false; cp.hasValidation = false;
result.imports.add(modelName); result.imports.add(modelName);
} }
} }
// if a class has a property of type self, remove the self import from imports // if a class has a property of type self, remove the self import from imports
if (result.imports.contains(result.classname)) { if (result.imports.contains(result.classname)) {
result.imports.remove(result.classname); result.imports.remove(result.classname);
@@ -895,6 +908,60 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
return result; return result;
} }
/**
* returns the OpenAPI type for the property. Use getAlias to handle $ref of primitive type
* We have a custom version of this function because for composed schemas we also want to return the model name
* In DefaultCodegen.java it returns a name built off of individual allOf/anyOf/oneOf which is not what
* python-experimental needs. Python-experimental needs the name of the composed schema
*
* @param schema property schema
* @return string presentation of the type
**/
@SuppressWarnings("static-method")
@Override
public String getSchemaType(Schema schema) {
if (schema instanceof ComposedSchema) { // composed schema
Schema unaliasSchema = ModelUtils.unaliasSchema(this.openAPI, schema, importMapping);
String ref = unaliasSchema.get$ref();
if (ref != null) {
String schemaName = ModelUtils.getSimpleRef(unaliasSchema.get$ref());
if (StringUtils.isNotEmpty(schemaName) && importMapping.containsKey(schemaName)) {
return schemaName;
}
return getAlias(schemaName);
} else {
// we may have be processing the component schema rather than a schema with a $ref
// to a component schema
// so loop through component schemas and use the found one's name if we match
Map<String, Schema> schemas = ModelUtils.getSchemas(openAPI);
for (String thisSchemaName : schemas.keySet()) {
Schema thisSchema = schemas.get(thisSchemaName);
if (!ModelUtils.isComposedSchema(thisSchema)) {
continue;
}
if (thisSchema == unaliasSchema) {
if (importMapping.containsKey(thisSchemaName)) {
return thisSchemaName;
}
return getAlias(thisSchemaName);
}
}
LOGGER.warn("Error obtaining the datatype from ref:" + unaliasSchema.get$ref() + ". Default to 'object'");
return "object";
}
}
String openAPIType = getSingleSchemaType(schema);
if (typeMapping.containsKey(openAPIType)) {
String type = typeMapping.get(openAPIType);
if (languageSpecificPrimitives.contains(type)) {
return type;
}
} else {
return toModelName(openAPIType);
}
return openAPIType;
}
/** /**
* Output the type declaration of the property * Output the type declaration of the property
* *
@@ -909,6 +976,18 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
return oasType; return oasType;
} }
public Boolean modelWillBeMade(Schema s) {
// only invoke this on $refed schemas
if (ModelUtils.isComposedSchema(s) || ModelUtils.isArraySchema(s) || ModelUtils.isObjectSchema(s)) {
return true;
}
CodegenProperty cp = fromProperty("_model", s);
if (cp.isEnum || cp.hasValidation) {
return true;
}
return false;
}
/** /**
* Return a string representation of the Python types for the specified OAS schema. * Return a string representation of the Python types for the specified OAS schema.
* Primitive types in the OAS specification are implemented in Python using the corresponding * Primitive types in the OAS specification are implemented in Python using the corresponding
@@ -939,12 +1018,12 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
// The input schema is a reference. If the resolved schema is // The input schema is a reference. If the resolved schema is
// a composed schema, convert the name to a Python class. // a composed schema, convert the name to a Python class.
Schema s = ModelUtils.getReferencedSchema(this.openAPI, p); Schema s = ModelUtils.getReferencedSchema(this.openAPI, p);
if (s instanceof ComposedSchema) { if (modelWillBeMade(s)) {
String modelName = ModelUtils.getSimpleRef(p.get$ref()); String modelName = toModelName(ModelUtils.getSimpleRef(p.get$ref()));
if (referencedModelNames != null) { if (referencedModelNames != null) {
referencedModelNames.add(modelName); referencedModelNames.add(modelName);
} }
return prefix + toModelName(modelName) + fullSuffix; return prefix + modelName + fullSuffix;
} }
} }
if (isAnyTypeSchema(p)) { if (isAnyTypeSchema(p)) {
@@ -1094,55 +1173,4 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
p.example = example; p.example = example;
} }
private String simpleModelName(String name) {
// this returns a model name like Cat
String modelName = sanitizeName(name);
// remove dollar sign
modelName = modelName.replaceAll("$", "");
// model name cannot use reserved keyword, e.g. return
if (isReservedWord(modelName)) {
LOGGER.warn(modelName + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + modelName));
modelName = "model_" + modelName; // e.g. return => ModelReturn (after camelize)
}
// model name starts with number
if (modelName.matches("^\\d.*")) {
LOGGER.warn(modelName + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + modelName));
modelName = "model_" + modelName; // e.g. 200Response => Model200Response (after camelize)
}
if (!StringUtils.isEmpty(modelNamePrefix)) {
modelName = modelNamePrefix + "_" + modelName;
}
if (!StringUtils.isEmpty(modelNameSuffix)) {
modelName = modelName + "_" + modelNameSuffix;
}
// camelize the model name
// phone_number => PhoneNumber
return camelize(modelName);
}
@Override
public String toModelFilename(String name) {
// underscore the model file name
// PhoneNumber => phone_number
return underscore(dropDots(simpleModelName(name)));
}
@Override
public String toModelName(String name) {
// we have a custom version of this function so we can support circular references in python 2 and 3
return toModelFilename(name)+"."+simpleModelName(name);
}
@Override
public String toModelDocFilename(String name) {
// this is used to generate the model's .md documentation file
return simpleModelName(name);
}
} }

View File

@@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
public class PythonFlaskConnexionServerCodegen extends PythonAbstractConnexionServerCodegen { public class PythonFlaskConnexionServerCodegen extends AbstractPythonConnexionServerCodegen {
private static final Logger LOGGER = LoggerFactory.getLogger(PythonFlaskConnexionServerCodegen.class); private static final Logger LOGGER = LoggerFactory.getLogger(PythonFlaskConnexionServerCodegen.class);
public PythonFlaskConnexionServerCodegen() { public PythonFlaskConnexionServerCodegen() {

View File

@@ -34,6 +34,10 @@ import java.io.File;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.time.OffsetDateTime;
import java.time.Instant;
import java.time.temporal.ChronoField;
import java.util.concurrent.TimeUnit;
import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.camelize;
@@ -620,14 +624,19 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
} }
} }
} }
if (ModelUtils.isIntegerSchema(p) || ModelUtils.isNumberSchema(p) || ModelUtils.isBooleanSchema(p)) { if (p.getDefault() != null) {
if (p.getDefault() != null) { if (ModelUtils.isIntegerSchema(p) || ModelUtils.isNumberSchema(p) || ModelUtils.isBooleanSchema(p)) {
return p.getDefault().toString(); return p.getDefault().toString();
} } else if (ModelUtils.isDateTimeSchema(p)) {
} else if (ModelUtils.isStringSchema(p)) { // Datetime time stamps in Swift are expressed as Seconds with Microsecond precision.
if (p.getDefault() != null) { // In Java, we need to be creative to get the Timestamp in Microseconds as a long.
Instant instant = ((OffsetDateTime) p.getDefault()).toInstant();
long epochMicro = TimeUnit.SECONDS.toMicros(instant.getEpochSecond()) + ((long) instant.get(ChronoField.MICRO_OF_SECOND));
return "Date(timeIntervalSince1970: " + String.valueOf(epochMicro) + ".0 / 1_000_000)";
} else if (ModelUtils.isStringSchema(p)) {
return "\"" + escapeText((String) p.getDefault()) + "\""; return "\"" + escapeText((String) p.getDefault()) + "\"";
} }
// TODO: Handle more cases from `ModelUtils`, such as Date
} }
return null; return null;
} }

View File

@@ -61,7 +61,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
public static final String STRING_ENUMS_DESC = "Generate string enums instead of objects for enum values."; public static final String STRING_ENUMS_DESC = "Generate string enums instead of objects for enum values.";
public static final String QUERY_PARAM_OBJECT_FORMAT = "queryParamObjectFormat"; public static final String QUERY_PARAM_OBJECT_FORMAT = "queryParamObjectFormat";
protected String ngVersion = "9.0.0"; protected String ngVersion = "10.0.0";
protected String npmRepository = null; protected String npmRepository = null;
private boolean useSingleRequestParameter = false; private boolean useSingleRequestParameter = false;
protected String serviceSuffix = "Service"; protected String serviceSuffix = "Service";
@@ -129,7 +129,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
@Override @Override
public String getHelp() { public String getHelp() {
return "Generates a TypeScript Angular (6.x - 9.x) client library."; return "Generates a TypeScript Angular (6.x - 10.x) client library.";
} }
@Override @Override
@@ -246,7 +246,9 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
} }
// Set the typescript version compatible to the Angular version // Set the typescript version compatible to the Angular version
if (ngVersion.atLeast("9.0.0")) { if (ngVersion.atLeast("10.0.0")) {
additionalProperties.put("tsVersion", ">=3.9.2 <4.0.0");
} else if (ngVersion.atLeast("9.0.0")) {
additionalProperties.put("tsVersion", ">=3.6.0 <3.8.0"); additionalProperties.put("tsVersion", ">=3.6.0 <3.8.0");
} else if (ngVersion.atLeast("8.0.0")) { } else if (ngVersion.atLeast("8.0.0")) {
additionalProperties.put("tsVersion", ">=3.4.0 <3.6.0"); additionalProperties.put("tsVersion", ">=3.4.0 <3.6.0");
@@ -258,7 +260,9 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
} }
// Set the rxJS version compatible to the Angular version // Set the rxJS version compatible to the Angular version
if (ngVersion.atLeast("9.0.0")) { if (ngVersion.atLeast("10.0.0")) {
additionalProperties.put("rxjsVersion", "6.6.0");
} else if (ngVersion.atLeast("9.0.0")) {
additionalProperties.put("rxjsVersion", "6.5.3"); additionalProperties.put("rxjsVersion", "6.5.3");
} else if (ngVersion.atLeast("8.0.0")) { } else if (ngVersion.atLeast("8.0.0")) {
additionalProperties.put("rxjsVersion", "6.5.0"); additionalProperties.put("rxjsVersion", "6.5.0");
@@ -272,7 +276,10 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
supportingFiles.add(new SupportingFile("ng-package.mustache", getIndexDirectory(), "ng-package.json")); supportingFiles.add(new SupportingFile("ng-package.mustache", getIndexDirectory(), "ng-package.json"));
// Specific ng-packagr configuration // Specific ng-packagr configuration
if (ngVersion.atLeast("9.0.0")) { if (ngVersion.atLeast("10.0.0")) {
additionalProperties.put("ngPackagrVersion", "10.0.3");
additionalProperties.put("tsickleVersion", "0.39.1");
} else if (ngVersion.atLeast("9.0.0")) {
additionalProperties.put("ngPackagrVersion", "9.0.1"); additionalProperties.put("ngPackagrVersion", "9.0.1");
additionalProperties.put("tsickleVersion", "0.38.0"); additionalProperties.put("tsickleVersion", "0.38.0");
} else if (ngVersion.atLeast("8.0.0")) { } else if (ngVersion.atLeast("8.0.0")) {

View File

@@ -839,10 +839,10 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
Schema inner; Schema inner;
if (ModelUtils.isArraySchema(p)) { if (ModelUtils.isArraySchema(p)) {
inner = ((ArraySchema) p).getItems(); inner = ((ArraySchema) p).getItems();
return this.getSchemaType(p) + "<" + this.getTypeDeclaration(inner) + ">"; return this.getSchemaType(p) + "<" + this.getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, inner)) + ">";
} else if (ModelUtils.isMapSchema(p)) { } else if (ModelUtils.isMapSchema(p)) {
inner = (Schema) p.getAdditionalProperties(); inner = (Schema) p.getAdditionalProperties();
return "{ [key: string]: " + this.getTypeDeclaration(inner) + "; }"; return "{ [key: string]: " + this.getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, inner)) + "; }";
} else if (ModelUtils.isFileSchema(p)) { } else if (ModelUtils.isFileSchema(p)) {
return "HttpFile"; return "HttpFile";
} else if (ModelUtils.isBinarySchema(p)) { } else if (ModelUtils.isBinarySchema(p)) {

View File

@@ -88,6 +88,10 @@ public class ModelUtils {
return Boolean.parseBoolean(GlobalSettings.getProperty(generateAliasAsModelKey, "false")); return Boolean.parseBoolean(GlobalSettings.getProperty(generateAliasAsModelKey, "false"));
} }
public static boolean isGenerateAliasAsModel(Schema schema) {
return isGenerateAliasAsModel() || (schema.getExtensions() != null && schema.getExtensions().getOrDefault("x-generate-alias-as-model", false).equals(true));
}
/** /**
* Searches for the model by name in the map of models and returns it * Searches for the model by name in the map of models and returns it
* *
@@ -1037,7 +1041,7 @@ public class ModelUtils {
// top-level enum class // top-level enum class
return schema; return schema;
} else if (isArraySchema(ref)) { } else if (isArraySchema(ref)) {
if (isGenerateAliasAsModel()) { if (isGenerateAliasAsModel(ref)) {
return schema; // generate a model extending array return schema; // generate a model extending array
} else { } else {
return unaliasSchema(openAPI, allSchemas.get(ModelUtils.getSimpleRef(schema.get$ref())), return unaliasSchema(openAPI, allSchemas.get(ModelUtils.getSimpleRef(schema.get$ref())),
@@ -1049,7 +1053,7 @@ public class ModelUtils {
if (ref.getProperties() != null && !ref.getProperties().isEmpty()) // has at least one property if (ref.getProperties() != null && !ref.getProperties().isEmpty()) // has at least one property
return schema; // treat it as model return schema; // treat it as model
else { else {
if (isGenerateAliasAsModel()) { if (isGenerateAliasAsModel(ref)) {
return schema; // generate a model extending map return schema; // generate a model extending map
} else { } else {
// treat it as a typical map // treat it as a typical map

View File

@@ -126,7 +126,7 @@ ext {
{{#threetenbp}} {{#threetenbp}}
jackson_threetenbp_version = "2.9.10" jackson_threetenbp_version = "2.9.10"
{{/threetenbp}} {{/threetenbp}}
feign_version = "11.0" feign_version = "10.11"
feign_form_version = "3.8.0" feign_form_version = "3.8.0"
junit_version = "4.13" junit_version = "4.13"
oltu_version = "1.0.1" oltu_version = "1.0.1"

View File

@@ -10,9 +10,9 @@ lazy val root = (project in file(".")).
resolvers += Resolver.mavenLocal, resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.24" % "compile", "io.swagger" % "swagger-annotations" % "1.5.24" % "compile",
"io.github.openfeign" % "feign-core" % "11.0" % "compile", "io.github.openfeign" % "feign-core" % "10.11" % "compile",
"io.github.openfeign" % "feign-jackson" % "11.0" % "compile", "io.github.openfeign" % "feign-jackson" % "10.11" % "compile",
"io.github.openfeign" % "feign-slf4j" % "11.0" % "compile", "io.github.openfeign" % "feign-slf4j" % "10.11" % "compile",
"io.github.openfeign.form" % "feign-form" % "3.8.0" % "compile", "io.github.openfeign.form" % "feign-form" % "3.8.0" % "compile",
"com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile", "com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile",

View File

@@ -348,7 +348,7 @@
<maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.target>${java.version}</maven.compiler.target>
<swagger-annotations-version>1.5.24</swagger-annotations-version> <swagger-annotations-version>1.5.24</swagger-annotations-version>
<feign-version>11.0</feign-version> <feign-version>10.11</feign-version>
<feign-form-version>3.8.0</feign-form-version> <feign-form-version>3.8.0</feign-form-version>
<jackson-version>2.10.3</jackson-version> <jackson-version>2.10.3</jackson-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version> <jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>

View File

@@ -874,9 +874,17 @@ public class ApiClient {
} else { } else {
// We let jersey handle the serialization // We let jersey handle the serialization
if (isBodyNullable) { // payload is nullable if (isBodyNullable) { // payload is nullable
entity = Entity.entity(obj == null ? Entity.text("null") : obj, contentType); if (obj instanceof String) {
entity = Entity.entity(obj == null ? "null" : "\"" + ((String)obj).replaceAll("\"", Matcher.quoteReplacement("\\\"")) + "\"", contentType);
} else {
entity = Entity.entity(obj == null ? "null" : obj, contentType);
}
} else { } else {
entity = Entity.entity(obj == null ? Entity.text("") : obj, contentType); if (obj instanceof String) {
entity = Entity.entity(obj == null ? "" : "\"" + ((String)obj).replaceAll("\"", Matcher.quoteReplacement("\\\"")) + "\"", contentType);
} else {
entity = Entity.entity(obj == null ? "" : obj, contentType);
}
} }
} }
return entity; return entity;
@@ -888,7 +896,7 @@ public class ApiClient {
* @param obj Object * @param obj Object
* @param formParams Form parameters * @param formParams Form parameters
* @param contentType Context type * @param contentType Context type
* @param isBodyNulalble True if the body is nullable * @param isBodyNullable True if the body is nullable
* @return String * @return String
* @throws ApiException API exception * @throws ApiException API exception
*/ */
@@ -911,7 +919,7 @@ public class ApiClient {
if (isBodyNullable) { if (isBodyNullable) {
return obj == null ? "null" : json.getMapper().writeValueAsString(obj); return obj == null ? "null" : json.getMapper().writeValueAsString(obj);
} else { } else {
return json.getMapper().writeValueAsString(obj); return obj == null ? "" : json.getMapper().writeValueAsString(obj);
} }
} }
} catch (Exception ex) { } catch (Exception ex) {

View File

@@ -34,6 +34,7 @@ public class JSON implements ContextResolver<ObjectMapper> {
public JSON() { public JSON() {
mapper = new ObjectMapper(); mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);

View File

@@ -33,7 +33,7 @@ import {{{invokerPackage}}}.ApiClient;
import {{{invokerPackage}}}.ApiException; import {{{invokerPackage}}}.ApiException;
import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}} import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}}
import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}}
import {{{invokerPackage}}}.models.*; import {{{invokerPackage}}}.model.*;
import {{{package}}}.{{{classname}}}; import {{{package}}}.{{{classname}}};
public class Example { public class Example {

View File

@@ -12,10 +12,12 @@ import java.security.Key;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Base64; import java.util.Base64;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;
import java.util.TimeZone;
import java.security.spec.AlgorithmParameterSpec; import java.security.spec.AlgorithmParameterSpec;
import java.security.InvalidKeyException; import java.security.InvalidKeyException;
@@ -236,7 +238,9 @@ public class HttpSignatureAuth implements Authentication {
} }
if (headers.contains("date")) { if (headers.contains("date")) {
headerParams.put("date", new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US).format(new Date())); SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
headerParams.put("date", dateFormat.format(Calendar.getInstance().getTime()));
} }
if (headers.contains("digest")) { if (headers.contains("digest")) {
@@ -253,7 +257,7 @@ public class HttpSignatureAuth implements Authentication {
// Calling getRawPath and getRawQuery ensures the path is URL-encoded as it will be serialized // Calling getRawPath and getRawQuery ensures the path is URL-encoded as it will be serialized
// on the wire. The HTTP signature must use the encode URL as it is sent on the wire. // on the wire. The HTTP signature must use the encode URL as it is sent on the wire.
String path = uri.getRawPath(); String path = uri.getRawPath();
if (uri.getRawQuery() != "") { if (uri.getRawQuery() != null && !"".equals(uri.getRawQuery())) {
path += "?" + uri.getRawQuery(); path += "?" + uri.getRawQuery();
} }

View File

@@ -10,10 +10,12 @@ import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@@ -73,16 +75,34 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/discriminator}} {{/discriminator}}
{{/useOneOfDiscriminatorLookup}} {{/useOneOfDiscriminatorLookup}}
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0; int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
{{#oneOf}} {{#oneOf}}
// deserialize {{{.}}} // deserialize {{{.}}}
try { try {
deserialized = tree.traverse(jp.getCodec()).readValueAs({{{.}}}.class); boolean attemptParsing = true;
// TODO: there is no validation against JSON schema constraints // ensure that we respect type coercion as set on the client ObjectMapper
// (min, max, enum, pattern...), this does not perform a strict JSON if ({{{.}}}.class.equals(Integer.class) || {{{.}}}.class.equals(Long.class) || {{{.}}}.class.equals(Float.class) || {{{.}}}.class.equals(Double.class) || {{{.}}}.class.equals(Boolean.class) || {{{.}}}.class.equals(String.class)) {
// validation, which means the 'match' count may be higher than it should be. attemptParsing = typeCoercion;
match++; if (!attemptParsing) {
log.log(Level.FINER, "Input data matches schema '{{{.}}}'"); attemptParsing |= (({{{.}}}.class.equals(Integer.class) || {{{.}}}.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= (({{{.}}}.class.equals(Float.class) || {{{.}}}.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= ({{{.}}}.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= ({{{.}}}.class.equals(String.class) && token == JsonToken.VALUE_STRING);
{{#isNullable}}
attemptParsing |= (token == JsonToken.VALUE_NULL);
{{/isNullable}}
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs({{{.}}}.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema '{{{.}}}'");
}
} catch (Exception e) { } catch (Exception e) {
// deserialization failed, continue // deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e); log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e);

View File

@@ -33,6 +33,7 @@ import javax.json.bind.annotation.JsonbProperty;
* {{{description}}} * {{{description}}}
**/ **/
{{/description}} {{/description}}
{{>additionalModelTypeAnnotations}}
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializableModel}} implements Serializable{{/serializableModel}} { public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializableModel}} implements Serializable{{/serializableModel}} {
{{#vars}}{{#isEnum}}{{^isContainer}} {{#vars}}{{#isEnum}}{{^isContainer}}
{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} {{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}}

View File

@@ -99,12 +99,19 @@ public class {{{classname}}}Example {
{{/allParams}} {{/allParams}}
try { try {
{{^vendorExtensions.x-group-parameters}} {{^vendorExtensions.x-group-parameters}}
{{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}} result = {{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void> result = {{/asyncNative}}{{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}{{#hasParams}} {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}} result = {{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void> result = {{/asyncNative}}{{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{/vendorExtensions.x-group-parameters}}
{{#vendorExtensions.x-group-parameters}}
{{#hasParams}}
API{{operationId}}Request request = API{{operationId}}Request.newBuilder(){{#allParams}} API{{operationId}}Request request = API{{operationId}}Request.newBuilder(){{#allParams}}
.{{paramName}}({{paramName}}){{/allParams}} .{{paramName}}({{paramName}}){{/allParams}}
.build();{{/hasParams}} .build();
{{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}} result = {{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void> result = {{/asyncNative}}{{/returnType}}apiInstance.{{operationId}}({{#hasParams}}request{{/hasParams}});{{/vendorExtensions.x-group-parameters}}{{#returnType}} {{/hasParams}}
System.out.println(result);{{/returnType}} {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}} result = {{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void> result = {{/asyncNative}}{{/returnType}}apiInstance.{{operationId}}({{#hasParams}}request{{/hasParams}});
{{/vendorExtensions.x-group-parameters}}
{{#returnType}}
System.out.println(result{{#asyncNative}}.get(){{/asyncNative}});
{{/returnType}}
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}");
System.err.println("Status code: " + e.getCode()); System.err.println("Status code: " + e.getCode());
@@ -124,6 +131,7 @@ All URIs are relative to *{{basePath}}*
Class | Method | HTTP request | Description Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
*{{classname}}* | [**{{operationId}}WithHttpInfo**]({{apiDocPath}}{{classname}}.md#{{operationId}}WithHttpInfo) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
## Documentation for Models ## Documentation for Models

View File

@@ -3,9 +3,7 @@ package {{package}};
import {{invokerPackage}}.ApiClient; import {{invokerPackage}}.ApiClient;
import {{invokerPackage}}.ApiException; import {{invokerPackage}}.ApiException;
{{^asyncNative}}
import {{invokerPackage}}.ApiResponse; import {{invokerPackage}}.ApiResponse;
{{/asyncNative}}
import {{invokerPackage}}.Pair; import {{invokerPackage}}.Pair;
{{#imports}} {{#imports}}
@@ -57,6 +55,15 @@ public class {{classname}} {
memberVarReadTimeout = apiClient.getReadTimeout(); memberVarReadTimeout = apiClient.getReadTimeout();
memberVarResponseInterceptor = apiClient.getResponseInterceptor(); memberVarResponseInterceptor = apiClient.getResponseInterceptor();
} }
{{#asyncNative}}
private ApiException getApiException(String operationId, HttpResponse<String>localVarResponse) {
return new ApiException(localVarResponse.statusCode(),
operationId + " call received non-success response",
localVarResponse.headers(),
localVarResponse.body());
}
{{/asyncNative}}
{{#operation}} {{#operation}}
{{#vendorExtensions.x-group-parameters}} {{#vendorExtensions.x-group-parameters}}
@@ -66,7 +73,7 @@ public class {{classname}} {
* {{notes}} * {{notes}}
* @param {{operationId}}Request {@link API{{operationId}}Request} * @param {{operationId}}Request {@link API{{operationId}}Request}
{{#returnType}} {{#returnType}}
* @return {{returnType}} * @return {{#asyncNative}}CompletableFuture&lt;{{/asyncNative}}{{returnType}}{{#asyncNative}}&gt;{{/asyncNative}}
{{/returnType}} {{/returnType}}
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
{{#isDeprecated}} {{#isDeprecated}}
@@ -86,13 +93,12 @@ public class {{classname}} {
{{/allParams}} {{/allParams}}
{{#returnType}}return {{/returnType}}{{^returnType}}{{#asyncNative}}return {{/asyncNative}}{{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); {{#returnType}}return {{/returnType}}{{^returnType}}{{#asyncNative}}return {{/asyncNative}}{{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
} }
{{^asyncNative}}
/** /**
* {{summary}} * {{summary}}
* {{notes}} * {{notes}}
* @param {{operationId}}Request {@link API{{operationId}}Request} * @param {{operationId}}Request {@link API{{operationId}}Request}
* @return ApiResponse&lt;{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Void{{/returnType}}&gt; * @return {{#asyncNative}}CompletableFuture&lt;{{/asyncNative}}ApiResponse&lt;{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Void{{/returnType}}&gt;{{#asyncNative}}&gt;{{/asyncNative}}
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
{{#isDeprecated}} {{#isDeprecated}}
* @deprecated * @deprecated
@@ -105,13 +111,12 @@ public class {{classname}} {
{{#isDeprecated}} {{#isDeprecated}}
@Deprecated @Deprecated
{{/isDeprecated}} {{/isDeprecated}}
public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo(API{{operationId}}Request {{operationId}}Request) throws ApiException { public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo(API{{operationId}}Request {{operationId}}Request) throws ApiException {
{{#allParams}} {{#allParams}}
{{{dataType}}} {{paramName}} = {{operationId}}Request.{{paramName}}(); {{{dataType}}} {{paramName}} = {{operationId}}Request.{{paramName}}();
{{/allParams}} {{/allParams}}
return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
} }
{{/asyncNative}}
{{/hasParams}} {{/hasParams}}
{{/vendorExtensions.x-group-parameters}} {{/vendorExtensions.x-group-parameters}}
@@ -122,7 +127,7 @@ public class {{classname}} {
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/isContainer}}{{/required}} * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/isContainer}}{{/required}}
{{/allParams}} {{/allParams}}
{{#returnType}} {{#returnType}}
* @return {{returnType}} * @return {{#asyncNative}}CompletableFuture&lt;{{/asyncNative}}{{returnType}}{{#asyncNative}}&gt;{{/asyncNative}}
{{/returnType}} {{/returnType}}
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
{{#isDeprecated}} {{#isDeprecated}}
@@ -147,28 +152,23 @@ public class {{classname}} {
try { try {
HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) { if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), return CompletableFuture.failedFuture(getApiException("{{operationId}}", localVarResponse));
"{{operationId}} call received non-success response", }
localVarResponse.headers(), {{#returnType}}
localVarResponse.body()) try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {})
); );
} else { } catch (IOException e) {
{{#returnType}} return CompletableFuture.failedFuture(new ApiException(e));
try { }
return CompletableFuture.completedFuture( {{/returnType}}
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {}) {{^returnType}}
); return CompletableFuture.completedFuture(null);
} catch (IOException e) { {{/returnType}}
return CompletableFuture.failedFuture(new ApiException(e));
}
{{/returnType}}
{{^returnType}}
return CompletableFuture.completedFuture(null);
{{/returnType}}
}
}); });
} }
catch (ApiException e) { catch (ApiException e) {
@@ -176,7 +176,6 @@ public class {{classname}} {
} }
{{/asyncNative}} {{/asyncNative}}
} }
{{^asyncNative}}
/** /**
* {{summary}} * {{summary}}
@@ -184,7 +183,7 @@ public class {{classname}} {
{{#allParams}} {{#allParams}}
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/isContainer}}{{/required}} * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/isContainer}}{{/required}}
{{/allParams}} {{/allParams}}
* @return ApiResponse&lt;{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Void{{/returnType}}&gt; * @return {{#asyncNative}}CompletableFuture&lt;{{/asyncNative}}ApiResponse&lt;{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Void{{/returnType}}&gt;{{#asyncNative}}&gt;{{/asyncNative}}
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
{{#isDeprecated}} {{#isDeprecated}}
* @deprecated * @deprecated
@@ -197,7 +196,8 @@ public class {{classname}} {
{{#isDeprecated}} {{#isDeprecated}}
@Deprecated @Deprecated
{{/isDeprecated}} {{/isDeprecated}}
public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException {
{{^asyncNative}}
HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
@@ -224,8 +224,41 @@ public class {{classname}} {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
throw new ApiException(e); throw new ApiException(e);
} }
{{/asyncNative}}
{{#asyncNative}}
try {
HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("{{operationId}}", localVarResponse));
}
{{#returnType}}
try {
return CompletableFuture.completedFuture(
new ApiResponse<{{{returnType}}}>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
{{/returnType}}
{{^returnType}}
return CompletableFuture.completedFuture(
new ApiResponse<Void>(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
);
{{/returnType}}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
{{/asyncNative}}
} }
{{/asyncNative}}
private HttpRequest.Builder {{operationId}}RequestBuilder({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { private HttpRequest.Builder {{operationId}}RequestBuilder({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException {
{{#allParams}} {{#allParams}}

View File

@@ -7,9 +7,7 @@ All URIs are relative to *{{basePath}}*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} {{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
{{^asyncNative}} [**{{operationId}}WithHttpInfo**]({{classname}}.md#{{operationId}}WithHttpInfo) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
[**{{operationId}}WithHttpInfo**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
{{/asyncNative}}
{{/operation}}{{/operations}} {{/operation}}{{/operations}}
{{#operations}} {{#operations}}
@@ -81,8 +79,11 @@ public class Example {
.{{paramName}}({{paramName}}){{/allParams}} .{{paramName}}({{paramName}}){{/allParams}}
.build(); .build();
{{/hasParams}} {{/hasParams}}
{{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}} result = {{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void> result = {{/asyncNative}}{{/returnType}}apiInstance.{{operationId}}({{#hasParams}}request{{/hasParams}});{{/vendorExtensions.x-group-parameters}}{{#returnType}} {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}} result = {{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void> result = {{/asyncNative}}{{/returnType}}apiInstance.{{operationId}}({{#hasParams}}request{{/hasParams}});
System.out.println(result);{{/returnType}} {{/vendorExtensions.x-group-parameters}}
{{#returnType}}
System.out.println(result{{#asyncNative}}.get(){{/asyncNative}});
{{/returnType}}
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}");
System.err.println("Status code: " + e.getCode()); System.err.println("Status code: " + e.getCode());
@@ -131,15 +132,14 @@ Name | Type | Description | Notes
| **{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} | | **{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} |
{{/responses}} {{/responses}}
{{/responses.0}} {{/responses.0}}
{{^asyncNative}}
## {{operationId}}WithHttpInfo ## {{operationId}}WithHttpInfo
{{^vendorExtensions.x-group-parameters}} {{^vendorExtensions.x-group-parameters}}
> ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}} {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) > {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}} {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
{{/vendorExtensions.x-group-parameters}} {{/vendorExtensions.x-group-parameters}}
{{#vendorExtensions.x-group-parameters}} {{#vendorExtensions.x-group-parameters}}
> ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}} {{operationId}}WithHttpInfo({{#hasParams}}{{operationId}}Request{{/hasParams}}) > {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}} {{operationId}}WithHttpInfo({{#hasParams}}{{operationId}}Request{{/hasParams}})
{{/vendorExtensions.x-group-parameters}} {{/vendorExtensions.x-group-parameters}}
{{summary}}{{#notes}} {{summary}}{{#notes}}
@@ -158,6 +158,9 @@ import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}}
import {{{invokerPackage}}}.models.*; import {{{invokerPackage}}}.models.*;
import {{{package}}}.{{{classname}}};{{#vendorExtensions.x-group-parameters}} import {{{package}}}.{{{classname}}};{{#vendorExtensions.x-group-parameters}}
import {{{package}}}.{{{classname}}}.*;{{/vendorExtensions.x-group-parameters}} import {{{package}}}.{{{classname}}}.*;{{/vendorExtensions.x-group-parameters}}
{{#asyncNative}}
import java.util.concurrent.CompletableFuture;
{{/asyncNative}}
public class Example { public class Example {
public static void main(String[] args) { public static void main(String[] args) {
@@ -189,7 +192,7 @@ public class Example {
{{/allParams}} {{/allParams}}
try { try {
{{^vendorExtensions.x-group-parameters}} {{^vendorExtensions.x-group-parameters}}
ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> response = apiInstance.{{{operationId}}}WithHttpInfo({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} response = apiInstance.{{{operationId}}}WithHttpInfo({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{/vendorExtensions.x-group-parameters}} {{/vendorExtensions.x-group-parameters}}
{{#vendorExtensions.x-group-parameters}} {{#vendorExtensions.x-group-parameters}}
{{#hasParams}} {{#hasParams}}
@@ -197,18 +200,27 @@ public class Example {
.{{paramName}}({{paramName}}){{/allParams}} .{{paramName}}({{paramName}}){{/allParams}}
.build(); .build();
{{/hasParams}} {{/hasParams}}
ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> response = apiInstance.{{{operationId}}}WithHttpInfo({{#hasParams}}request{{/hasParams}}); {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} response = apiInstance.{{{operationId}}}WithHttpInfo({{#hasParams}}request{{/hasParams}});
{{/vendorExtensions.x-group-parameters}} {{/vendorExtensions.x-group-parameters}}
System.out.println("Status code: " + response.getStatusCode()); System.out.println("Status code: " + response{{#asyncNative}}.get(){{/asyncNative}}.getStatusCode());
System.out.println("Response headers: " + response.getHeaders().toString()); System.out.println("Response headers: " + response{{#asyncNative}}.get(){{/asyncNative}}.getHeaders());
{{#returnType}} {{#returnType}}
System.out.println("Response body: " + response.getData().toString()); System.out.println("Response body: " + response{{#asyncNative}}.get(){{/asyncNative}}.getData());
{{/returnType}} {{/returnType}}
{{#asyncNative}}
} catch (InterruptedException | ExecutionException e) {
ApiException apiException = (ApiException)e.getCause();
System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}");
System.err.println("Status code: " + apiException.getCode());
System.err.println("Response headers: " + apiException.getResponseHeaders());
System.err.println("Reason: " + apiException.getResponseBody());
e.printStackTrace();
{{/asyncNative}}
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}");
System.err.println("Status code: " + e.getCode()); System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders()); System.err.println("Response headers: " + e.getResponseHeaders());
System.err.println("Reason: " + e.getResponseBody());
e.printStackTrace(); e.printStackTrace();
} }
} }
@@ -232,8 +244,8 @@ Name | Type | Description | Notes
### Return type ### Return type
{{#returnType}}ApiResponse<{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}>{{/returnType}} {{#returnType}}{{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}>{{#asyncNative}}>{{/asyncNative}}{{/returnType}}
{{^returnType}}ApiResponse<Void>{{/returnType}} {{^returnType}}{{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<Void>{{#asyncNative}}>{{/asyncNative}}{{/returnType}}
### Authorization ### Authorization
@@ -252,7 +264,6 @@ Name | Type | Description | Notes
| **{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} | | **{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} |
{{/responses}} {{/responses}}
{{/responses.0}} {{/responses.0}}
{{/asyncNative}}
{{#vendorExtensions.x-group-parameters}}{{#hasParams}} {{#vendorExtensions.x-group-parameters}}{{#hasParams}}
<a name="API{{operationId}}Request"></a> <a name="API{{operationId}}Request"></a>

View File

@@ -530,7 +530,9 @@ public class ApiClient {
loggingInterceptor.setLevel(Level.BODY); loggingInterceptor.setLevel(Level.BODY);
httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build();
} else { } else {
httpClient.interceptors().remove(loggingInterceptor); final OkHttpClient.Builder builder = httpClient.newBuilder();
builder.interceptors().remove(loggingInterceptor);
httpClient = builder.build();
loggingInterceptor = null; loggingInterceptor = null;
} }
} }

View File

@@ -73,7 +73,7 @@ public class {{classname}} {
{{#isDeprecated}} {{#isDeprecated}}
@Deprecated @Deprecated
{{/isDeprecated}} {{/isDeprecated}}
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws RestClientException { public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection<org.springframework.core.io.Resource>{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.Resource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws RestClientException {
{{#returnType}} {{#returnType}}
return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}).getBody(); return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}).getBody();
{{/returnType}} {{/returnType}}
@@ -101,7 +101,7 @@ public class {{classname}} {
{{#isDeprecated}} {{#isDeprecated}}
@Deprecated @Deprecated
{{/isDeprecated}} {{/isDeprecated}}
public ResponseEntity<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws RestClientException { public ResponseEntity<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection<org.springframework.core.io.Resource>{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.Resource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws RestClientException {
Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
{{#allParams}}{{#required}} {{#allParams}}{{#required}}
// verify the required parameter '{{paramName}}' is set // verify the required parameter '{{paramName}}' is set
@@ -131,7 +131,7 @@ public class {{classname}} {
{{/hasMore}}{{/cookieParams}}{{/hasCookieParams}}{{#hasFormParams}} {{/hasMore}}{{/cookieParams}}{{/hasCookieParams}}{{#hasFormParams}}
{{#formParams}}if ({{paramName}} != null) {{#formParams}}if ({{paramName}} != null)
formParams.{{^collectionFormat}}add{{/collectionFormat}}{{#collectionFormat}}put{{/collectionFormat}}("{{baseName}}", {{#isFile}}{{^collectionFormat}}new FileSystemResource({{paramName}}){{/collectionFormat}}{{/isFile}}{{#isFile}}{{#collectionFormat}}{{paramName}}.stream().map(FileSystemResource::new).collect(Collectors.toList()){{/collectionFormat}}{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});{{#hasMore}} formParams.{{^collectionFormat}}add{{/collectionFormat}}{{#collectionFormat}}put{{/collectionFormat}}("{{baseName}}", {{#isFile}}{{^collectionFormat}}{{#useAbstractionForFiles}}{{paramName}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}new FileSystemResource({{paramName}}){{/useAbstractionForFiles}}{{/collectionFormat}}{{/isFile}}{{#isFile}}{{#collectionFormat}}{{paramName}}.stream(){{^useAbstractionForFiles}}.map(FileSystemResource::new){{/useAbstractionForFiles}}.collect(Collectors.toList()){{/collectionFormat}}{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});{{#hasMore}}
{{/hasMore}}{{/formParams}}{{/hasFormParams}} {{/hasMore}}{{/formParams}}{{/hasFormParams}}
final String[] accepts = { {{#hasProduces}} final String[] accepts = { {{#hasProduces}}

View File

@@ -34,7 +34,7 @@ public class {{classname}}Test {
@Test @Test
public void {{operationId}}Test() { public void {{operationId}}Test() {
{{#allParams}} {{#allParams}}
{{{dataType}}} {{paramName}} = null; {{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection<org.springframework.core.io.Resource>{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.Resource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}} = null;
{{/allParams}} {{/allParams}}
{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});

View File

@@ -8,6 +8,7 @@
{{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}}
{{/vars}} {{/vars}}
}) })
@JsonTypeName("{{name}}")
{{/jackson}} {{/jackson}}
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}
public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{

View File

@@ -1,8 +1,16 @@
{{#jackson}} {{#jackson}}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true)
{{#discriminator.mappedModels}}
{{#-first}}
@JsonSubTypes({ @JsonSubTypes({
{{#discriminator.mappedModels}} {{/-first}}
@JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"), @JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"),
{{/discriminator.mappedModels}} {{#-last}}
}){{/jackson}} })
{{/-last}}
{{/discriminator.mappedModels}}
{{#isClassnameSanitized}}
@JsonTypeName("{{name}}")
{{/isClassnameSanitized}}
{{/jackson}}

View File

@@ -38,6 +38,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import org.springframework.http.codec.multipart.Part;
{{/reactive}} {{/reactive}}
{{#useBeanValidation}} {{#useBeanValidation}}
@@ -135,7 +136,7 @@ public interface {{classname}} {
} }
// Override this method // Override this method
{{#jdk8-default-interface}}default {{/jdk8-default-interface}} {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{^isFile}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{{dataType}}}{{/reactive}}{{#reactive}}{{^isListContainer}}Mono{{/isListContainer}}{{#isListContainer}}Flux{{/isListContainer}}<{{{baseType}}}>{{/reactive}}{{/isBodyParam}}{{/isFile}}{{#isFile}}MultipartFile{{/isFile}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#reactive}}{{#hasParams}}, {{/hasParams}}ServerWebExchange exchange{{/reactive}}){{#unhandledException}} throws Exception{{/unhandledException}} { {{#jdk8-default-interface}}default {{/jdk8-default-interface}} {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{^isFile}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{{dataType}}}{{/reactive}}{{#reactive}}{{^isListContainer}}Mono{{/isListContainer}}{{#isListContainer}}Flux{{/isListContainer}}<{{{baseType}}}>{{/reactive}}{{/isBodyParam}}{{/isFile}}{{#isFile}}{{#reactive}}Flux<Part>{{/reactive}}{{^reactive}}MultipartFile{{/reactive}}{{/isFile}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#reactive}}{{#hasParams}}, {{/hasParams}}ServerWebExchange exchange{{/reactive}}){{#unhandledException}} throws Exception{{/unhandledException}} {
{{/delegate-method}} {{/delegate-method}}
{{^isDelegate}} {{^isDelegate}}
{{>methodBody}} {{>methodBody}}

View File

@@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import org.springframework.http.codec.multipart.Part;
{{/reactive}} {{/reactive}}
import java.util.List; import java.util.List;
@@ -67,7 +68,7 @@ public interface {{classname}}Delegate {
{{/externalDocs}} {{/externalDocs}}
* @see {{classname}}#{{operationId}} * @see {{classname}}#{{operationId}}
*/ */
{{#jdk8-default-interface}}default {{/jdk8-default-interface}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{^isFile}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{{dataType}}}{{/reactive}}{{#reactive}}{{^isListContainer}}Mono{{/isListContainer}}{{#isListContainer}}Flux{{/isListContainer}}<{{{baseType}}}>{{/reactive}}{{/isBodyParam}}{{/isFile}}{{#isFile}}{{#isListContainer}}List<{{/isListContainer}}MultipartFile{{#isListContainer}}>{{/isListContainer}}{{/isFile}} {{paramName}}{{#hasMore}}, {{#jdk8-default-interface}}default {{/jdk8-default-interface}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{^isFile}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{{dataType}}}{{/reactive}}{{#reactive}}{{^isListContainer}}Mono{{/isListContainer}}{{#isListContainer}}Flux{{/isListContainer}}<{{{baseType}}}>{{/reactive}}{{/isBodyParam}}{{/isFile}}{{#isFile}}{{#isListContainer}}List<{{/isListContainer}}{{#reactive}}Flux<Part>{{/reactive}}{{^reactive}}MultipartFile{{/reactive}}{{#isListContainer}}>{{/isListContainer}}{{/isFile}} {{paramName}}{{#hasMore}},
{{/hasMore}}{{/allParams}}{{#reactive}}{{#hasParams}}, {{/hasMore}}{{/allParams}}{{#reactive}}{{#hasParams}},
{{/hasParams}}ServerWebExchange exchange{{/reactive}}){{#unhandledException}} throws Exception{{/unhandledException}}{{^jdk8-default-interface}};{{/jdk8-default-interface}}{{#jdk8-default-interface}} { {{/hasParams}}ServerWebExchange exchange{{/reactive}}){{#unhandledException}} throws Exception{{/unhandledException}}{{^jdk8-default-interface}};{{/jdk8-default-interface}}{{#jdk8-default-interface}} {
{{>methodBody}} {{>methodBody}}

View File

@@ -1 +1 @@
{{#isFormParam}}{{^isFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, allowableValues="{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}@ApiParam(value = "{{{description}}}") {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#isListContainer}}List<{{/isListContainer}}MultipartFile{{#isListContainer}}>{{/isListContainer}} {{baseName}}{{/isFile}}{{/isFormParam}} {{#isFormParam}}{{^isFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, allowableValues="{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}@ApiParam(value = "{{{description}}}") {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#isListContainer}}List<{{/isListContainer}}{{#reactive}}Flux<Part>{{/reactive}}{{^reactive}}MultipartFile{{/reactive}}{{#isListContainer}}>{{/isListContainer}} {{baseName}}{{/isFile}}{{/isFormParam}}

View File

@@ -1 +1 @@
{{#isFormParam}}{{^isFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) @RequestParam(value="{{baseName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}@ApiParam(value = "{{{description}}}") @RequestParam("{{baseName}}") {{#isListContainer}}List<{{/isListContainer}}MultipartFile{{#isListContainer}}>{{/isListContainer}} {{paramName}}{{/isFile}}{{/isFormParam}} {{#isFormParam}}{{^isFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) @RequestParam(value="{{baseName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}@ApiParam(value = "{{{description}}}") @RequestParam("{{baseName}}") {{#isListContainer}}List<{{/isListContainer}}{{#reactive}}Flux<Part>{{/reactive}}{{^reactive}}MultipartFile{{/reactive}}{{#isListContainer}}>{{/isListContainer}} {{paramName}}{{/isFile}}{{/isFormParam}}

View File

@@ -3,7 +3,8 @@
{ {
"name": "{{baseName}}", "name": "{{baseName}}",
"type": {{^required}}["null", {{/required}}{{>typeProperty}}{{^required}}]{{/required}}, "type": {{^required}}["null", {{/required}}{{>typeProperty}}{{^required}}]{{/required}},
"doc": "{{{description}}}" "doc": "{{{description}}}"{{^required}},
"default": null{{/required}}
}{{^-last}},{{/-last}} }{{^-last}},{{/-last}}
{{/vars}} {{/vars}}
] ]

View File

@@ -20,6 +20,10 @@
namespace {{this}} { namespace {{this}} {
{{/modelNamespaceDeclarations}} {{/modelNamespaceDeclarations}}
{{#vendorExtensions.x-has-forward-declarations}}
{{#vendorExtensions.x-forward-declarations}}{{.}}
{{/vendorExtensions.x-forward-declarations}}
{{/vendorExtensions.x-has-forward-declarations}}
{{#isEnum}} {{#isEnum}}
class {{declspec}} {{classname}} class {{declspec}} {{classname}}
: public {{#parent}}{{{parent}}}{{/parent}}{{^parent}}ModelBase{{/parent}} : public {{#parent}}{{{parent}}}{{/parent}}{{^parent}}ModelBase{{/parent}}

View File

@@ -418,12 +418,13 @@ namespace {{packageName}}.{{apiPackage}}
"{{{mediaType}}}"{{#hasMore}},{{/hasMore}} "{{{mediaType}}}"{{#hasMore}},{{/hasMore}}
{{/produces}} {{/produces}}
}; };
foreach (var _contentType in _contentTypes)
localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType); var localVarContentType = {{packageName}}.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
foreach (var _accept in _accepts)
localVarRequestOptions.HeaderParameters.Add("Accept", _accept); var localVarAccept = {{packageName}}.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
{{#pathParams}} {{#pathParams}}
{{#required}} {{#required}}

View File

@@ -1,7 +1,7 @@
class {{classname}} { class {{classname}} {
{{#vars}} {{#vars}}
{{#description}}/* {{{description}}} */{{/description}} {{#description}}/* {{{description}}} */{{/description}}
{{{dataType}}} {{name}} = {{{defaultValue}}}; {{^defaultValue}}{{{dataType}}} {{name}} = null;{{/defaultValue}}{{#defaultValue}}{{{dataType}}} {{name}} = {{defaultValue}};{{/defaultValue}}
{{#allowableValues}} {{#allowableValues}}
{{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{ {{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{
{{/allowableValues}} {{/allowableValues}}
@@ -58,14 +58,24 @@ class {{classname}} {
return { return {
{{#vars}} {{#vars}}
{{#isDateTime}} {{#isDateTime}}
'{{baseName}}': {{name}} == null ? '' : {{name}}.toUtc().toIso8601String(){{^-last}},{{/-last}} '{{baseName}}': {{name}} == null ? '' : {{name}}.toUtc().toIso8601String(){{^-last}},{{/-last}}
{{/isDateTime}} {{/isDateTime}}
{{#isDate}} {{#isDate}}
'{{baseName}}': {{name}} == null ? '' : {{name}}.toUtc().toIso8601String(){{^-last}},{{/-last}} '{{baseName}}': {{name}} == null ? '' : {{name}}.toUtc().toIso8601String(){{^-last}},{{/-last}}
{{/isDate}} {{/isDate}}
{{^isDateTime}} {{^isDateTime}}
{{^isDate}} {{^isDate}}
'{{baseName}}': {{name}}{{^-last}},{{/-last}} {{#complexType}}
{{#isListContainer}}
'{{baseName}}': {{name}} == null ? null : {{name}}.map((item) => item.toJson()).toList(){{^-last}},{{/-last}}
{{/isListContainer}}
{{^isListContainer}}
'{{baseName}}': {{name}} == null ? null : {{name}}.toJson(){{^-last}},{{/-last}}
{{/isListContainer}}
{{/complexType}}
{{^complexType}}
'{{baseName}}': {{name}}{{^-last}},{{/-last}}
{{/complexType}}
{{/isDate}} {{/isDate}}
{{/isDateTime}} {{/isDateTime}}
{{/vars}} {{/vars}}

View File

@@ -3,6 +3,7 @@ library {{pubName}}.api;
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'package:http/http.dart'; import 'package:http/http.dart';
import 'package:meta/meta.dart';
part 'api_client.dart'; part 'api_client.dart';
part 'api_helper.dart'; part 'api_helper.dart';

View File

@@ -1,15 +1,19 @@
class {{classname}} { class {{classname}} {
{{#vars}} {{#vars}}
{{#description}}/* {{{description}}} */{{/description}} {{#description}}/// {{{description}}}{{/description}}
{{{dataType}}} {{name}} = {{{defaultValue}}}; {{^isEnum}}
{{^defaultValue}}{{{dataType}}} {{name}};{{/defaultValue}}{{#defaultValue}}{{{dataType}}} {{name}} = {{defaultValue}};{{/defaultValue}}
{{/isEnum}}
{{#isEnum}}
{{#allowableValues}} {{#allowableValues}}
{{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{ {{#min}} // range from {{min}} to {{max}}{{/min}}{{classname}}{{{enumName}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}}{{/required}};
{{/allowableValues}} {{/allowableValues}}
{{/isEnum}}
{{/vars}} {{/vars}}
{{classname}}({ {{classname}}({
{{#vars}} {{#vars}}
this.{{name}}, {{#required}}@required this.{{name}}{{/required}}{{^required}}this.{{name}}{{#defaultValue}} = {{defaultValue}}{{/defaultValue}}{{/required}},
{{/vars}} {{/vars}}
}); });
@@ -37,7 +41,20 @@ class {{classname}} {
{{#isListContainer}} {{#isListContainer}}
{{name}} = (json['{{baseName}}'] == null) ? {{name}} = (json['{{baseName}}'] == null) ?
null : null :
{{#items.isListContainer}}
(json['{{baseName}}'] as List).map(
(e) => e == null ? null :
{{#items.complexType}}
{{items.complexType}}.listFromJson(json['{{baseName}}'])
{{/items.complexType}}
{{^items.complexType}}
(e as List).cast<{{items.items.dataType}}>()
{{/items.complexType}}
).toList();
{{/items.isListContainer}}
{{^items.isListContainer}}
{{complexType}}.listFromJson(json['{{baseName}}']); {{complexType}}.listFromJson(json['{{baseName}}']);
{{/items.isListContainer}}
{{/isListContainer}} {{/isListContainer}}
{{^isListContainer}} {{^isListContainer}}
{{#isMapContainer}} {{#isMapContainer}}
@@ -78,7 +95,12 @@ class {{classname}} {
json['{{baseName}}'].toDouble(); json['{{baseName}}'].toDouble();
{{/isDouble}} {{/isDouble}}
{{^isDouble}} {{^isDouble}}
{{^isEnum}}
{{name}} = json['{{baseName}}']; {{name}} = json['{{baseName}}'];
{{/isEnum}}
{{#isEnum}}
{{name}} = {{classname}}{{{enumName}}}.fromJson(json['{{baseName}}']);
{{/isEnum}}
{{/isDouble}} {{/isDouble}}
{{/isMapContainer}} {{/isMapContainer}}
{{/isListContainer}} {{/isListContainer}}
@@ -89,7 +111,7 @@ class {{classname}} {
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
Map <String, dynamic> json = {}; Map<String, dynamic> json = {};
{{#vars}} {{#vars}}
{{^isNullable}} {{^isNullable}}
if ({{name}} != null) if ({{name}} != null)
@@ -102,7 +124,12 @@ class {{classname}} {
{{/isDate}} {{/isDate}}
{{^isDateTime}} {{^isDateTime}}
{{^isDate}} {{^isDate}}
{{^isEnum}}
json['{{baseName}}'] = {{name}}; json['{{baseName}}'] = {{name}};
{{/isEnum}}
{{#isEnum}}
json['{{baseName}}'] = {{name}}.value;
{{/isEnum}}
{{/isDate}} {{/isDate}}
{{/isDateTime}} {{/isDateTime}}
{{/vars}} {{/vars}}
@@ -114,7 +141,7 @@ class {{classname}} {
} }
static Map<String, {{classname}}> mapFromJson(Map<String, dynamic> json) { static Map<String, {{classname}}> mapFromJson(Map<String, dynamic> json) {
var map = Map<String, {{classname}}>(); final map = Map<String, {{classname}}>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = {{classname}}.fromJson(value)); json.forEach((String key, dynamic value) => map[key] = {{classname}}.fromJson(value));
} }
@@ -123,12 +150,17 @@ class {{classname}} {
// maps a json object with a list of {{classname}}-objects as value to a dart map // maps a json object with a list of {{classname}}-objects as value to a dart map
static Map<String, List<{{classname}}>> mapListFromJson(Map<String, dynamic> json) { static Map<String, List<{{classname}}>> mapListFromJson(Map<String, dynamic> json) {
var map = Map<String, List<{{classname}}>>(); final map = Map<String, List<{{classname}}>>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) { json.forEach((String key, dynamic value) {
map[key] = {{classname}}.listFromJson(value); map[key] = {{classname}}.listFromJson(value);
}); });
} }
return map; return map;
} }
} }
{{#vars}}
{{#isEnum}}
{{>enum_inline}}
{{/isEnum}}
{{/vars}}

View File

@@ -9,20 +9,27 @@ class {{classname}} {
{{#description}} {{#description}}
/// {{description}} /// {{description}}
{{/description}} {{/description}}
static const {{classname}} {{{name}}} = const {{classname}}._internal({{{value}}}); static const {{classname}} {{{name}}} = {{classname}}._internal({{value}});
{{/enumVars}} {{/enumVars}}
{{/allowableValues}} {{/allowableValues}}
{{dataType}} toJson (){ {{dataType}} toJson () {
return this.value; return value;
}
@override
String toString () {
return value;
} }
static {{classname}} fromJson({{dataType}} value) { static {{classname}} fromJson({{dataType}} value) {
return new {{classname}}TypeTransformer().decode(value); return {{classname}}TypeTransformer().decode(value);
} }
static List<{{classname}}> listFromJson(List<dynamic> json) { static List<{{classname}}> listFromJson(List<dynamic> json) {
return json == null ? new List<{{classname}}>() : json.map((value) => {{classname}}.fromJson(value)).toList(); return json == null
? List<{{classname}}>()
: json.map((value) => {{classname}}.fromJson(value)).toList();
} }
} }

View File

@@ -0,0 +1,52 @@
class {{classname}}{{enumName}} {
/// The underlying value of this enum member.
final {{{dataType}}} value;
const {{classname}}{{enumName}}._internal(this.value);
{{#allowableValues}}
{{#enumVars}}
{{#description}}
/// {{description}}
{{/description}}
static const {{classname}}{{enumName}} {{name}} = {{classname}}{{enumName}}._internal({{{value}}});
{{/enumVars}}
{{/allowableValues}}
{{{dataType}}} toJson () {
return value;
}
@override
String toString () {
return value;
}
static {{classname}}{{enumName}} fromJson({{{dataType}}} value) {
return {{classname}}{{enumName}}TypeTransformer().decode(value);
}
static List<{{classname}}{{enumName}}> listFromJson(List<dynamic> json) {
return json == null
? List<{{classname}}{{enumName}}>()
: json.map((value) => {{classname}}{{enumName}}.fromJson(value)).toList();
}
}
class {{classname}}{{enumName}}TypeTransformer {
dynamic encode({{classname}}{{enumName}} data) {
return data.value;
}
{{classname}}{{enumName}} decode(dynamic data) {
switch (data) {
{{#allowableValues}}
{{#enumVars}}
case {{{value}}}: return {{classname}}{{enumName}}.{{{name}}};
{{/enumVars}}
{{/allowableValues}}
default: return null;
}
}
}

View File

@@ -8,5 +8,6 @@ environment:
sdk: '>=2.0.0 <3.0.0' sdk: '>=2.0.0 <3.0.0'
dependencies: dependencies:
http: '>=0.12.0 <0.13.0' http: '>=0.12.0 <0.13.0'
meta: ^1.1.8
dev_dependencies: dev_dependencies:
test: ^1.3.0 test: ^1.3.0

View File

@@ -2,8 +2,13 @@
type {{classname}} struct { type {{classname}} struct {
{{#parent}} {{#parent}}
{{^isMapModel}} {{^isMapModel}}
{{^isArrayModel}}
{{{parent}}} {{{parent}}}
{{/isArrayModel}}
{{/isMapModel}} {{/isMapModel}}
{{#isArrayModel}}
Items {{{parent}}}
{{/isArrayModel}}
{{/parent}} {{/parent}}
{{#vars}} {{#vars}}
{{^-first}} {{^-first}}
@@ -218,9 +223,10 @@ func (o *{{classname}}) Unset{{name}}() {
{{/required}} {{/required}}
{{/vars}} {{/vars}}
func (o {{classname}}) MarshalJSON() ([]byte, error) { func (o {{classname}}) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{} toSerialize := {{#isArrayModel}}make([]interface{}, len(o.Items)){{/isArrayModel}}{{^isArrayModel}}map[string]interface{}{}{{/isArrayModel}}
{{#parent}} {{#parent}}
{{^isMapModel}} {{^isMapModel}}
{{^isArrayModel}}
serialized{{parent}}, err{{parent}} := json.Marshal(o.{{parent}}) serialized{{parent}}, err{{parent}} := json.Marshal(o.{{parent}})
if err{{parent}} != nil { if err{{parent}} != nil {
return []byte{}, err{{parent}} return []byte{}, err{{parent}}
@@ -229,7 +235,13 @@ func (o {{classname}}) MarshalJSON() ([]byte, error) {
if err{{parent}} != nil { if err{{parent}} != nil {
return []byte{}, err{{parent}} return []byte{}, err{{parent}}
} }
{{/isArrayModel}}
{{/isMapModel}} {{/isMapModel}}
{{#isArrayModel}}
for i, item := range o.Items {
toSerialize[i] = item
}
{{/isArrayModel}}
{{/parent}} {{/parent}}
{{#vars}} {{#vars}}
{{! if argument is nullable, only serialize it if it is set}} {{! if argument is nullable, only serialize it if it is set}}
@@ -265,6 +277,72 @@ func (o {{classname}}) MarshalJSON() ([]byte, error) {
{{#isAdditionalPropertiesTrue}} {{#isAdditionalPropertiesTrue}}
func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) { func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) {
{{#parent}}
{{^isMapModel}}
type {{classname}}WithoutEmbeddedStruct struct {
{{#vars}}
{{^-first}}
{{/-first}}
{{#description}}
// {{{description}}}
{{/description}}
{{name}} {{^required}}{{^isNullable}}*{{/isNullable}}{{/required}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}`
{{/vars}}
}
var{{{classname}}}WithoutEmbeddedStruct := {{{classname}}}WithoutEmbeddedStruct{}
err = json.Unmarshal(bytes, &var{{{classname}}}WithoutEmbeddedStruct)
if err == nil {
var{{{classname}}} := _{{{classname}}}{}
{{#vars}}
var{{{classname}}}.{{{name}}} = var{{{classname}}}WithoutEmbeddedStruct.{{{name}}}
{{/vars}}
*o = {{{classname}}}(var{{{classname}}})
} else {
return err
}
var{{{classname}}} := _{{{classname}}}{}
err = json.Unmarshal(bytes, &var{{{classname}}})
if err == nil {
o.{{{parent}}} = var{{{classname}}}.{{{parent}}}
} else {
return err
}
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
{{#vars}}
delete(additionalProperties, "{{{baseName}}}")
{{/vars}}
// remove fields from embedded structs
reflect{{{parent}}} := reflect.ValueOf(o.{{{parent}}})
for i := 0; i < reflect{{{parent}}}.Type().NumField(); i++ {
t := reflect{{{parent}}}.Type().Field(i)
if jsonTag := t.Tag.Get("json"); jsonTag != "" {
fieldName := ""
if commaIdx := strings.Index(jsonTag, ","); commaIdx > 0 {
fieldName = jsonTag[:commaIdx]
} else {
fieldName = jsonTag
}
if fieldName != "AdditionalProperties" {
delete(additionalProperties, fieldName)
}
}
}
o.AdditionalProperties = additionalProperties
}
return err
{{/isMapModel}}
{{#isMapModel}}
var{{{classname}}} := _{{{classname}}}{} var{{{classname}}} := _{{{classname}}}{}
if err = json.Unmarshal(bytes, &var{{{classname}}}); err == nil { if err = json.Unmarshal(bytes, &var{{{classname}}}); err == nil {
@@ -281,7 +359,33 @@ func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) {
} }
return err return err
{{/isMapModel}}
{{/parent}}
{{^parent}}
var{{{classname}}} := _{{{classname}}}{}
if err = json.Unmarshal(bytes, &var{{{classname}}}); err == nil {
*o = {{{classname}}}(var{{{classname}}})
}
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
{{#vars}}
delete(additionalProperties, "{{{baseName}}}")
{{/vars}}
o.AdditionalProperties = additionalProperties
}
return err
{{/parent}}
} }
{{/isAdditionalPropertiesTrue}} {{/isAdditionalPropertiesTrue}}
{{#isArrayModel}}
func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) {
return json.Unmarshal(bytes, &o.Items)
}
{{/isArrayModel}}
{{>nullable_model}} {{>nullable_model}}

View File

@@ -32,7 +32,7 @@ import (
) )
var ( var (
jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?(?:problem\+)?json)`)
xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`)
) )

View File

@@ -70,7 +70,7 @@ public class HttpLoggingFilter implements Filter {
chain.doFilter(bufferedRequest, bufferedResponse); chain.doFilter(bufferedRequest, bufferedResponse);
long elapsedTime = System.currentTimeMillis() - start; long elapsedTime = System.currentTimeMillis() - start;
String respContent = null; String respContent = null;
if (bufferedResponse.getContent() == null || bufferedResponse.getContent() == "") { if (bufferedResponse.getContent() == null || "".equals(bufferedResponse.getContent())) {
respContent = "No data"; respContent = "No data";
} else { } else {
respContent = bufferedResponse.getContent(); respContent = bufferedResponse.getContent();

View File

@@ -46,7 +46,7 @@ import {{packageName}}.auth.*
val clientConfig: (HttpClientConfig<*>) -> Unit = { it.install(JsonFeature, jsonConfig) } val clientConfig: (HttpClientConfig<*>) -> Unit = { it.install(JsonFeature, jsonConfig) }
httpClientEngine?.let { HttpClient(it, clientConfig) } ?: HttpClient(clientConfig) httpClientEngine?.let { HttpClient(it, clientConfig) } ?: HttpClient(clientConfig)
} }
{{#hasAuthMethods}}
private val authentications: kotlin.collections.Map<String, Authentication> by lazy { private val authentications: kotlin.collections.Map<String, Authentication> by lazy {
mapOf({{#authMethods}}{{#isBasic}}{{#isBasicBasic}} mapOf({{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
"{{name}}" to HttpBasicAuth(){{/isBasicBasic}}{{^isBasicBasic}} "{{name}}" to HttpBasicAuth(){{/isBasicBasic}}{{^isBasicBasic}}
@@ -54,6 +54,10 @@ import {{packageName}}.auth.*
"{{name}}" to ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"){{/isApiKey}}{{#isOAuth}} "{{name}}" to ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"){{/isApiKey}}{{#isOAuth}}
"{{name}}" to OAuth(){{/isOAuth}}{{#hasMore}}, {{/hasMore}}{{/authMethods}}) "{{name}}" to OAuth(){{/isOAuth}}{{#hasMore}}, {{/hasMore}}{{/authMethods}})
} }
{{/hasAuthMethods}}
{{^hasAuthMethods}}
private val authentications: kotlin.collections.Map<String, Authentication>? = null
{{/hasAuthMethods}}
{{#nonPublicApi}}internal {{/nonPublicApi}}companion object { {{#nonPublicApi}}internal {{/nonPublicApi}}companion object {
protected val UNSAFE_HEADERS = listOf(HttpHeaders.ContentType) protected val UNSAFE_HEADERS = listOf(HttpHeaders.ContentType)
@@ -74,7 +78,7 @@ import {{packageName}}.auth.*
* @param username Username * @param username Username
*/ */
fun setUsername(username: String) { fun setUsername(username: String) {
val auth = authentications.values.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? val auth = authentications?.values?.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth?
?: throw Exception("No HTTP basic authentication configured") ?: throw Exception("No HTTP basic authentication configured")
auth.username = username auth.username = username
} }
@@ -85,7 +89,7 @@ import {{packageName}}.auth.*
* @param password Password * @param password Password
*/ */
fun setPassword(password: String) { fun setPassword(password: String) {
val auth = authentications.values.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? val auth = authentications?.values?.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth?
?: throw Exception("No HTTP basic authentication configured") ?: throw Exception("No HTTP basic authentication configured")
auth.password = password auth.password = password
} }
@@ -97,7 +101,7 @@ import {{packageName}}.auth.*
* @param paramName The name of the API key parameter, or null or set the first key. * @param paramName The name of the API key parameter, or null or set the first key.
*/ */
fun setApiKey(apiKey: String, paramName: String? = null) { fun setApiKey(apiKey: String, paramName: String? = null) {
val auth = authentications.values.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName)} as ApiKeyAuth? val auth = authentications?.values?.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName)} as ApiKeyAuth?
?: throw Exception("No API key authentication configured") ?: throw Exception("No API key authentication configured")
auth.apiKey = apiKey auth.apiKey = apiKey
} }
@@ -109,7 +113,7 @@ import {{packageName}}.auth.*
* @param paramName The name of the API key parameter, or null or set the first key. * @param paramName The name of the API key parameter, or null or set the first key.
*/ */
fun setApiKeyPrefix(apiKeyPrefix: String, paramName: String? = null) { fun setApiKeyPrefix(apiKeyPrefix: String, paramName: String? = null) {
val auth = authentications.values.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName) } as ApiKeyAuth? val auth = authentications?.values?.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName) } as ApiKeyAuth?
?: throw Exception("No API key authentication configured") ?: throw Exception("No API key authentication configured")
auth.apiKeyPrefix = apiKeyPrefix auth.apiKeyPrefix = apiKeyPrefix
} }
@@ -120,7 +124,7 @@ import {{packageName}}.auth.*
* @param accessToken Access token * @param accessToken Access token
*/ */
fun setAccessToken(accessToken: String) { fun setAccessToken(accessToken: String) {
val auth = authentications.values.firstOrNull { it is OAuth } as OAuth? val auth = authentications?.values?.firstOrNull { it is OAuth } as OAuth?
?: throw Exception("No OAuth2 authentication configured") ?: throw Exception("No OAuth2 authentication configured")
auth.accessToken = accessToken auth.accessToken = accessToken
} }
@@ -131,7 +135,7 @@ import {{packageName}}.auth.*
* @param bearerToken The bearer token. * @param bearerToken The bearer token.
*/ */
fun setBearerToken(bearerToken: String) { fun setBearerToken(bearerToken: String) {
val auth = authentications.values.firstOrNull { it is HttpBearerAuth } as HttpBearerAuth? val auth = authentications?.values?.firstOrNull { it is HttpBearerAuth } as HttpBearerAuth?
?: throw Exception("No Bearer authentication configured") ?: throw Exception("No Bearer authentication configured")
auth.bearerToken = bearerToken auth.bearerToken = bearerToken
} }
@@ -175,7 +179,7 @@ import {{packageName}}.auth.*
private fun RequestConfig.updateForAuth(authNames: kotlin.collections.List<String>) { private fun RequestConfig.updateForAuth(authNames: kotlin.collections.List<String>) {
for (authName in authNames) { for (authName in authNames) {
val auth = authentications[authName] ?: throw Exception("Authentication undefined: $authName") val auth = authentications?.get(authName) ?: throw Exception("Authentication undefined: $authName")
auth.apply(query, headers) auth.apply(query, headers)
} }
} }

View File

@@ -37,7 +37,7 @@ class ExpressServer {
//Send the openapi document *AS GENERATED BY THE GENERATOR* //Send the openapi document *AS GENERATED BY THE GENERATOR*
this.app.get('/openapi', (req, res) => res.sendFile((path.join(__dirname, 'api', 'openapi.yaml')))); this.app.get('/openapi', (req, res) => res.sendFile((path.join(__dirname, 'api', 'openapi.yaml'))));
//View the openapi document in a visual interface. Should be able to test from this page //View the openapi document in a visual interface. Should be able to test from this page
this.app.use('/api-doc', swaggerUI.serve, swaggerUI.setup(this.schema)); this.app.use('/api-docs', swaggerUI.serve, swaggerUI.setup(this.schema));
this.app.get('/login-redirect', (req, res) => { this.app.get('/login-redirect', (req, res) => {
res.status(200); res.status(200);
res.json(req.query); res.json(req.query);

View File

@@ -533,7 +533,14 @@ use {{invokerPackage}}\ObjectSerializer;
if (${{paramName}} !== null) { if (${{paramName}} !== null) {
{{#isFile}} {{#isFile}}
$multipart = true; $multipart = true;
$formParams['{{baseName}}'] = \GuzzleHttp\Psr7\try_fopen(ObjectSerializer::toFormValue(${{paramName}}), 'rb'); $formParams['{{baseName}}'] = [];
$paramFiles = is_array(${{paramName}}) ? ${{paramName}} : [${{paramName}}];
foreach ($paramFiles as $paramFile) {
$formParams['{{baseName}}'][] = \GuzzleHttp\Psr7\try_fopen(
ObjectSerializer::toFormValue($paramFile),
'rb'
);
}
{{/isFile}} {{/isFile}}
{{^isFile}} {{^isFile}}
$formParams['{{baseName}}'] = ObjectSerializer::toFormValue(${{paramName}}); $formParams['{{baseName}}'] = ObjectSerializer::toFormValue(${{paramName}});
@@ -571,10 +578,13 @@ use {{invokerPackage}}\ObjectSerializer;
if ($multipart) { if ($multipart) {
$multipartContents = []; $multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) { foreach ($formParams as $formParamName => $formParamValue) {
$multipartContents[] = [ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
'name' => $formParamName, foreach ($formParamValueItems as $formParamValueItem) {
'contents' => $formParamValue $multipartContents[] = [
]; 'name' => $formParamName,
'contents' => $formParamValueItem
];
}
} }
// for HTTP post (form) // for HTTP post (form)
$httpBody = new MultipartStream($multipartContents); $httpBody = new MultipartStream($multipartContents);

View File

@@ -221,7 +221,8 @@ function {{{vendorExtensions.x-powershell-method-name}}} {
-QueryParameters $LocalVarQueryParameters ` -QueryParameters $LocalVarQueryParameters `
-FormParameters $LocalVarFormParameters ` -FormParameters $LocalVarFormParameters `
-CookieParameters $LocalVarCookieParameters ` -CookieParameters $LocalVarCookieParameters `
-ReturnType "{{#returnType}}{{{.}}}{{/returnType}}" -ReturnType "{{#returnType}}{{{.}}}{{/returnType}}" `
-IsBodyNullable {{#bodyParam}}{{#isNullable}}$true{{/isNullable}}{{^isNullable}}$false{{/isNullable}}{{/bodyParam}}{{^bodyParam}}$false{{/bodyParam}}
{{#vendorExtensions.x-ps-return-type-one-of}} {{#vendorExtensions.x-ps-return-type-one-of}}
# process oneOf response # process oneOf response

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