Compare commits

...

178 Commits

Author SHA1 Message Date
William Cheng
d2b81b721e Merge remote-tracking branch 'origin/master' into okhttp-gson-next-gen-better-error 2021-12-16 00:27:11 +08:00
William Cheng
c27ddc67fe show error when schema in discriminator mapping is undefined (#11127) 2021-12-15 22:18:39 +08:00
William Cheng
b2daa5a836 update jackson-databind-nullable to 0.2.2 (#11121) 2021-12-15 11:41:16 +08:00
Tal Kirshboim
3eb0465ec4 Update samples (#11119) 2021-12-15 11:38:10 +08:00
William Cheng
e5d58a35a2 update dependencies to newer versions (java) (#11116) 2021-12-14 18:32:37 +08:00
William Cheng
8ef49bbaa2 re-enable cpp-qt test in travis ci 2021-12-14 18:24:21 +08:00
basyskom-dege
8fbd11073a [QT][C++]fixed integration test for Oauth (#10921)
* fixed missing package, fixed namespace issues

* using older function to check if token is valid

* using time.h to check if token is valid
2021-12-14 18:23:18 +08:00
Bruno Coelho
eb224db540 [kotlin][client] remove old Date usage (#11082)
* [kotlin][client] remove old Date usage

* [kotlin][client] remove old Date usage
2021-12-14 16:03:12 +08:00
Bruno Coelho
5416e92d19 [swift5][client] add support for async/await in iOS 13 and above (#11109) 2021-12-14 15:58:19 +08:00
Tomáš Čermák
d5979d3180 [Protobuf-Schema] Added nullable (#11073) 2021-12-14 15:44:22 +08:00
William Cheng
fbb61658df [kotlin][client] rename ApiInfrastructureResponse to ApiResponse (#11094)
* rename ApiInfrastructureResponse to ApiResponse

* mark ApiResponse as reserved word

* update samples, docs

* fix typo
2021-12-12 16:32:08 +08:00
Bruno Coelho
3247903caa [kotlin][client] update request exceptions (#11065) 2021-12-11 21:48:59 +08:00
Guus Bloemsma
0236f84c11 [kotlin-client] Allowing vendor types for json (#10758)
* Using the first serializable 'consumes' mediaType
Using all deserializable 'produces' mediaTypes
Matching json vendor types as json

* updating the generated samples
2021-12-11 21:48:00 +08:00
Justin Black
cee5f75912 Feat adds content and header properties to CodegenResponse (#11046)
* Adds responseHeaders to codegenResponse

* Sets response headers in codegenResponse

* Samples updated

* Adds test of response headers

* Adds content to CodegenResponse

* Sets codegenResponse content

* Tests added, test content-data.yaml spec update

* Adds mediaTypeSchemaSuffix input to getContent

* Tests updated

* Updates how response content schema names are set

* Adds missing Locale to String.format invocations
2021-12-10 13:49:29 -08:00
Deniz Dogan
c94d2b2331 [swift5] Fix missing case for FormDataEncoding#encode (#11064)
Fixes #11062
2021-12-10 14:08:32 +08:00
William Cheng
550c0781dc [okhttp-gson-next-gen] new option for error object (#10995)
* add error body and type to api exception class

* add option to specify error object

* add option, update api doc with better error handling

* update samples

* update doc
2021-12-10 02:08:17 +08:00
Tomasz Prus
b755ae288a [Python] Add option to select/detect content-type. (#10978)
* [Python] Add option to select/detect content-type.

* Regenerate samples after rebase.

* Update samples.

* test: fix assertion
2021-12-08 13:15:26 -08:00
Justin Black
347b75a024 Fixes paramName and dataType for request body anyType parameters (#11075)
* Adds request body of any type

* Fixes param dataType, paramName, and baseName

* Uses updateRequestBodyForPrimitiveType as the else case for anyType request bodies like the code used to do

* Samples updated

* Samples regenerated
2021-12-08 13:03:08 -08:00
Bruno Coelho
c941044701 [swift5][client] allow request cancellation and authentication flow to work together (#11019)
* [swift5][client] allow request cancellation and authentication flow to work together

* [swift5][client] allow request cancellation and authentication flow to work together

* [swift5][client] rename OpenAPIRequestCancellable to RequestTask

* [swift5][client] rename OpenAPIRequestCancellable to RequestTask
2021-12-09 01:07:49 +08:00
William Cheng
b6bc20183b update doc 2021-12-08 19:57:36 +08:00
William Cheng
80786836f7 Merge remote-tracking branch 'origin/master' into okhttp-gson-next-gen-better-error 2021-12-08 09:40:14 +08:00
William Cheng
2ff6f833e2 add more tests for oneOf (#11068) 2021-12-08 09:39:42 +08:00
William Cheng
3539b39c73 Merge remote-tracking branch 'origin/master' into okhttp-gson-next-gen-better-error 2021-12-07 21:52:51 +08:00
William Cheng
a489a2e828 [java][okhttp-gson-next-gen] better error message in oneOf/anyOf (#11059)
* better error message

* update tests
2021-12-07 21:38:54 +08:00
William Cheng
7cd7f9e477 update samples 2021-12-07 17:06:36 +08:00
William Cheng
fe64d88887 Merge remote-tracking branch 'origin/master' into okhttp-gson-next-gen-better-error 2021-12-07 16:23:16 +08:00
William Cheng
192126be6b [java][okhttp-gson-next-gen] fix serialization, add tests (#11057)
* fix serialization, add tests

* add new files
2021-12-07 16:22:46 +08:00
William Cheng
000a18d3b9 [java][okhttp-gson-nextgen] Better null handling in oneOf, anyOf model (#11056)
* better null handling in oneOf model

* update anyof with better null handling

* add null test
2021-12-07 15:11:06 +08:00
William Cheng
95377f68bf [C#][functions] minor improvements. (#11034)
* better code format

* mark generator as beta

* update readme

* minor code format change

* remove docs

* add Docs

* remove docs

* add back docs

* mv yaml
2021-12-06 23:18:48 +08:00
William Cheng
b970f60c0c Merge remote-tracking branch 'origin/master' into okhttp-gson-next-gen-better-error 2021-12-05 22:45:14 +08:00
William Cheng
5a62ae6628 Add links to blog posts, remove nmuesch remove java tech comm (#11040)
* add links to blog posts, remove nmuesch remove java tech comm

* fix link
2021-12-05 17:58:55 +08:00
William Cheng
5451b77d42 [CodegenResponse] various enhancements and bug fixes (#10984)
* add more response tests, fix simpleType

* samples update

* replace simpleType with containerType

* update doc template

* fix typo in mustache tag
2021-12-05 17:43:17 +08:00
Yuriy Belenko
186842ea19 [php-slim4] Bump required PHP version to 7.4 (#11039)
* Change minimum PHP version to 7.4

* Refresh samples
2021-12-05 15:47:12 +08:00
Alexey Makhrov
03b4ac736f [typescript-angular] taggedUnions=true: Support recursive schemas (#11016)
* typescript-angular: taggedUnions=true: Preserve import to the parent model from the child
if the child property has a direct reference to it

* Fix javadoc
2021-12-04 17:43:52 +01:00
WILLIAM CHENG
96ee13bbb2 replace tab with spaces 2021-12-04 14:43:32 +08:00
Peter Leibiger
ecddd4cff1 [dart][dio][built_value] Fix missing serializer factory builders for additionalProperties (#11011)
Refactor the addition of custom serializer factories.
2021-12-04 14:32:36 +08:00
Peter Leibiger
85985e8bfb [dart][dio] Fix int64 based enums not correctly generated (#11014) 2021-12-04 14:31:55 +08:00
WILLIAM CHENG
86e549697e Merge branch 'master' of https://github.com/OpenAPITools/openapi-generator 2021-12-04 13:18:38 +08:00
WILLIAM CHENG
1799e9cd12 update doc 2021-12-04 13:18:29 +08:00
jzorn
8bc069778f Compare security schema names case-insensitive (#10989)
According to RFC 7235 (HTTP/1.1: Authentication), schema tokens are
handled case-insensitive (Section 2.1: Challenge and Response). This
change compares the known token values basic, bearer, and signature
case-insensitive.

- https://datatracker.ietf.org/doc/html/rfc7235#section-2.1
2021-12-04 13:18:06 +08:00
Tal Kirshboim
8fc6172c6d Build and test Kotlin Multiplatform samples in CI (#11023) 2021-12-04 13:06:37 +08:00
Jarrod Parkes
15f45711a8 add swift5 option for generating frozen enums (#11013)
* add swift5 option for generating frozen enums

* use case unknownDefault to avoid conflicts

* update comments to reflect unknownDefault case

* set default values for unknown case to avoid conflict

* dont need vendor extensions to detect enum raw data type

* move CaseIterableDefaultsLast into models mustache template

* comment catch all case and add support for other types

* add frozen enums to ci pipeline

* remove extraneous edit to extensions template

* remove left over protocols files

* small comment and case adjustments
2021-12-04 13:05:51 +08:00
Abrhm7786
6bc7390914 Azure functions (#11020)
* New branch

* Added test class for functions server

* Logger should not be static

* Added csharp-netcore-functions to docs/generators

* Added csharp-netcore-functions to generators.md

* Removes sln and csproj
2021-12-04 13:05:30 +08:00
Tal Kirshboim
3719035787 Fix HTTP client configuration object freezing issue on iOS (#11012) 2021-12-04 12:56:40 +08:00
Justin Black
836e40f1d2 Fixes CodegenMediaType schema baseName (#11030) 2021-12-03 10:21:36 -08:00
cghislai
b915ad99a8 typescript-angular: Add supports for v13 (#10877) 2021-12-03 09:10:40 +01:00
jiangyuan
ef31941b13 fix file path (#11005)
Co-authored-by: jiangyuan04 <jiangyuan04@baidu.com>
2021-12-02 08:50:52 -08:00
WILLIAM CHENG
bfb45f4d67 add option, update api doc with better error handling 2021-12-02 10:10:27 +08:00
Deniz Dogan
56e7f811bc Add Hashable to oneOf enums (#10971)
Fixes #10970
2021-12-01 14:49:00 +08:00
William Cheng
a745f053bd skip custom adapter for parent object (#10998) 2021-12-01 14:20:39 +08:00
agilob
40609ad677 Add vscode openapi workspace configuration (#10996)
* Add vscode openapi workspace

* Config changes for more intellij-like behaviour

* Remove recommended plugin editorconfig
2021-12-01 14:19:28 +08:00
William Cheng
acabbe0e88 Update launcher script to use 4.x as examples 2021-12-01 13:54:02 +08:00
Fumito Nakazawa
a24d314006 [swift5] Use enum as parameter instead of raw type (#10967)
* Fix enum type

* Remove operation_id

* Fix samples
2021-12-01 00:34:15 +08:00
WILLIAM CHENG
8d8c86728a add option to specify error object 2021-11-30 17:38:54 +08:00
WILLIAM CHENG
55357fccd6 add error body and type to api exception class 2021-11-30 15:49:53 +08:00
William Cheng
b061bd2146 [Java][Okhttp] Add oneOf support (#10875)
* add custom gson deserializer

* add check for additional fields, required fields

* add tests for custom deserializer

* add custom adapter

* add custom adapter

* register type adapter factory

* comment out custom deserializer and use adapter instead

* add okhttp-gson-nextgen

* add new files

* restore okhttp-gson

* switch to adapter

* remove custom de/serializer

* add comment

* update tests

* test nextgen in ci

* update doc

* use full model name in JSON.java

* undo changes

* add oneof discriminator support

* fix anyOf

* remove mappings

* add more tests

* fix oneof deserialization, add more tests

* add error body and type to api exception class

* JSON to use instance variables/methods

* Revert "add error body and type to api exception class"

This reverts commit 07f34e2c45.
2021-11-30 15:33:42 +08:00
jiangyuan
e7ac0eec4b [Python] fix model.mustache import (#10988)
* fix model.mustache import

* add samples file change

Co-authored-by: jiangyuan04 <jiangyuan04@baidu.com>
2021-11-29 17:50:19 -08:00
Tal Kirshboim
6406e5c031 [Kotlin][Multiplatform] Support custom Ktor HTTP client configuration (#10968)
* Support using a custom Ktor HTTP client configuration

* Remove ApiClient.kt secondary constructor
2021-11-30 09:33:42 +08:00
Justin Black
8702f24f05 Adds request body content data to allow multiple content types to be sent to servers (#10973)
* Adds CodegenMediaType and CodegenEncoding

* Adds partial new code to set Parameter content data

* Adds content to CodegenParameter

* Sets content for request bodies

* Adds testParameterContent

* Adds testRequestBodyContent
2021-11-29 09:31:38 -08:00
Alexander Karkossa
8e2e200e18 fix: changed Any to kotlin.Any (#10985) 2021-11-30 00:42:22 +08:00
WILLIAM CHENG
3b5345eb57 update option value in ruby generator 2021-11-27 10:03:27 +08:00
Takayuki Matsubara
b7e7c13673 update ruby's default options on document (#10924) 2021-11-27 10:02:14 +08:00
Tal Kirshboim
ae911ff2c1 Support generated gradle module as child module (#10966) 2021-11-27 09:36:19 +08:00
sullis
309b67f91e update GitHub Actions (#10963)
- use setup-java v2 everywhere
- use Temurin JDK everywhere
2021-11-26 15:05:47 +08:00
Kevin Chen
3d92df5a41 [Java][okhttp-gson] Support text/plain body (#10885)
* support serialize RequestBody with contentType text/plain

* add Serialize test

* update test comment
2021-11-26 15:04:19 +08:00
Justin Black
06faa289bd Adds codegenParameter.schema to allow referenced schemas in parameters (#10934)
* Removes python-experimental folder

* Sets schema in fromParameter

* Sets schema in codegenParameter

* Adds tests of schema
2021-11-25 18:00:53 -08:00
Fumito Nakazawa
a620853216 [swift5] Refactor encodeToJSON (#10961)
* Add protocol extension method

* execute sample script

* Add Packing.cmake

* Revert "Add Packing.cmake"

This reverts commit cb52547fe3.

* Remove empty lines

* Revert FILES

* Add Packing.cmake
2021-11-26 00:55:06 +08:00
Berlin Cho
8e303150ae [Java][resttemplate] Support URL queryParams Comma encoding (#10958)
* Java Encode comma (with unit tests)

* fix PMD warnings
2021-11-25 16:12:55 +08:00
Steve Mason
5bd0452893 [Java][Native] Drain InputStream when no response is being read (#10956)
The [docs for ofInputStream](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.BodySubscribers.html#ofInputStream()) say:

> To ensure that all resources associated with the corresponding exchange are properly released the caller must ensure to either read all lines until the stream is exhausted, or call BaseStream.close() if it is unable or unwilling to do so. Calling close before exhausting the stream may cause the underlying HTTP connection to be closed and prevent it from being reused for subsequent operations.

When ObjectMapper.readValue is called with an InputStream it implicitly closes it, but when the library is not expecting a return type it's not passing the InputStream to Jackson, so the stream needs to be manually drained and closed as per the docs

Failure to do this leads to a leak of HttpClient socket handles, and ultimately the exception `java.net.BindException: Cannot assign requested address` when trying to make API calls
2021-11-25 14:44:57 +08:00
AJ Rice
08eaafa871 Add operation level servers support for java okhttp-gson client (#10925)
* Add Operation Servers to {operation}Call method

* add getter/setter methods

Add methods for hostIndex and customBaseUrl

* Fix return types for getters

* Add custom baseUrl logic

if you dont specifically declare a custom base url using the set method then it uses the 1st server in the operation host index array

if no custom url is set and the operation base path array is empty however, the call throws an exception

* Update server selection logic

First checks to see if a custom url is provided

If not, checks to see if operation level server is defined and uses the supplied host index (default 0)

If neither is supplied, uses the ApiClient default base path

* Update samples and docs
2021-11-25 14:17:50 +08:00
William Cheng
1953e70661 [C#][netcore] minor code improvement (#10951)
* minor code improvement

* better code format
2021-11-25 13:28:33 +08:00
Brian J. Miller
2e47f3e84c Allows install typescript-axios client via npm from Git (#10890) 2021-11-24 06:48:21 -08:00
dever4eg
1314e229f5 Fixed http errors deserialization (#10940)
* Fixed http errors deserialization

I've found this bug in @kubernetes/client-node npm package.

By the way, Here is the issue https://github.com/OpenAPITools/openapi-generator/issues/2924#

* Update typescript-node samples with a fix of error handling

* Update samples version

Co-authored-by: Bogdan Onischenko <bogdan.onischenko@nixsolutions.com>
2021-11-24 06:46:41 -08:00
WILLIAM CHENG
887fe07bc1 upadte samples 2021-11-24 17:47:31 +08:00
Hui Yu
375f0a5c2d [C][Client] Use cpack to build deb package (#10935) 2021-11-24 17:42:04 +08:00
WILLIAM CHENG
962e8c4217 update samples 2021-11-24 17:24:19 +08:00
Sheldon Young
d01ad0524c [rust] Update to modern hyper and futures crates (#9919)
* [rust] Update to modern hyper and futures crates

* [rust] Update to modern hyper and futures crates
2021-11-24 17:20:44 +08:00
William Cheng
af0babf892 [C#][netcore] various improvements in HttpSigningConfiguration.cs (#10941)
* various improvements in HttpSigningConfiguration.cs

* update returns in xml comments
2021-11-24 16:14:29 +08:00
Tomasz Prus
ca848871da [Python] Add missing Mock library for Python 2.7. (#10939)
* [Python] Add missing Mock library for Python 2.7.

* Update template for test-requirements.txt.
2021-11-24 15:54:25 +08:00
dependabot[bot]
e2ca42a614 Bump actions/cache from 2.1.6 to 2.1.7 (#10945)
Bumps [actions/cache](https://github.com/actions/cache) from 2.1.6 to 2.1.7.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2.1.6...v2.1.7)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-24 15:35:54 +08:00
Fumito Nakazawa
64a478a93c [swift5] Remove optional from body (#10938)
* Unwrap body

* Remove unsupported type from nonDecodableBuilder

* Update samples

* Remove !

* Fix typo
2021-11-23 21:18:56 +08:00
Fumito Nakazawa
faae00df91 [swift5] Refactor some codes (#10937)
* Use compactMap

* Remove as Any cast

* Remove array

* Update samples
2021-11-23 21:18:42 +08:00
Tal Kirshboim
3a12b6144f Fix enum generation (#10923) 2021-11-23 21:04:43 +08:00
cyangle
8338962deb [crystal] Add annotation to reserved key word list of crystal lang (#10932)
* add annotation to reserved key word list of crystal

* Update crystal docs
2021-11-23 21:02:49 +08:00
Tal Kirshboim
39b8f83e6d Add Airthings to list of generator users (#10936) 2021-11-23 21:01:17 +08:00
Tomáš Čermák
e5159ef8d5 [Protobuf-Schema] Add numbered field number list switch (#10893)
* [Protobuf-Schema] Add numbered field number list switch

* [Protobuf-Schema] Add numbered field number list switch

* [Protobuf-Schema] Added switch

* [Docs][Protobuf-Schema] Generated docs

Co-authored-by: Tomáš Čermák <cermak@merica.cz>
2021-11-23 10:43:34 +08:00
Jens L
49e9911b3f [typescript-fetch] fix circular imports being generated (#10798)
templates based off of #6140 and @ajaska

closes #6140
2021-11-22 13:17:15 -08:00
Tomasz Prus
e9f2ccde67 [Python] Add option to select content-type using body or force it for… (#10686)
* [Python] Add option to select content-type using body or force it for API call

* Add support for application/json-patch+json

* Add unittests.
2021-11-22 08:41:04 -08:00
Tomáš Čermák
c13067d100 [Protobuf-Schema] Add unknown to enum switch (#10892)
* [Protobuf-Schema] Add unknown to enum switch

* [Protobuf-Schema] Bugfix: unique unknown by prefix

* [Protobuf-Schema] Add unknown to enum switch

* [Protobuf-Schema] Bugfix: unique unknown by prefix

* [Protobuf-Schema] Bugfix after merge, format file

* [Docs][Protobuf-Schema] Generated docs

Co-authored-by: Tomáš Čermák <cermak@merica.cz>
2021-11-22 21:57:33 +08:00
Felix Winterhalter
c7bd3aa294 fix: Support Netcore 6.0 (#10634) 2021-11-22 16:56:57 +08:00
Tomáš Čermák
fdea71b26e [Protobuf-Schema] Add enum as model support (#10868)
* [Protobuf-Schema] Add enum as model support

* [Protobuf-Schema] Bugfix: Reverted classname modification

* [Protobuf-Scheme] Mustache newlines update

* [Protobuf-Schema] Renamed addModelEnumIndexes to addEnumIndexes

* [Protobuf-Schema] Add enum as model support

* [Protobuf-Schema] Bugfix: Reverted classname modification

* [Protobuf-Scheme] Mustache newlines update

* [Protobuf-Schema] Renamed addModelEnumIndexes to addEnumIndexes

Co-authored-by: Tomáš Čermák <cermak@merica.cz>
2021-11-22 16:29:09 +08:00
Ian Cubbon
6779c33b9d [GO][Client] Multipart/form-data Request Support More Than One File (#10843)
* Instead of limiting a request to a single file when
performing an upload, use a slice of files so an
arbitrary number of files can be used in the form.

* Remove commented out line of code

* Update examples for multi-form file fix for multiple files

* Convert spaces to tabs for indentation

* Updated examples to have tabs instead of spaces

* Add an example of a multipart/form-data OA3 schema
that contains two files to be uploaded
2021-11-22 16:27:43 +08:00
William Cheng
c244c23053 better null comparison (#10915) 2021-11-21 23:03:25 +08:00
William Cheng
37a4429024 various enhancements to PSRSAEncryptionProvider (#10914) 2021-11-21 14:28:37 +08:00
Hong Zhuang
606db36c77 Better handling of NPE in parser when referencing invalid schema (#10882)
* try to catch NullPointerException and print error message

* handles invalid specifications when the spec file is invalid

* added comment

* added null pointer exception test
2021-11-21 09:31:11 +08:00
William Cheng
c69bff2871 update meta codegen junit to latest version (#10911) 2021-11-21 09:04:57 +08:00
S2021Git
6848c229f7 [JAVA]Add additional check for openapiDocketConfig in SpringCodegan.java (#10853)
* updated SpringCodegan

* added test case for SpringCodegen change

* update samples

* updated test Javadoc
2021-11-21 01:35:32 +08:00
Kevin Chen
637fa430d5 [kotlin-spring] add comment to api method (#10857)
* fix: add api comment

* update sample

* update sample
2021-11-21 01:25:45 +08:00
dependabot[bot]
18d8843cf9 Bump dns-packet from 1.3.1 to 1.3.4 in /website (#10908)
Bumps [dns-packet](https://github.com/mafintosh/dns-packet) from 1.3.1 to 1.3.4.
- [Release notes](https://github.com/mafintosh/dns-packet/releases)
- [Changelog](https://github.com/mafintosh/dns-packet/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mafintosh/dns-packet/compare/v1.3.1...v1.3.4)

---
updated-dependencies:
- dependency-name: dns-packet
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-21 01:15:29 +08:00
dependabot[bot]
6702785cae Bump ssri from 6.0.1 to 6.0.2 in /website (#10909)
Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/npm/ssri/releases)
- [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
- [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2)

---
updated-dependencies:
- dependency-name: ssri
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-21 01:03:17 +08:00
Tal Kirshboim
eeb00e27d1 [Kotlin][Multiplatform] Fix Kotlin Multiplatform Test (#10900)
* Fix Kotlin Multiplatform Test

- Remove obsolete 'GRADLE_METADATA' Gradle preview flag from
Kotlin Multiplatform settings.gradle template file.
- Update Kotlin Version to 1.5.31
- Update coroutines, serialization and Ktor versions to the versions
recommended for usage with Kotlin 1.5.31
see https://kotlinlang.org/docs/releases.html#release-details .

Fixes https://github.com/OpenAPITools/openapi-generator/issues/10898

* Add 'clean' task to pom.mustache and reformat sample pom.xml

* Use stable 1.3.0 version of Kotlin serialization
2021-11-20 09:30:26 +08:00
David Horvath
126e406193 [swift5] Cancellable requests (#10855)
* Implement cancellation of URLSession requests for Combine & RxSwift

resolve #8658

* Add generated sample code

* Add request cancellation for alamofire library and Result configuration

* Add generated sample code

* Add request cancellation for async await configuration

* Add generated sample code
2021-11-18 21:05:18 +08:00
William Cheng
e44c69dab1 fix outdated link, improve docstring (#10870) 2021-11-17 11:17:48 +08:00
WILLIAM CHENG
fcb28453e3 update samples 2021-11-16 22:42:47 +08:00
Simon Wegendt
af2ca38ab7 [Kotlin] [OkHttp4] detailed requests (#10201)
* #10199: Extract from generated function per operation one that returns headers and other info

* add autogenerated output

* fix suspend generation

* fix return statement generation for coroutine variant
2021-11-16 22:34:26 +08:00
WILLIAM CHENG
3c503dae2a comment out cpp qt5 tests 2021-11-15 18:13:26 +08:00
William Cheng
3c26f9f2b4 [Okhttp] fix warnings and better docstrings for constructors (#10859)
* surpress serial warning

* better docstrings in api client java class
2021-11-15 17:49:27 +08:00
William Cheng
c06a21e638 update authentication to include more parameters (#10858) 2021-11-15 16:34:27 +08:00
basyskom-dege
f596b32316 [Qt][C++] Oauth2 Authorization Code Flow and Implicit Flow Support. (#10183)
* Oauth class with reply server for authorization flow

* multiple scopes. Joined with space seperator

* some refactoring, using urls from the spec

* added implicit flow. Refactored oauth classes.

* added missing {{prefix}} to Oauth class

* added client credentials flow

* added password flow. setVariables for each class

* Refactored variables to fit style. Updated Samples
2021-11-14 23:16:29 +08:00
Oleh Kurpiak
e7c3bdacc2 [Java] fix deserialization of readonly properties (#10113)
* [Java] fix deserialization of readonly properties

* [Java] fix deserialization of readonly properties

* [Java] fix deserialization of readonly properties

* [Java] fix deserialization of readonly properties
2021-11-14 22:05:25 +08:00
Oleh Kurpiak
3bdbf0339a [Java] deserialize to LinkedHashSet when unique items (#10241)
* [Java] deserialize to LinkedHashSet when unique items

* [Java] fix deserialization of readonly properties

* [Java] deserialize to LinkedHashSet when unique items
2021-11-14 22:03:02 +08:00
Andrew
d91ff3a150 [GO] dont canonize headers (#10779)
* [GO]: dont canonize headers

* [GO]: update unit tests
2021-11-14 10:36:49 +08:00
David Horvath
552a31d85c [swift5] Reuse URLSessions (#10790)
* Reuse URLSession with same configuration

resolve #8562

* Add typealias for taskDidReceiveChallenge closure type

* Add generated sample code
2021-11-14 10:33:18 +08:00
agilob
65f3845c17 Use parallel classes test over reusing forks (#10824) 2021-11-14 10:17:03 +08:00
sheabot
f2fcff2945 [cpp-pistache-server]: Fix build with pistache master branch (#10829)
* fix(cpp-pistache-server): meson/cmake build

* fix(cpp-pistache-server): Upgrade to C++17 and use std::optional

* feat(cpp-pistache-server): Disable running tests during build of nlohmann/json

* feat(samples): Update server/petstore/cpp-pistache
2021-11-14 10:15:42 +08:00
WILLIAM CHENG
70737fb1e6 update rust samples 2021-11-11 14:30:32 +08:00
Foorack / Max Faxälv
30e1ba7c87 fix(rust, client): fix breaking regression introduced by #10432 (#10720)
* Fix breaking regression introduced by #10432

This change forgot enum structures, which causes the compiler to throw errors for "the trait `Default` is not implemented for MyEnum".
This change implements the Default trait to the enum template.

* fix: add Default for type enums
2021-11-11 14:26:21 +08:00
WILLIAM CHENG
c9495dc251 update samples 2021-11-11 13:44:15 +08:00
malesh
b0b09b030f Fix #10802 csharp client multifile compile error (#10803)
* [csharp] add multifile upload sample

* [csharp] fix #10802: compile error with multi-file upload
2021-11-11 13:33:35 +08:00
yongmingl
b0fc824d43 Add Qavar to the user list (#10835) 2021-11-11 13:15:30 +08:00
Jan Ruhländer
ee011c563e fix typo (--supporting-files > --feature-set) (#10801) 2021-11-09 14:48:18 +08:00
Kevin Chen
7d092e76a1 [Bash] Support post form data (#10795)
* curl with form data

* fix type

* update bash readme

* typo

* update sample

* add test for form data

* update
2021-11-09 14:43:48 +08:00
Vincent Galloy
955aadc284 10788: ApiClient for resttemplate should not produce warning (#10789)
Motivation:

Remove useless warnings for webclient and resttemplate
2021-11-09 14:38:57 +08:00
agilob
4d947a1c45 Non functional Java styling changes (#10808)
* Replace explicit <Type> with <>

* Remove redundant toString() calls on String

* Use StandardCharsets.UTF_8 instead "UTF-8" string

* Simpler annotation format and redundant this

* Dont concat on empty String, use String.valueOf()

* Dont run equals on empty String

* Use string.anyMatch instead counting

* Collection add all instead iterating and adding

* Replace string contact with append chain in stringBuilders
2021-11-09 14:36:01 +08:00
agilob
53d3c9fc70 Fix tpyo prefered -> preferred (#10807) 2021-11-09 14:31:01 +08:00
Code1x1
0bb4f186ec #10056 Fix relative url as basePath (#10057)
* #10056 Fix relative url as basePath

* Add tests handle relative urls in servers

* PR Task:
* replace tabs with spaces
* can `servers` be null or empty?

* PR Task: fix empty line tab

* Update DefaultGenerator.java

Fix lines change tabs to spaces

* Fix tabs spaces

Co-authored-by: Denis Behrends <d.behrends@hosting.de>
2021-11-06 18:27:26 +01:00
William Cheng
3284fc2f7e skip spotless as part of the check task (#10797) 2021-11-06 18:50:38 +08:00
William Cheng
bd1a6471b6 [java][Jersey2] add spotless maven, gradle plugins (#10796)
* add bunker-holding logo

* add spotless plugin to jersey2 java client

* add spotless plugin to java jersey2 client

* use jdk11 in gradle tests

* fix gradle test local spec

* setup java 11

* skip spotless in check task
2021-11-06 18:11:58 +08:00
BunkerTsto
84c2b04f24 Added Bunker Holding Group to companies list (#10794) 2021-11-06 09:49:42 +08:00
William Cheng
a73363fd53 [java][okhttp] Add spotless maven, gradle plugin (#10785)
* add spotless maven plugin

* add spotless gradle plug-in

* add spotless version
2021-11-05 17:48:14 +08:00
Hui Yu
369133a03e [C][Client] Define and initialize non-primitive variables at the beginning of function (#10756) 2021-11-05 10:51:57 +08:00
Johannes Becker
40018c333d Fixed broken form params in typescript-angular client (#10776) (#10777)
* Fixed broken form params in typescript-angular client (#10776)

* Added regenerated samples.
2021-11-04 11:31:46 +01:00
Anders Aaen Springborg
c741b10fb7 cpp-tiny 3.0 (#10739)
* int get generated as long

* test revised

* moved network logic to abstract service

* New service hooks in services

* bourne version

* remove comment from cert

* sendRequest remove direct link to http request

* Network logic into AbstractService

* Rename AbstractService to Service

* add query params

* Remove unused comment

* Change files in openapi

* amazon root CA 1 default ssl certificate

* rename service

* duplicate line

* Set todo

* lint whitespace fix

* uncomment array querey paramns

* Form params in service body

* this is nice

* added form params

* remove random mustache variable

* change form map to list, as it would overwrite if there was duplicates

* maven build and doc gen
2021-11-04 10:24:13 +08:00
William Cheng
a7242cc8d0 Update restsharp to the latest stable version (#10762)
* update restsharp to newer version

* undo change
2021-11-04 10:20:53 +08:00
William Cheng
4ecceb13ea [Java][okhttp] remove default content-type in the request (#10769)
* remove default content-type in java okhttp client

* update smaples

* update tests
2021-11-04 10:19:13 +08:00
William Cheng
b3ec7faa8f Update Maven to 3.8.3 in Appveyor CI (#10771)
* update mavne to 3.8.3 to fix appveyor build failure

* update folder name
2021-11-03 23:48:18 +08:00
William Cheng
9d1420dc94 fix bug in query collection parameters (#10768) 2021-11-03 22:13:33 +08:00
topce
edb88d9193 Delete body angular (#10751)
* change isBodyAllowed to return true
for delete method
Add method
isMethodPutOrPatchOrPost

* change templates to use isMethodPutOrPatchOrPost
to be compatible with previous versions,
lubrary mainterners should decide
if want to use isBodyAllowed

* since angular 12.1 delete with body is supported
Change angular typescript to support delete with body if
angular version is >= 12.1
update default  ngVersion to be latest
12.2.12

* generate samples and docs

* ApiClient was OK
revert my changes
2021-11-03 10:46:30 +08:00
Ken Kaizu
359e39360a [scala-akka-http-server] Fix array optional parameter invalid default value (#10676) 2021-11-03 10:41:30 +08:00
Thibault Duperron
c4d10d55cb Add validation to headers (#10703) 2021-11-03 10:06:56 +08:00
Thibault Duperron
68abbb34b1 [Kotlin][Spring] Fix required parameter in tests (#10705)
Should fix #10704
2021-11-03 10:05:52 +08:00
Mike Welsh
b117d29729 Allow Spring generated code to use new OAS 3 annotations (#9775)
* Resolve #9774

- Add in `oas3` option for Spring codegen to use newer annotations
- Add `useSpringController` option for Spring codegen
- Use `useSpringfox` to fix some unwanted imports for Spring codegen
- Use `jdk8` to add OffsetDateTime import for models in Spring codegen
- Add `JsonValue` to `enumOuterClass.mustache` to allow enums to be
  generated properly

* Update spring examples

* Update with a clean maven install and regenerate samples

* Remove newling at end of param files and regenerate samples

* Update codegen with merge from master

* Update tests and samples

* Remove #vendorParams from API

* Update generated and tests

* Get closer to master

* Remove SpringFox setter boolean

- Annotation was altered to be fully qualified, doesn't need import
  removed anymore

* Update examples and tests

* FIx pojo.mustache (missed update to master) and regenerate tests

* Fix pojo.mustache extra `(`

* Update tests and documentation

* Update models and documentation

* Handle boolean property correctly

- Use `convertPropertyToBoolean` and `writePropertyBack`

* Fix more @ApiParam usage with @Parameter

- Also replace allowableValues with @Scheme(allowableValues =
`

* Update samples

* Update maven `pom.xml` mustache to use OAS3 annotations

* FIx typo in variable name

* Write back `useSpringfox` property
2021-11-03 00:44:54 +08:00
Strixpyrr
60bc508163 Generate ApiKeyAuth with an apiKey security scheme (#10708) 2021-11-03 00:00:48 +08:00
Bruno Coelho
57afa97166 [kotlin][client] add base url key (#10633)
* [kotlin][client] add base url key

* [kotlin][client] update sample projects

* [kotlin][client] add base url key
2021-11-02 23:32:42 +08:00
William Cheng
df260acc8f [C#] Update C# dependencies to newer version (#10761)
* update csharp-netcore dependencies

* restore Compare-Net-Objects
2021-11-02 23:21:11 +08:00
William Cheng
0de0890546 fix nuspec in csharp-netcore template (#10759) 2021-11-02 23:11:49 +08:00
WILLIAM CHENG
a6ba553281 update groovy templates 2021-11-02 23:10:33 +08:00
William Cheng
4695279a07 fix build-info-extractor-gradle in groovy build.gradle (#10760) 2021-11-02 18:03:01 +08:00
William Cheng
6cb4b1f6c4 update dependenies version to fix errors (#10757) 2021-11-02 12:39:28 +08:00
Hui Yu
fe90d9c426 [Core] Does not recognize the type "ByteArray" as "String" (#10749)
* Does not recognize the type "ByteArray" as "String"

* Change in default codegen

* Removes redundant updateRequestBodyForString

* Adds testByteArrayTypeInSchemas

Co-authored-by: Justin Black <justin.a.black@gmail.com>
2021-11-01 12:18:21 -07:00
Justin Black
7559b53370 Feat adds python AnyOf send and receive example (#10754)
* Samples regenerated

* Adds AnyOf tx/rx example to python

* Updates samples
2021-11-01 12:15:45 -07:00
William Cheng
666382b377 Disable groovy client tests (#10748)
* disable groovy test

* use spaces instead of tabs
2021-11-01 10:53:58 +08:00
William Cheng
9546a5a61b [Java][okhttp] better docstring (#10741)
* better docstring in api client, exception, response

* more docstring update
2021-11-01 00:47:32 +08:00
William Cheng
68b5f866ff update readme with better gradle instruction (#10740) 2021-10-31 23:10:46 +08:00
William Cheng
8551b0af49 [java][jersey2] remove warning using JsonMapper.builder (#10734)
* remove warning usign JsonMapper.builder

* add back java8 tag
2021-10-30 16:55:33 +08:00
William Cheng
c3740dd647 update scribejava to 8.x (#10733) 2021-10-30 14:42:48 +08:00
William Cheng
4e21b61800 [powershell] add file upload support (#10735)
* add file upload support

* comment out c# tests

* Revert "comment out c# tests"

This reverts commit 8f500908fb.
2021-10-30 14:42:11 +08:00
Sylhare
912d993955 Add openapi-generator kotlin article (#10731) 2021-10-29 23:08:14 +08:00
Andreas Metsälä
d130985f85 [ts-angular]: add ts-ignore directives to avoid compilation errors (#10713)
The unused imports don't pass stricter TS compiler settings.
2021-10-29 16:05:23 +02:00
William Cheng
4cece10bae rebalance circleci tests (#10727) 2021-10-29 13:38:16 +08:00
William Cheng
2b2838325c [java][okhttp-gson] update dependencies in pom.xml (#10709)
* update okhttp-gson pom dependencies

* update samples

* remove jar
2021-10-29 12:36:52 +08:00
William Cheng
d75683aeae [java][jersey2] update plugins in pom.xml (#10710)
* update jersey2 plugin

* remove jar
2021-10-29 12:36:40 +08:00
Martin Visser
59d5851797 Fix library generation compatibility with Gradle 7.2 (#10716)
* Make Java libraries compatible with Gradle 7

* Make kotlin-spring compatible with Gradle 7

* Update samples to comply to Gradle 7.2

* Generate samples
2021-10-29 12:36:12 +08:00
martinsaison
a33a0fd5c7 [kotlin-spring] change the suffix from ".kt" to "Controller.kt" when generating a controller class (#10671)
* fix: [kotlin-spring] wrong filenames for generated controller classes (#10670)

* fix: [kotlin-spring] wrong filenames for generated controller classes (#10670)

Updated unit test with correct filenames

* fix: [kotlin-spring] wrong filenames for generated controller classes (#10670)

Including files generated by generate-samples.sh and export_docs_generators.sh

Co-authored-by: Martin Saison <khodev@users.noreply.github.com>
2021-10-29 10:06:37 +08:00
Sergii Baitala
bf77570934 [cpprestsdk] CMake build system improvements (#10660)
* cmake install support

* fix option overriding issue

* fix alignment
2021-10-29 09:58:29 +08:00
Justin Black
d1b61bdc04 adds get/setHasMultipleTypes to Java schema classes (#10715)
* Adds getter and setter for hasMultipleTypes and implements it in CodegenModel

* Adds getter and setter to CodegenProperty

* Updates CodegenParameter

* Updates CodegenResponse

* Samples regenerated
2021-10-27 14:16:53 -07:00
William Cheng
1c38bfd5a0 update microprofile to newer version (#10714) 2021-10-27 23:42:46 +08:00
bflamand
27c82e8ed2 Typescript saga immutablejs enhancements and small fixes (#10444)
* first commit: add cli option for saga and records. Added dummy sagas.mustache test file.

* More progress with default values. First prototype for isEntity and isUniqueId.

* record generation complete

* record generation complete

* progress with saga generation

* progress with saga generation

* first fully working saga generation

* merge with latest master

* removed unneeded "items" properties.

* moved global CodegenModel modifications into subclass ExtendedCodegenModel used exclusively by TypescriptFetchClient. Adding missing samples files.

* moved global CodegenOperation modifications into subclass ExtendedCodegenOperation used exclusively by TypescriptFetchClient.

* moved global CodegenProperty modifications into subclass ExtendedCodegenProperty used exclusively by TypescriptFetchClient.

* moved global CodegenParameter modifications into subclass ExtendedCodegenParameter used exclusively by TypescriptFetchClient.

* added the missing "allSagas" export.

* renamed & reworked "meta data response" flags to a more useful general concept of "operation return passthrough"

* added vendor flag keepAsJSObject as escape hatch to support circular dependencies in models and other special cases. Also fixed issues with default values for some records properties.

* added autodetection for passthrough to simplify standardised specs.

* fix small issue with passthrough void

* fix small issues with passthrough void and missing passthrough imports in some cases. Fix issues with enum default values.

* fix small issues with passthrough void and missing passthrough imports in some cases. Fix issues with enum default values.

* Added "reservedRecordField" feature to support remapping fields names that cannot be used in Records. Added missing export to record: toApi().

* added uniqueId inference. Fix small generation when uniqueId property is an array.

* removed feature "reservedRecordField" and replaced it with existing built-in "reserved words" feature. Fix minor issues with typings in generated files.

* Changed api recType names to make them less likely to cause name conflicts. Added generated ApiEntities (record, reducer & selector) files.

* Moved location of ApiEntities related files and fix issues with exports.

* - merge latest master
- renamed fake test apis to better fit the "pet theme"
- added mode for "SourceOnlyLibrary" (same as used in codegen typescript jquery)

* - missing ganarate sampless

* - Modified way to export apiEntitiesSelectpr to reduce typescript analysis time for consuming project. Removed tab characters in mustache files. Reformat code for TypeScriptFetchClientCodegen to try to remove false positive for tabs vs spaces.

* - added markErrorsAsHandled property to api sagas. Increased typescript version to address some typing errors on library build.

* - fix bug in saga interfaces. Upgraded to typescript "strict" mode to ensure proper typechecking info is generated.

* - added optional id for apiEntity selectors. Added toInlined() support to convert an entity to an inlined model recursively.

* - minor tweak for apiEntitySelector to accept null id

* - minor tweak for apiEntitySelector

* - runned ensure up to date.

* Revert "- runned ensure up to date."

This reverts commit ea9b4aed

* - runned ensure up to date.

* - runned ensure up to date.

* - added more enhancements: New "toInlined" functionality. Support for more complex double array types. apiBaseConfiguration is not sent completely for Api.init().

* - merge master

* - fix generated api bug in some cases for typescript fetch when no request params are present.

* - commented broken tests

* - fix generate samples analysis.

* update surefire to newer version

* - un-commenting test files with issues.

* factored similar utility functions in ExtendedCodegenProperty and ExtendedCodegenParameter.

Co-authored-by: Bruno Flamand <bflamand@stingray.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
2021-10-27 16:35:02 +02:00
William Cheng
5e857e749d add an option for configKey (#10707) 2021-10-27 15:07:41 +08:00
Maximilian Zellhofer
6bbafdfa30 Allow specification of configkey for microprofile clients (#10693) 2021-10-27 14:28:17 +08:00
cyangle
ae39d782e0 Update crystal client gitignore.mustache with shards related files (#10698) 2021-10-27 14:23:55 +08:00
Justin Black
3a667784ac Adds ComposedSchema to store schema composed schemas (#10653)
* Adds ComposedSchema and the ability to set it in CodegenModel and CodegenProperty

* Adds ComposedSchemas class and adds getters and setters for it in schema implementors

* Adds and uses getComposedSchemas

* Makes method private

* Uses setComposedSchemas for CodegenParameter and CodegenResponse

* Samples regeneratoed, tweaked string representation

* Removes null default

* Removes anyOfProps, oneOfProps, allOfProps

* Removes unneeded line
2021-10-26 12:49:32 -07:00
Justin Black
8d490835b7 Adds setPrettyPrint and the reslver MethodValueResolver.INSTANCE (#10683) 2021-10-26 09:45:21 -07:00
Peter Leibiger
f1ab3edbc0 [dart] Fix pub server URL (#10695)
* replace private pub server with official pub server URL
2021-10-27 00:33:58 +08:00
cyangle
01a4569995 Remove .rspec and .rubycop.yml from crystal client (#10701) 2021-10-27 00:21:19 +08:00
rudolficzek
d1089d785c fix import mappings for service in angular typescript (#10644)
* fix import mappings for service in angular typescript

* add unit test

* regenerated samples
2021-10-26 13:49:18 +02:00
itaru2622
97e079fde0 add no_proxy support to python client (#10648)
* add no_proxy support to python client

* add unittest for no_proxy supporting, python client

* update samples for no_proxy supporting, python client

* fix input parameter in samples/openapi3/.../tests_manual/test_extra_pool_config_options.py

* re-implement no_proxy support to python client according to PR conversation #10648

* re-update samples for no_proxy supporting, python client
2021-10-26 10:12:42 +02:00
William Cheng
378465702c Prepare v5.3.1 in the master (#10681)
* prepare v5.3.1

* update doc

* update readme
2021-10-25 01:16:07 +08:00
6018 changed files with 182912 additions and 45299 deletions

View File

@@ -42,24 +42,6 @@ jobs:
command: |-
printf '127.0.0.1 petstore.swagger.io
' | sudo tee -a /etc/hosts
# Dependencies
# Install latest stable node for angular 6
- run:
name: Install node@stable (for angular 6)
command: |
set +e
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
export NVM_DIR="/opt/circleci/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
#nvm install stable
# install v16 instead of the latest stable version
nvm install 16
nvm alias default 16
# Each step uses the same `$BASH_ENV`, so need to modify it
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
- run: node --version
# - run: docker pull openapitools/openapi-petstore
# - run: docker run -d -e OPENAPI_BASE_PATH=/v3 -e DISABLE_API_KEY=1 -e DISABLE_OAUTH=1 -p 80:8080 openapitools/openapi-petstore
- run: docker pull swaggerapi/petstore

View File

@@ -26,17 +26,17 @@ jobs:
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
with:
distribution: 'adopt'
distribution: 'temurin'
java-version: ${{ matrix.java }}
- uses: actions/cache@v2.1.6
- uses: actions/cache@v2.1.7
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', 'modules/**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/cache@v2.1.6
- uses: actions/cache@v2.1.7
with:
path: |
~/.gradle/caches

View File

@@ -21,7 +21,7 @@ jobs:
build:
name: Gradle tests
runs-on: ubuntu-latest
container: gradle:jdk8
container: gradle:jdk11
strategy:
fail-fast: true
matrix:
@@ -36,18 +36,18 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 8
distribution: 'temurin'
java-version: 11
# Cache Gradle Dependencies
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v2
uses: actions/cache@v2.1.7
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }}
# Cache Gradle Wrapper
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v2
uses: actions/cache@v2.1.7
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}

View File

@@ -17,11 +17,12 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'temurin'
- name: Cache maven dependencies
uses: actions/cache@v2.1.6
uses: actions/cache@v2.1.7
env:
cache-name: cache-maven-repository
with:
@@ -52,11 +53,12 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'temurin'
- name: Cache maven dependencies
uses: actions/cache@v2.1.6
uses: actions/cache@v2.1.7
env:
cache-name: cache-maven-repository
with:
@@ -86,9 +88,10 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'temurin'
- name: Download openapi-generator-cli.jar artifact
uses: actions/download-artifact@v2.0.10
with:
@@ -124,9 +127,10 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'temurin'
- name: Download openapi-generator-cli.jar artifact
uses: actions/download-artifact@v2.0.10
with:
@@ -158,11 +162,12 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'temurin'
- name: Cache maven dependencies
uses: actions/cache@v2.1.6
uses: actions/cache@v2.1.7
env:
cache-name: cache-maven-repository
with:
@@ -190,11 +195,12 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'temurin'
- name: Cache maven dependencies
uses: actions/cache@v2.1.6
uses: actions/cache@v2.1.7
env:
cache-name: cache-maven-repository
with:

View File

@@ -20,10 +20,10 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
distribution: 'temurin'
java-version: 8
- name: Cache maven dependencies
uses: actions/cache@v2.1.6
uses: actions/cache@v2.1.7
env:
cache-name: maven-repository
with:
@@ -32,7 +32,7 @@ jobs:
~/.gradle
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Cache test dependencies
uses: actions/cache@v2.1.6
uses: actions/cache@v2.1.7
env:
cache-name: pub-cache
with:
@@ -53,10 +53,10 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
distribution: 'temurin'
java-version: 8
- name: Cache maven dependencies
uses: actions/cache@v2.1.6
uses: actions/cache@v2.1.7
env:
cache-name: maven-repository
with:
@@ -65,7 +65,7 @@ jobs:
~/.gradle
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Cache test dependencies
uses: actions/cache@v2.1.6
uses: actions/cache@v2.1.7
env:
cache-name: pub-cache
with:

View File

@@ -30,8 +30,7 @@ jobs:
#- samples/client/petstore/kotlin-json-request-string
- samples/client/petstore/kotlin-jvm-okhttp4-coroutines
- samples/client/petstore/kotlin-moshi-codegen
# need some special setup
#- samples/client/petstore/kotlin-multiplatform
- samples/client/petstore/kotlin-multiplatform
- samples/client/petstore/kotlin-nonpublic
- samples/client/petstore/kotlin-nullable
- samples/client/petstore/kotlin-okhttp3
@@ -45,10 +44,10 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
distribution: 'temurin'
java-version: 8
- name: Cache maven dependencies
uses: actions/cache@v2.1.6
uses: actions/cache@v2.1.7
env:
cache-name: maven-repository
with:

View File

@@ -16,7 +16,7 @@ jobs:
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'adopt'
distribution: 'temurin'
java-version: 11
- name: Compile with Maven
run: mvn -B -q clean install jacoco:report

View File

@@ -40,6 +40,13 @@ elif [ "$NODE_INDEX" = "2" ]; then
sudo apt-get -y build-dep libcurl4-gnutls-dev
sudo apt-get -y install libcurl4-gnutls-dev
# 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
# run integration tests
mvn --no-snapshot-updates --quiet verify -Psamples.misc -Dorg.slf4j.simpleLogger.defaultLogLevel=error
elif [ "$NODE_INDEX" = "3" ]; then
@@ -55,6 +62,21 @@ elif [ "$NODE_INDEX" = "3" ]; then
pyenv global 3.6.3
python3 --version
# Install node@stable (for angular 6)
set +e
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
export NVM_DIR="/opt/circleci/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
#nvm install stable
# install v16 instead of the latest stable version
nvm install 16
nvm alias default 16
node --version
# Each step uses the same `$BASH_ENV`, so need to modify it
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
mvn --no-snapshot-updates --quiet verify -Psamples.circleci.node3 -Dorg.slf4j.simpleLogger.defaultLogLevel=error
else
@@ -62,13 +84,6 @@ else
#sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
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.others -Dorg.slf4j.simpleLogger.defaultLogLevel=error
mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
fi

View File

@@ -9,7 +9,7 @@
<div align="center">
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.3.0`):
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.3.1`):
[![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.com/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)
@@ -17,6 +17,13 @@
[![Bitrise](https://img.shields.io/bitrise/4a2b10a819d12b67/master?label=bitrise%3A%20Swift+4,5&token=859FMDR8QHwabCzwvZK6vQ)](https://app.bitrise.io/app/4a2b10a819d12b67)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/openapitools/openapi-generator/Check%20Supported%20Java%20Versions/master?label=Check%20Supported%20Java%20Versions&logo=github&logoColor=green)](https://github.com/OpenAPITools/openapi-generator/actions?query=workflow%3A%22Check+Supported+Java+Versions%22)
[5.4.x](https://github.com/OpenAPITools/openapi-generator/tree/5.4.x) (`5.4.x`):
[![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/5.4.x.svg?label=Integration%20Test)](https://travis-ci.com/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator/tree/5.4.x.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=5.4.x&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)
[![JDK11 Build](https://cloud.drone.io/api/badges/OpenAPITools/openapi-generator/status.svg?ref=refs/heads/5.4.x)](https://cloud.drone.io/OpenAPITools/openapi-generator)
[![Bitrise](https://img.shields.io/bitrise/4a2b10a819d12b67/5.4.x?label=bitrise%3A%20Swift+4,5&token=859FMDR8QHwabCzwvZK6vQ)](https://app.bitrise.io/app/4a2b10a819d12b67)
[6.0.x](https://github.com/OpenAPITools/openapi-generator/tree/6.0.x) (`6.0.x`):
[![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/6.0.x.svg?label=Integration%20Test)](https://travis-ci.com/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator/tree/6.0.x.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
@@ -69,7 +76,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
| | Languages/Frameworks |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.0, .NET Core 2.0, .NET 5.0. Libraries: RestSharp, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient, Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client), **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 11.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs) |
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) |
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx, Azure Functions), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) |
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Protocol Buffer**, **WSDL** |
@@ -110,9 +117,10 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
| OpenAPI Generator Version | Release Date | Notes |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- |
| 6.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/6.0.0-SNAPSHOT/) | Nov/Dec 2021 | Minor release with breaking changes (no fallback) |
| 5.3.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.3.0-SNAPSHOT/) | Sep/Oct 2021 | Minor release with breaking changes (with fallback) |
| [5.2.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.2.1) (latest stable release) | 016.08.2021 | Patch release (enhancements, bug fixes, etc) |
| 6.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/6.0.0-SNAPSHOT/) | Jan/Feb 2022 | Minor release with breaking changes (no fallback) |
| 5.4.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.4.0-SNAPSHOT/) | Dec 2021 | Minor release with breaking changes (with fallback) |
| 5.3.1 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.3.1-SNAPSHOT/) | Nov/Dec 2021 | Patch release (enhancements, bug fixes, etc) |
| [5.3.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.3.0) (latest stable release) | 24.10.2021 | Minor release with breaking changes (with fallback) |
| [4.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.1) | 06.05.2020 | Patch release (enhancements, bug fixes, etc) |
OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0
@@ -169,16 +177,16 @@ See the different versions of the [openapi-generator-cli](https://mvnrepository.
<!-- RELEASE_VERSION -->
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.2.1/openapi-generator-cli-5.2.1.jar`
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.jar`
For **Mac/Linux** users:
```sh
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.2.1/openapi-generator-cli-5.2.1.jar -O openapi-generator-cli.jar
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.jar -O openapi-generator-cli.jar
```
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
```
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.2.1/openapi-generator-cli-5.2.1.jar
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.jar
```
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
@@ -215,21 +223,21 @@ Examples:
# Execute latest released openapi-generator-cli
openapi-generator-cli version
# Execute version 3.1.0 for the current invocation, regardless of the latest released version
OPENAPI_GENERATOR_VERSION=3.1.0 openapi-generator-cli version
# Execute version 4.1.0 for the current invocation, regardless of the latest released version
OPENAPI_GENERATOR_VERSION=4.1.0 openapi-generator-cli version
# Execute version 3.1.0-SNAPSHOT for the current invocation
OPENAPI_GENERATOR_VERSION=3.1.0-SNAPSHOT openapi-generator-cli version
# Execute version 4.1.0-SNAPSHOT for the current invocation
OPENAPI_GENERATOR_VERSION=4.1.0-SNAPSHOT openapi-generator-cli version
# Execute version 3.0.2 for every invocation in the current shell session
export OPENAPI_GENERATOR_VERSION=3.0.2
openapi-generator-cli version # is 3.0.2
openapi-generator-cli version # is also 3.0.2
# Execute version 4.0.2 for every invocation in the current shell session
export OPENAPI_GENERATOR_VERSION=4.0.2
openapi-generator-cli version # is 4.0.2
openapi-generator-cli version # is also 4.0.2
# To "install" a specific version, set the variable in .bashrc/.bash_profile
echo "export OPENAPI_GENERATOR_VERSION=3.0.2" >> ~/.bashrc
echo "export OPENAPI_GENERATOR_VERSION=4.0.2" >> ~/.bashrc
source ~/.bashrc
openapi-generator-cli version # is always 3.0.2, unless any of the above overrides are done ad hoc
openapi-generator-cli version # is always 4.0.2, unless any of the above overrides are done ad hoc
```
### [1.4 - Build Projects](#table-of-contents)
@@ -403,7 +411,7 @@ openapi-generator-cli version
To use a specific version of "openapi-generator-cli"
```sh
openapi-generator-cli version-manager set 5.2.1
openapi-generator-cli version-manager set 5.3.0
```
Or install it as dev-dependency:
@@ -427,7 +435,7 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g php -o c:\temp\php_api_client`)
<!-- RELEASE_VERSION -->
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.2.1/openapi-generator-cli-5.2.1.jar)
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.jar)
<!-- /RELEASE_VERSION -->
To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate`
@@ -569,6 +577,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [Adaptant Solutions AG](https://www.adaptant.io/)
- [adesso SE](https://www.adesso.de/)
- [Agoda](https://www.agoda.com/)
- [Airthings](https://www.airthings.com/)
- [Allianz](https://www.allianz.com)
- [Angular.Schule](https://angular.schule/)
- [Aqovia](https://aqovia.com/)
@@ -581,6 +590,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [Bithost GmbH](https://www.bithost.ch)
- [Bosch Connected Industry](https://www.bosch-connected-industry.com)
- [Boxever](https://www.boxever.com/)
- [Bunker Holding Group](https://www.bunker-holding.com/)
- [California State University, Northridge](https://www.csun.edu)
- [CAM](https://www.cam-inc.co.jp/)
- [Camptocamp](https://www.camptocamp.com/en)
@@ -642,6 +652,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [Ponicode](https://ponicode.dev/)
- [Pricefx](https://www.pricefx.com/)
- [Prometheus/Alertmanager](https://github.com/prometheus/alertmanager)
- [Qavar](https://www.qavar.com)
- [QEDIT](https://qed-it.com)
- [Qulix Systems](https://www.qulix.com)
- [Raksul](https://corp.raksul.com)
@@ -825,6 +836,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- 2021-05-31 - [FlutterでOpen Api Generator(Swagger)を使う](https://aakira.app/blog/2021/05/flutter-open-api/) by [AAkira](https://twitter.com/_a_akira)
- 2021-06-22 - [Rest API Documentation and Client Generation With OpenAPI](https://dzone.com/articles/rest-api-documentation-and-client-generation-with) by [Prasanth Gullapalli](https://dzone.com/users/1011797/prasanthnath.g@gmail.com.html)
- 2021-07-16 - [銀行事業のサーバーサイド開発について / LINE 京都開発室 エンジニア採用説明会](https://www.youtube.com/watch?v=YrrKQHxLPpQ) by 野田誠人, Robert Mitchell
- 2021-07-19 - [OpenAPI code generation with kotlin](https://sylhare.github.io/2021/07/19/Openapi-swagger-codegen-with-kotlin.html) by [sylhare](https://github.com/sylhare)
- 2021-07-29 - [How To Rewrite a Huge Codebase](https://dzone.com/articles/how-to-rewrite-a-huge-code-base) by [Curtis Poe](https://dzone.com/users/4565446/publiusovidius.html)
- 2021-08-21 - [Generating Client APIs using Swagger Part 1](https://medium.com/@flowsquad/generating-client-apis-using-swagger-part-1-2d46f13f5e92) by [FlowSquad.io](https://medium.com/@flowsquad)
- 2021-09-11 - [Invoking AWS ParallelCluster API](https://docs.aws.amazon.com/parallelcluster/latest/ug/api-reference-v3.html) at [AWS ParallelCluster API official documentation](https://docs.aws.amazon.com/parallelcluster/latest/ug/api-reference-v3.html)
@@ -832,6 +844,8 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- 2021-10-02 - [How to Write Fewer Lines of Code with the OpenAPI Generator](https://hackernoon.com/how-to-write-fewer-lines-of-code-with-the-openapi-generator) by [Mikhail Alfa](https://hackernoon.com/u/alphamikle)
- 2021-10-12 - [OpenAPI Generator : 4000 étoiles sur GitHub et des spaghettis](https://www.youtube.com/watch?v=9hEsNBSqTFk) by [Jérémie Bresson](https://github.com/jmini) at [Devoxx FR 2021](https://cfp.devoxx.fr/2021/speaker/jeremie_bresson)
- 2021-10-17 - [Generate a TypeScript HTTP Client From An OpenAPI Spec In DotNET 5](https://richardwillis.info/blog/generate-a-type-script-http-client-from-an-open-api-spec-in-dot-net-5) by [Richard Willis](https://github.com/badsyntax)
- 2021-11-06 - [スタートアップの開発で意識したこと](https://zenn.dev/woo_noo/articles/5cb09f8e2899ae782ad1) by [woo-noo](https://zenn.dev/woo_noo)
- 2021-11-09 - [Effective Software Development using OpenAPI Generator](https://apexlabs.ai/post/effective-software-development-using-openapi-generator) by Ajil Oomme
## [6 - About Us](#table-of-contents)
@@ -940,6 +954,7 @@ Here is a list of template creators:
* C# ASP.NET 5: @jimschubert [:heart:](https://www.patreon.com/jimschubert)
* C# ASP.NET Core 3.0: @A-Joshi
* C# APS.NET Core 3.1: @phatcher
* C# Azure functions: @Abrhm7786
* C# NancyFX: @mstefaniuk
* C++ (Qt5 QHttpEngine): @etherealjoy
* C++ Pistache: @sebymiano
@@ -1048,7 +1063,7 @@ If you want to join the committee, please kindly apply by sending an email to te
| GraphQL | @renepardon (2018/12) |
| Groovy | |
| Haskell | |
| Java | @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) @nmuesch (2021/01) |
| Java | @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) |
| JMeter | @kannkyo (2021/01) |
| Kotlin | @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) |
| Lua | @daurnimator (2017/08) |

View File

@@ -7,7 +7,7 @@ install:
Add-Type -AssemblyName System.IO.Compression.FileSystem
if (!(Test-Path -Path "C:\maven" )) {
(new-object System.Net.WebClient).DownloadFile(
'http://www.us.apache.org/dist/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.zip',
'https://archive.apache.org/dist/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.zip',
'C:\maven-bin.zip'
)
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\maven-bin.zip", "C:\maven")
@@ -22,15 +22,15 @@ install:
)
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\gradle-bin.zip", "C:\gradle")
}
- cmd: SET PATH=C:\maven\apache-maven-3.2.5\bin;C:\gradle\gradle-5.6.4\bin;%JAVA_HOME%\bin;%PATH%
- cmd: SET PATH=C:\maven\apache-maven-3.8.3\bin;C:\gradle\gradle-5.6.4\bin;%JAVA_HOME%\bin;%PATH%
- cmd: SET MAVEN_OPTS=-Xmx4g
- cmd: SET JAVA_OPTS=-Xmx4g
- cmd: SET M2_HOME=C:\maven\apache-maven-3.2.5
- cmd: SET M2_HOME=C:\maven\apache-maven-3.8.3
- cmd: java -version
- cmd: gradle -v
- cmd: dir/w
- git clone https://github.com/wing328/swagger-samples --depth 1
- ps: Start-Process -FilePath 'C:\maven\apache-maven-3.2.5\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci"
- ps: Start-Process -FilePath 'C:\maven\apache-maven-3.8.3\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci"
- ps: Start-Sleep -s 15
- ps: $PSVersionTable.PSVersion
- ps: Install-Module -Name Pester -Force -Scope CurrentUser

View File

@@ -2,3 +2,5 @@ generatorName: cpp-restsdk
outputDir: samples/client/petstore/cpp-restsdk/client
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/cpp-rest-sdk-client
additionalProperties:
packageName: CppRestPetstoreClient

View File

@@ -0,0 +1,10 @@
generatorName: csharp-netcore
outputDir: samples/client/others/csharp-netcore-complex-files
inputSpec: modules/openapi-generator/src/test/resources/3_0/form-multipart-binary-array.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
targetFramework: netstandard2.0
useCompareNetObjects: "true"
globalProperties:
skipFormModel: "false"

View File

@@ -5,3 +5,4 @@ inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: microprofile-rest-client
configKey: petstore

View File

@@ -0,0 +1,9 @@
generatorName: java
outputDir: samples/client/petstore/java/okhttp-gson-nextgen
library: okhttp-gson-nextgen
#inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature-okhttp-gson.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-okhttp-gson-nextgen
hideGenerationTimestamp: "true"

View File

@@ -0,0 +1,6 @@
generatorName: csharp-netcore-functions
outputDir: samples/client/petstore/csharp-netcore-functions
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore-functions
#additionalProperties:
# packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'

View File

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

View File

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

View File

@@ -0,0 +1,7 @@
generatorName: typescript-angular
outputDir: samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/typescript-angular
additionalProperties:
ngVersion: 13.0.1
supportsES6: true

View File

@@ -79,6 +79,7 @@ declare -a xml_files=(
"${root}/modules/openapi-generator-online/pom.xml"
"${root}/modules/openapi-generator/pom.xml"
"${root}/modules/openapi-generator-gradle-plugin/gradle.properties"
"${root}/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties"
"${root}/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml"
"${root}/modules/openapi-generator-maven-plugin/examples/java-client.xml"
"${root}/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml"

View File

@@ -86,6 +86,7 @@ The following generators are available:
* [cpp-qt-qhttpengine-server](generators/cpp-qt-qhttpengine-server.md)
* [cpp-restbed-server](generators/cpp-restbed-server.md)
* [csharp-nancyfx](generators/csharp-nancyfx.md)
* [csharp-netcore-functions (beta)](generators/csharp-netcore-functions.md)
* [erlang-server](generators/erlang-server.md)
* [fsharp-functions (beta)](generators/fsharp-functions.md)
* [fsharp-giraffe-server (beta)](generators/fsharp-giraffe-server.md)

View File

@@ -236,10 +236,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✓|OAS3
|OAuth2_Implicit||OAS2,OAS3
|OAuth2_Password||OAS2,OAS3
|OAuth2_ClientCredentials||OAS2,OAS3
|OAuth2_AuthorizationCode||OAS2,OAS3
|OAuth2_Implicit||OAS2,OAS3
|OAuth2_Password||OAS2,OAS3
|OAuth2_ClientCredentials||OAS2,OAS3
|OAuth2_AuthorizationCode||OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |

View File

@@ -12,6 +12,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|defaultInclude|The default include statement that should be placed in all headers for including things like the declspec (convention: #include &quot;Commons.h&quot; | ||
|generateGMocksForApis|Generate Google Mock classes for APIs.| |null|
|modelPackage|C++ namespace for models (convention: name.space.model).| |org.openapitools.client.model|
|packageName|C++ package (library) name.| |CppRestOpenAPIClient|
|packageVersion|C++ package version.| |1.0.0|
|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_|
|variableNameFirstCharacterUppercase|Make first character of variable name uppercase (eg. value -&gt; Value)| |true|

View File

@@ -58,6 +58,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul">
<li>abstract</li>
<li>alias</li>
<li>annotation</li>
<li>as</li>
<li>as?</li>
<li>asm</li>

View File

@@ -0,0 +1,300 @@
---
title: Config Options for csharp-netcore-functions
sidebar_label: csharp-netcore-functions
---
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive| |false|
|conditionalSerialization|Serialize only those properties which are initialized by user, accepted values are true or false, default value is false.| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|interfacePrefix|Prefix interfaces with a community standard or widely accepted prefix.| |I|
|library|HTTP library template (sub-template) to use|<dl><dt>**httpclient**</dt><dd>HttpClient (https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient) (Experimental. May subject to breaking changes without further notice.)</dd><dt>**restsharp**</dt><dd>RestSharp (https://github.com/restsharp/RestSharp)</dd></dl>|restsharp|
|licenseId|The identifier of the license| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |PascalCase|
|netCoreProjectFile|Use the new format (.NET Core) for .NET project files (.csproj).| |false|
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.| |false|
|nullableReferenceTypes|Use nullable annotations in the project. Only supported on C# 8 / ASP.NET Core 3.0 or newer.| |false|
|optionalAssemblyInfo|Generate AssemblyInfo.cs.| |true|
|optionalEmitDefaultValues|Set DataMember's EmitDefaultValue.| |false|
|optionalMethodArgument|C# Optional method argument, e.g. void square(int x=10) (.net 4.0+ only).| |true|
|optionalProjectFile|Generate {PackageName}.csproj.| |true|
|packageGuid|The GUID that will be associated with the C# project| |null|
|packageName|C# package name (convention: Title.Case).| |Org.OpenAPITools|
|packageTags|Tags to identify the package| |null|
|packageVersion|C# package version.| |1.0.0|
|releaseNote|Release note, default to 'Minor update'.| |Minor update|
|returnICollection|Return ICollection&lt;T&gt; instead of the concrete type.| |false|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src|
|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.0`|<dl><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible</dd><dt>**netstandard1.4**</dt><dd>.NET Standard 1.4 compatible</dd><dt>**netstandard1.5**</dt><dd>.NET Standard 1.5 compatible</dd><dt>**netstandard1.6**</dt><dd>.NET Standard 1.6 compatible</dd><dt>**netstandard2.0**</dt><dd>.NET Standard 2.0 compatible</dd><dt>**netstandard2.1**</dt><dd>.NET Standard 2.1 compatible</dd><dt>**netcoreapp2.0**</dt><dd>.NET Core 2.0 compatible</dd><dt>**netcoreapp2.1**</dt><dd>.NET Core 2.1 compatible</dd><dt>**netcoreapp3.0**</dt><dd>.NET Core 3.0 compatible</dd><dt>**netcoreapp3.1**</dt><dd>.NET Core 3.1 compatible</dd><dt>**net47**</dt><dd>.NET Framework 4.7 compatible</dd><dt>**net5.0**</dt><dd>.NET 5.0 compatible</dd></dl>|netstandard2.0|
|useCollection|Deserialize array types to Collection&lt;T&gt; instead of List&lt;T&gt;.| |false|
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped.| |false|
|validatable|Generates self-validatable models.| |true|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|List|
|list|List|
|map|Dictionary|
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Boolean</li>
<li>Collection</li>
<li>DateTime</li>
<li>DateTime?</li>
<li>DateTimeOffset</li>
<li>DateTimeOffset?</li>
<li>Decimal</li>
<li>Dictionary</li>
<li>Double</li>
<li>Float</li>
<li>Guid</li>
<li>Guid?</li>
<li>ICollection</li>
<li>Int32</li>
<li>Int64</li>
<li>List</li>
<li>Object</li>
<li>String</li>
<li>System.IO.Stream</li>
<li>bool</li>
<li>bool?</li>
<li>byte[]</li>
<li>decimal</li>
<li>decimal?</li>
<li>double</li>
<li>double?</li>
<li>float</li>
<li>float?</li>
<li>int</li>
<li>int?</li>
<li>long</li>
<li>long?</li>
<li>string</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>Client</li>
<li>Configuration</li>
<li>Version</li>
<li>abstract</li>
<li>as</li>
<li>base</li>
<li>bool</li>
<li>break</li>
<li>byte</li>
<li>case</li>
<li>catch</li>
<li>char</li>
<li>checked</li>
<li>class</li>
<li>client</li>
<li>const</li>
<li>continue</li>
<li>decimal</li>
<li>default</li>
<li>delegate</li>
<li>do</li>
<li>double</li>
<li>else</li>
<li>enum</li>
<li>event</li>
<li>explicit</li>
<li>extern</li>
<li>false</li>
<li>finally</li>
<li>fixed</li>
<li>float</li>
<li>for</li>
<li>foreach</li>
<li>goto</li>
<li>if</li>
<li>implicit</li>
<li>in</li>
<li>int</li>
<li>interface</li>
<li>internal</li>
<li>is</li>
<li>localVarFileParams</li>
<li>localVarFormParams</li>
<li>localVarHeaderParams</li>
<li>localVarHttpContentType</li>
<li>localVarHttpContentTypes</li>
<li>localVarHttpHeaderAccept</li>
<li>localVarHttpHeaderAccepts</li>
<li>localVarPath</li>
<li>localVarPathParams</li>
<li>localVarPostBody</li>
<li>localVarQueryParams</li>
<li>localVarResponse</li>
<li>localVarStatusCode</li>
<li>lock</li>
<li>long</li>
<li>namespace</li>
<li>new</li>
<li>null</li>
<li>object</li>
<li>operator</li>
<li>out</li>
<li>override</li>
<li>parameter</li>
<li>params</li>
<li>private</li>
<li>protected</li>
<li>public</li>
<li>readonly</li>
<li>ref</li>
<li>return</li>
<li>sbyte</li>
<li>sealed</li>
<li>short</li>
<li>sizeof</li>
<li>stackalloc</li>
<li>static</li>
<li>string</li>
<li>struct</li>
<li>switch</li>
<li>this</li>
<li>throw</li>
<li>true</li>
<li>try</li>
<li>typeof</li>
<li>uint</li>
<li>ulong</li>
<li>unchecked</li>
<li>unsafe</li>
<li>ushort</li>
<li>using</li>
<li>virtual</li>
<li>void</li>
<li>volatile</li>
<li>while</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✓|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✓|ToolingExtension
|MockServer|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✓|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✓|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@@ -31,7 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|returnICollection|Return ICollection&lt;T&gt; instead of the concrete type.| |false|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src|
|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.0`|<dl><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible</dd><dt>**netstandard1.4**</dt><dd>.NET Standard 1.4 compatible</dd><dt>**netstandard1.5**</dt><dd>.NET Standard 1.5 compatible</dd><dt>**netstandard1.6**</dt><dd>.NET Standard 1.6 compatible</dd><dt>**netstandard2.0**</dt><dd>.NET Standard 2.0 compatible</dd><dt>**netstandard2.1**</dt><dd>.NET Standard 2.1 compatible</dd><dt>**netcoreapp2.0**</dt><dd>.NET Core 2.0 compatible</dd><dt>**netcoreapp2.1**</dt><dd>.NET Core 2.1 compatible</dd><dt>**netcoreapp3.0**</dt><dd>.NET Core 3.0 compatible</dd><dt>**netcoreapp3.1**</dt><dd>.NET Core 3.1 compatible</dd><dt>**net47**</dt><dd>.NET Framework 4.7 compatible</dd><dt>**net5.0**</dt><dd>.NET 5.0 compatible</dd></dl>|netstandard2.0|
|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.0`|<dl><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible</dd><dt>**netstandard1.4**</dt><dd>.NET Standard 1.4 compatible</dd><dt>**netstandard1.5**</dt><dd>.NET Standard 1.5 compatible</dd><dt>**netstandard1.6**</dt><dd>.NET Standard 1.6 compatible</dd><dt>**netstandard2.0**</dt><dd>.NET Standard 2.0 compatible</dd><dt>**netstandard2.1**</dt><dd>.NET Standard 2.1 compatible</dd><dt>**netcoreapp2.0**</dt><dd>.NET Core 2.0 compatible</dd><dt>**netcoreapp2.1**</dt><dd>.NET Core 2.1 compatible</dd><dt>**netcoreapp3.0**</dt><dd>.NET Core 3.0 compatible</dd><dt>**netcoreapp3.1**</dt><dd>.NET Core 3.1 compatible</dd><dt>**net47**</dt><dd>.NET Framework 4.7 compatible</dd><dt>**net5.0**</dt><dd>.NET 5.0 compatible</dd><dt>**net6.0**</dt><dd>.NET 6.0 compatible</dd></dl>|netstandard2.0|
|useCollection|Deserialize array types to Collection&lt;T&gt; instead of List&lt;T&gt;.| |false|
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped.| |false|

View File

@@ -19,6 +19,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false|
|configKey|Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.| |null|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date (if you really have a good reason not to use threetenbp</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets &quot;java8&quot; to true</dd><dt>**threetenbp**</dt><dd>Backport of JSR310 (preferred for jdk &lt; 1.8)</dd></dl>|threetenbp|
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
@@ -29,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true|
|dynamicOperations|Generate operations dynamically at runtime from an OAS| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|errorObjectType|Error Object type. (This option is for okhttp-gson-next-gen only)| |null|
|fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |false|
|gradleProperties|Append additional Gradle proeprties to the gradle.properties file| |null|
|groupId|groupId in generated pom.xml| |org.openapitools|
@@ -37,7 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|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|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|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 gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libraries 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: JSON-B</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 4.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 gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libraries 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>**okhttp-gson-nextgen**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x.'. Better support for oneOf/anyOf with breaking changes. Will replace `okhttp-gson` in the 6.0.0 release.</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: JSON-B</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 4.x</dd></dl>|okhttp-gson|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|microprofileFramework|Framework for microprofile. Possible values &quot;kumuluzee&quot;| |null|

View File

@@ -74,6 +74,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## RESERVED WORDS
<ul class="column-ul">
<li>ApiResponse</li>
<li>abstract</li>
<li>actual</li>
<li>annotation</li>

View File

@@ -76,6 +76,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## RESERVED WORDS
<ul class="column-ul">
<li>ApiResponse</li>
<li>abstract</li>
<li>actual</li>
<li>annotation</li>

View File

@@ -68,6 +68,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## RESERVED WORDS
<ul class="column-ul">
<li>ApiResponse</li>
<li>abstract</li>
<li>actual</li>
<li>annotation</li>

View File

@@ -17,6 +17,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|library|Library template (sub-template) to use|<dl><dt>**jvm-okhttp4**</dt><dd>[DEFAULT] Platform: Java Virtual Machine. HTTP client: OkHttp 4.2.0 (Android 5.0+ and Java 8+). JSON processing: Moshi 1.8.0.</dd><dt>**jvm-okhttp3**</dt><dd>Platform: Java Virtual Machine. HTTP client: OkHttp 3.12.4 (Android 2.3+ and Java 7+). JSON processing: Moshi 1.8.0.</dd><dt>**jvm-retrofit2**</dt><dd>Platform: Java Virtual Machine. HTTP client: Retrofit 2.6.2.</dd><dt>**multiplatform**</dt><dd>Platform: Kotlin multiplatform. HTTP client: Ktor 1.6.0. JSON processing: Kotlinx Serialization: 1.2.1.</dd></dl>|jvm-okhttp4|
|modelMutable|Create mutable models| |false|
|moshiCodeGen|Whether to enable codegen with the Moshi library. Refer to the [official Moshi doc](https://github.com/square/moshi#codegen) for more info.| |false|
|omitGradlePluginVersions|Whether to declare Gradle plugin versions in build files.| |false|
|packageName|Generated artifact package name.| |org.openapitools.client|
|parcelizeModels|toggle &quot;@Parcelize&quot; for generated models| |null|
|requestDateConverter|JVM-Option. Defines in how to handle date-time objects that are used for a request (as query or parameter)|<dl><dt>**toJson**</dt><dd>[DEFAULT] Date formatter option using a json converter.</dd><dt>**toString**</dt><dd>Use the 'toString'-method of the date-time object to retrieve the related string representation.</dd></dl>|toJson|
@@ -78,6 +79,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
## RESERVED WORDS
<ul class="column-ul">
<li>ApiResponse</li>
<li>abstract</li>
<li>actual</li>
<li>annotation</li>

View File

@@ -7,6 +7,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|numberedFieldNumberList|Field numbers in order.| |false|
|startEnumsWithUnknown|Introduces &quot;UNKNOWN&quot; as the first element of enumerations.| |false|
## IMPORT MAPPING

View File

@@ -10,13 +10,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|gemAuthor|gem author (only one is supported).| |null|
|gemAuthor|gem author (only one is supported).| |OpenAPI-Generator|
|gemAuthorEmail|gem author email (only one is supported).| |null|
|gemDescription|gem description. | |This gem maps to a REST API|
|gemHomepage|gem homepage. | |http://org.openapitools|
|gemHomepage|gem homepage. | |https://openapi-generator.tech|
|gemLicense|gem license. | |unlicense|
|gemName|gem name (convention: underscore_case).| |openapi_client|
|gemRequiredRubyVersion|gem required Ruby version. | |&gt;= 1.9|
|gemRequiredRubyVersion|gem required Ruby version. | |&gt;= 2.4|
|gemSummary|gem summary. | |A ruby wrapper for the REST APIs|
|gemVersion|gem version.| |1.0.0|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|

View File

@@ -13,7 +13,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|artifactId| |openapi-scala-akka-http-server|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|asManagedSources|Resulting files cab be used as managed resources. No build files or default controllers will be generated| |false|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|groupId|groupId in generated pom.xml| |org.openapitools|

View File

@@ -9,7 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|apiPackage|package for generated api classes| |null|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|

View File

@@ -9,7 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|apiPackage|package for generated api classes| |null|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|

View File

@@ -9,7 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|apiPackage|package for generated api classes| |null|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|

View File

@@ -9,7 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|apiPackage|package for generated api classes| |null|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|

View File

@@ -10,7 +10,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|apiPackage|package for generated api classes| |null|
|circeVersion|The version of circe library| |0.13.0|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|jodaTimeVersion|The version of joda-time library| |2.10.10|

View File

@@ -9,7 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|apiPackage|package for generated api classes| |null|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|

View File

@@ -9,7 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|apiPackage|package for generated api classes| |null|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|

View File

@@ -45,6 +45,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model|
|oas3|Use OAS 3 Swagger annotations instead of OAS 2 annotations| |false|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
@@ -69,6 +70,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useOptional|Use Optional container for optional parameters| |false|
|useSpringController|Annotate the generated API as a Spring Controller| |false|
|useTags|use tags for creating interface and controller classnames| |false|
|virtualService|Generates the virtual service. For more details refer - https://github.com/virtualansoftware/virtualan/wiki| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

View File

@@ -11,6 +11,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|apiNamePrefix|Prefix that will be appended to all API names ('tags'). Default: empty string. e.g. Pet =&gt; Pet.| |null|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|generateFrozenEnums|Generate frozen enums (default: true)| |true|
|generateModelAdditionalProperties|Generate model additional properties (default: true)| |true|
|hashableModels|Make hashable models (default: true)| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|

View File

@@ -19,7 +19,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|modelFileSuffix|The suffix of the file of the generated model (model&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|
|modelSuffix|The suffix of the generated model.| |null|
|ngVersion|The version of Angular. (At least 6.0.0)| |12.0.0|
|ngVersion|The version of Angular. (At least 6.0.0)| |13.0.1|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|

View File

@@ -22,7 +22,7 @@ npm install @openapitools/openapi-generator-cli -g
To install a specific version of the tool, pass the version during installation:
<!-- RELEASE_VERSION -->
```bash
openapi-generator-cli version-manager set 5.1.0
openapi-generator-cli version-manager set 5.3.0
```
<!-- /RELEASE_VERSION -->
To install the tool as a dev dependency in your current project:
@@ -80,18 +80,18 @@ docker run --rm \
<!-- RELEASE_VERSION -->
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.0/openapi-generator-cli-5.1.0.jar`
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.jar`
For **Mac/Linux** users:
```bash
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.0/openapi-generator-cli-5.1.0.jar -O openapi-generator-cli.jar
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.jar -O openapi-generator-cli.jar
```
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
```powershell
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.0/openapi-generator-cli-5.1.0.jar
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.3.0/openapi-generator-cli-5.3.0.jar
```
<!-- /RELEASE_VERSION -->

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>5.3.0</version>
<version>5.3.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -86,7 +86,7 @@ public class ConfigHelp extends OpenApiGeneratorCommand {
"--markdown-header"}, title = "markdown header", description = "When format=markdown, include this option to write out markdown headers (e.g. for docusaurus).")
private Boolean markdownHeader;
@Option(name = {"--full-details"}, title = "full generator details", description = "displays CLI options as well as other configs/mappings (implies --instantiation-types, --reserved-words, --language-specific-primitives, --import-mappings, --supporting-files)")
@Option(name = {"--full-details"}, title = "full generator details", description = "displays CLI options as well as other configs/mappings (implies --instantiation-types, --reserved-words, --language-specific-primitives, --import-mappings, --feature-set)")
private Boolean fullDetails;
private String newline = System.lineSeparator();

View File

@@ -22,7 +22,9 @@ import org.apache.commons.lang3.ArrayUtils;
import org.mockito.MockSettings;
import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.Generator;
import org.openapitools.codegen.SpecValidationException;
import org.openapitools.codegen.config.CodegenConfigurator;
import org.testng.TestException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -430,4 +432,12 @@ public class GenerateTest {
verify(configurator).toContext();
verifyNoMoreInteractions(configurator);
}
/**
* This test ensures that when the
*/
@Test(expectedExceptions = SpecValidationException.class)
public void testNPEWithInvalidSpecFile() {
setupAndRunTest("-i", "src/test/resources/npe-test.yaml", "-g", "java", "-o", "src/main/java", false, null);
}
}

View File

@@ -0,0 +1,14 @@
test:
get:
responses:
'200':
description: test
content:
application/json:
schema:
type: object
properties:
prop1:
type: array
prop2:
type: date

View File

@@ -0,0 +1,8 @@
openapi: 3.0.0
info:
description: test
version: test
title: test
paths:
/test:
$ref: 'npe-test-spec-file.yaml#/test'

View File

@@ -6,7 +6,7 @@
<artifactId>openapi-generator-project</artifactId>
<groupId>org.openapitools</groupId>
<!-- RELEASE_VERSION -->
<version>5.3.0</version>
<version>5.3.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -97,7 +97,7 @@ task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.Valid
[source,group]
----
plugins {
id "org.openapi.generator" version "5.1.1"
id "org.openapi.generator" version "5.3.0"
}
----
@@ -113,7 +113,7 @@ buildscript {
// url "https://plugins.gradle.org/m2/"
}
dependencies {
classpath "org.openapitools:openapi-generator-gradle-plugin:5.1.1"
classpath "org.openapitools:openapi-generator-gradle-plugin:5.3.0"
}
}
@@ -690,7 +690,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath('org.openapitools:openapi-generator-gradle-plugin:4.2.3') {
classpath('org.openapitools:openapi-generator-gradle-plugin:5.3.0') {
exclude group: 'com.google.guava'
}
}

View File

@@ -1,5 +1,5 @@
# RELEASE_VERSION
openApiGeneratorVersion=5.3.0
openApiGeneratorVersion=5.3.1-SNAPSHOT
# /RELEASE_VERSION
# BEGIN placeholders

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>5.3.0</version>
<version>5.3.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -18,5 +18,5 @@ gradle generateGoWithInvalidSpec # expected outcome: BUILD FAILED
The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example:
```bash
gradle -PopenApiGeneratorVersion=5.1.0 openApiValidate
gradle -PopenApiGeneratorVersion=5.3.0 openApiValidate
```

View File

@@ -1,3 +1,3 @@
# RELEASE_VERSION
openApiGeneratorVersion=5.3.0-SNAPSHOT
openApiGeneratorVersion=5.3.1-SNAPSHOT
# /RELEASE_VERSION

View File

@@ -12,7 +12,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>5.1.0</version>
<version>5.3.0</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>5.3.0</version>
<version>5.3.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>
@@ -93,13 +93,17 @@
<!-- dependencies are needed for the client being generated -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations-version}</version>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations-version}</version>
</dependency>
<!-- You can find the dependencies for the library configuration you chose by looking in JavaClientCodegen.
Then find the corresponding dependency on Maven Central, and set the versions in the property section below -->
<!-- @Nullable annotation -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
<!-- HTTP client: jersey-client -->
<dependency>
@@ -107,6 +111,11 @@
<artifactId>jersey-client</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
@@ -118,77 +127,76 @@
<version>${jersey-version}</version>
</dependency>
<!-- @Nullable annotation -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
<!-- JSON processing: jackson -->
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-base</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson-version}</version>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson-version}</version>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-version}</version>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>${jackson-databind-nullable-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>${jackson-databind-nullable-version}</version>
</dependency>
<!-- Joda time: if you use it -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>${jackson-version}</version>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${jodatime-version}</version>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>com.github.scribejava</groupId>
<artifactId>scribejava-apis</artifactId>
<version>${scribejava-apis-version}</version>
</dependency>
<!-- Base64 encoding that works in both JVM and Android -->
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.connectors</groupId>
<artifactId>jersey-apache-connector</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>com.brsanthu</groupId>
<artifactId>migbase64</artifactId>
<version>2.2</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<swagger-annotations-version>1.5.8</swagger-annotations-version>
<jersey-version>2.27</jersey-version>
<jackson-version>2.9.10</jackson-version>
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
<jodatime-version>2.7</jodatime-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.8.1</junit-version>
<scribejava-apis-version>6.9.0</scribejava-apis-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.6.3</swagger-annotations-version>
<jersey-version>2.35</jersey-version>
<jackson-version>2.13.0</jackson-version>
<jackson-databind-version>2.13.0</jackson-databind-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>4.13.2</junit-version>
<scribejava-apis-version>8.3.1</scribejava-apis-version>
</properties>
</project>

View File

@@ -15,7 +15,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>5.3.0</version>
<version>5.3.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -19,7 +19,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>5.3.0</version>
<version>5.3.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<dependencies>
<dependency>

View File

@@ -14,9 +14,9 @@
<properties>
<swagger-annotations-version>1.5.8</swagger-annotations-version>
<jersey-version>2.27</jersey-version>
<jackson-version>2.9.10</jackson-version>
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
<jersey-version>2.35</jersey-version>
<jackson-version>2.13.0</jackson-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
<jodatime-version>2.7</jodatime-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.8.1</junit-version>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>5.3.0</version>
<version>5.3.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>5.3.0</version>
<version>5.3.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

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

View File

@@ -5,7 +5,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>5.3.0</version>
<version>5.3.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>5.3.0</version>
<version>5.3.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>5.3.0</version>
<version>5.3.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -0,0 +1,66 @@
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openapitools.codegen;
import java.util.*;
public class CodegenComposedSchemas {
private List<CodegenProperty> allOf;
private List<CodegenProperty> oneOf;
private List<CodegenProperty> anyOf;
public CodegenComposedSchemas(List<CodegenProperty> allOf, List<CodegenProperty> oneOf, List<CodegenProperty> anyOf) {
this.allOf = allOf;
this.oneOf = oneOf;
this.anyOf = anyOf;
}
public List<CodegenProperty> getAllOf() {
return allOf;
}
public List<CodegenProperty> getOneOf() {
return oneOf;
}
public List<CodegenProperty> getAnyOf() {
return anyOf;
}
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenComposedSchemas{");
sb.append("oneOf=").append(oneOf);
sb.append(", anyOf=").append(anyOf);
sb.append(", allOf=").append(allOf);
sb.append('}');
return sb.toString();
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CodegenComposedSchemas that = (CodegenComposedSchemas) o;
return Objects.equals(oneOf, that.oneOf) &&
Objects.equals(anyOf, that.anyOf) &&
Objects.equals(allOf, that.allOf);
}
@Override
public int hashCode() {
return Objects.hash(oneOf, anyOf, allOf);
}
}

View File

@@ -45,7 +45,7 @@ public class CodegenConfigLoader {
try {
return (CodegenConfig) Class.forName(name).getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw new GeneratorNotFoundException("Can't load config class with name '".concat(name) + "'\nAvailable:\n" + availableConfigs.toString(), e);
throw new GeneratorNotFoundException("Can't load config class with name '".concat(name) + "'\nAvailable:\n" + availableConfigs, e);
}
}

View File

@@ -0,0 +1,67 @@
package org.openapitools.codegen;
import java.util.List;
import java.util.Objects;
public class CodegenEncoding {
private String contentType;
private List<CodegenParameter> headers;
private String style;
private boolean explode;
private boolean allowReserved;
public CodegenEncoding(String contentType, List<CodegenParameter> headers, String style, boolean explode, boolean allowReserved) {
this.contentType = contentType;
this.headers = headers;
this.style = style;
this.explode = explode;
this.allowReserved = allowReserved;
}
public String getContentType() {
return contentType;
}
public List<CodegenParameter> getHeaders() {
return headers;
}
public String getStyle() {
return style;
}
public boolean getExplode() {
return explode;
}
public boolean getAllowReserved() {
return allowReserved;
}
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenEncoding{");
sb.append("contentType=").append(contentType);
sb.append(", headers=").append(headers);
sb.append(", style=").append(style);
sb.append(", explode=").append(explode);
sb.append(", allowReserved=").append(allowReserved);
sb.append('}');
return sb.toString();
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CodegenEncoding that = (CodegenEncoding) o;
return contentType == that.getContentType() &&
Objects.equals(headers, that.getHeaders()) &&
style == that.getStyle() &&
explode == that.getExplode() &&
allowReserved == that.getAllowReserved();
}
@Override
public int hashCode() {
return Objects.hash(contentType, headers, style, explode, allowReserved);
}
}

View File

@@ -0,0 +1,45 @@
package org.openapitools.codegen;
import java.util.LinkedHashMap;
import java.util.Objects;
public class CodegenMediaType {
private CodegenProperty schema;
private LinkedHashMap<String, CodegenEncoding> encoding;
public CodegenMediaType(CodegenProperty schema, LinkedHashMap<String, CodegenEncoding> encoding) {
this.schema = schema;
this.encoding = encoding;
}
public CodegenProperty getSchema() {
return schema;
}
public LinkedHashMap<String, CodegenEncoding> getEncoding() {
return encoding;
}
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenMediaType{");
sb.append("schema=").append(schema);
sb.append(", encoding=").append(encoding);
sb.append('}');
return sb.toString();
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CodegenMediaType that = (CodegenMediaType) o;
return Objects.equals(schema,that.getSchema()) &&
Objects.equals(encoding, that.getEncoding());
}
@Override
public int hashCode() {
return Objects.hash(schema, encoding);
}
}

View File

@@ -45,14 +45,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public List<CodegenModel> children;
// anyOf, oneOf, allOf
public Set<String> anyOf = new TreeSet<String>();
public Set<String> oneOf = new TreeSet<String>();
public Set<String> allOf = new TreeSet<String>();
// anyOf, oneOf, allOf with full properties/tags (e.g. isString, etc)
public List<CodegenProperty> anyOfProps = new ArrayList<>();
public List<CodegenProperty> allOfProps = new ArrayList<>();
public List<CodegenProperty> oneOfProps = new ArrayList<>();
public Set<String> anyOf = new TreeSet<>();
public Set<String> oneOf = new TreeSet<>();
public Set<String> allOf = new TreeSet<>();
// The schema name as written in the OpenAPI document.
public String name;
@@ -71,20 +66,20 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public boolean isAlias; // Is this effectively an alias of another simple type
public boolean isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, isDate, isDateTime, isShort, isUnboundedInteger, isBoolean;
private boolean additionalPropertiesIsAnyType;
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>(); // all properties (without parent's properties)
public List<CodegenProperty> allVars = new ArrayList<CodegenProperty>(); // all properties (with parent's properties)
public List<CodegenProperty> requiredVars = new ArrayList<CodegenProperty>(); // a list of required properties
public List<CodegenProperty> optionalVars = new ArrayList<CodegenProperty>(); // a list of optional properties
public List<CodegenProperty> readOnlyVars = new ArrayList<CodegenProperty>(); // a list of read-only properties
public List<CodegenProperty> readWriteVars = new ArrayList<CodegenProperty>(); // a list of properties for read, write
public List<CodegenProperty> parentVars = new ArrayList<CodegenProperty>();
public List<CodegenProperty> vars = new ArrayList<>(); // all properties (without parent's properties)
public List<CodegenProperty> allVars = new ArrayList<>(); // all properties (with parent's properties)
public List<CodegenProperty> requiredVars = new ArrayList<>(); // a list of required properties
public List<CodegenProperty> optionalVars = new ArrayList<>(); // a list of optional properties
public List<CodegenProperty> readOnlyVars = new ArrayList<>(); // a list of read-only properties
public List<CodegenProperty> readWriteVars = new ArrayList<>(); // a list of properties for read, write
public List<CodegenProperty> parentVars = new ArrayList<>();
public Map<String, Object> allowableValues;
// Sorted sets of required parameters.
public Set<String> mandatory = new TreeSet<String>(); // without parent's required properties
public Set<String> allMandatory = new TreeSet<String>(); // with parent's required properties
public Set<String> mandatory = new TreeSet<>(); // without parent's required properties
public Set<String> allMandatory = new TreeSet<>(); // with parent's required properties
public Set<String> imports = new TreeSet<String>();
public Set<String> imports = new TreeSet<>();
public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasValidation;
/**
* Indicates the OAS schema specifies "nullable: true".
@@ -109,7 +104,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public boolean hasOnlyReadOnly = true; // true if all properties are read-only
public ExternalDocumentation externalDocumentation;
public Map<String, Object> vendorExtensions = new HashMap<String, Object>();
public Map<String, Object> vendorExtensions = new HashMap<>();
private CodegenComposedSchemas composedSchemas;
private boolean hasMultipleTypes = false;
/**
* The type of the value for the additionalProperties keyword in the OAS document.
@@ -323,7 +320,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public void setDiscriminator(CodegenDiscriminator discriminator) {
this.discriminator = discriminator;
if (discriminator instanceof CodegenDiscriminator && !discriminator.getMappedModels().isEmpty()) {
if (discriminator != null && !discriminator.getMappedModels().isEmpty()) {
this.hasDiscriminatorWithNonEmptyMapping = true;
}
}
@@ -810,6 +807,22 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
this.isAnyType = isAnyType;
}
@Override
public void setComposedSchemas(CodegenComposedSchemas composedSchemas) {
this.composedSchemas = composedSchemas;
}
@Override
public CodegenComposedSchemas getComposedSchemas() {
return composedSchemas;
}
@Override
public boolean getHasMultipleTypes() {return hasMultipleTypes; }
@Override
public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -843,12 +856,14 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
hasOnlyReadOnly == that.hasOnlyReadOnly &&
isNull == that.isNull &&
hasValidation == that.hasValidation &&
hasMultipleTypes == that.getHasMultipleTypes() &&
hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() &&
getIsAnyType() == that.getIsAnyType() &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getUniqueItems() == that.getUniqueItems() &&
getExclusiveMinimum() == that.getExclusiveMinimum() &&
getExclusiveMaximum() == that.getExclusiveMaximum() &&
Objects.equals(composedSchemas, that.composedSchemas) &&
Objects.equals(parent, that.parent) &&
Objects.equals(parentSchema, that.parentSchema) &&
Objects.equals(interfaces, that.interfaces) &&
@@ -856,9 +871,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
Objects.equals(parentModel, that.parentModel) &&
Objects.equals(interfaceModels, that.interfaceModels) &&
Objects.equals(children, that.children) &&
Objects.equals(anyOf, that.anyOfProps) &&
Objects.equals(oneOf, that.oneOfProps) &&
Objects.equals(allOf, that.allOfProps) &&
Objects.equals(anyOf, that.anyOf) &&
Objects.equals(oneOf, that.oneOf) &&
Objects.equals(allOf, that.allOf) &&
@@ -921,8 +933,8 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
getAdditionalPropertiesType(), getMaxProperties(), getMinProperties(), getUniqueItems(), getMaxItems(),
getMinItems(), getMaxLength(), getMinLength(), getExclusiveMinimum(), getExclusiveMaximum(), getMinimum(),
getMaximum(), getPattern(), getMultipleOf(), getItems(), getAdditionalProperties(), getIsModel(),
getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping, anyOfProps, oneOfProps, allOfProps,
isAnyType);
getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping,
isAnyType, getComposedSchemas(), hasMultipleTypes);
}
@Override
@@ -938,9 +950,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
sb.append(", anyOf=").append(anyOf);
sb.append(", oneOf=").append(oneOf);
sb.append(", allOf=").append(allOf);
sb.append(", anyOf=").append(anyOfProps);
sb.append(", oneOf=").append(oneOfProps);
sb.append(", allOf=").append(allOfProps);
sb.append(", name='").append(name).append('\'');
sb.append(", classname='").append(classname).append('\'');
sb.append(", title='").append(title).append('\'');
@@ -1017,6 +1026,8 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
sb.append(", getAdditionalPropertiesIsAnyType=").append(getAdditionalPropertiesIsAnyType());
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
sb.append(", getIsAnyType=").append(getIsAnyType());
sb.append(", composedSchemas=").append(composedSchemas);
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
sb.append('}');
return sb.toString();
}
@@ -1056,13 +1067,13 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
private List<CodegenProperty> removeDuplicatedProperty(List<CodegenProperty> vars) {
// clone the list first
List<CodegenProperty> newList = new ArrayList<CodegenProperty>();
List<CodegenProperty> newList = new ArrayList<>();
for (CodegenProperty cp : vars) {
newList.add(cp.clone());
}
Set<String> propertyNames = new TreeSet<String>();
Set<String> duplicatedNames = new TreeSet<String>();
Set<String> propertyNames = new TreeSet<>();
Set<String> duplicatedNames = new TreeSet<>();
ListIterator<CodegenProperty> iterator = newList.listIterator();
while (iterator.hasNext()) {

View File

@@ -29,7 +29,8 @@ public class CodegenOperation {
isArray, isMultipart,
isResponseBinary = false, isResponseFile = false, hasReference = false,
isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false;
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false,
hasErrorResponseObject; // if 4xx, 5xx repsonses have at least one error object defined
public String path, operationId, returnType, returnFormat, httpMethod, returnBaseType,
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse;
public CodegenDiscriminator discriminator;
@@ -225,9 +226,17 @@ public class CodegenOperation {
/**
* Check if body param is allowed for the request method
*
* @return true request method is PUT, PATCH or POST; false otherwise
* @return true request method is DELETE, PUT, PATCH or POST; false otherwise
*/
public boolean isBodyAllowed() {
return Arrays.asList("DELETE","PUT", "PATCH", "POST").contains(httpMethod.toUpperCase(Locale.ROOT));
}
/**
* Check if the request method is PUT or PATCH or POST
*
* @return true request method is PUT, PATCH or POST; false otherwise
*/
public boolean isMethodPutOrPatchOrPost() {
return Arrays.asList("PUT", "PATCH", "POST").contains(httpMethod.toUpperCase(Locale.ROOT));
}
@@ -289,6 +298,7 @@ public class CodegenOperation {
sb.append(", isResponseFile=").append(isResponseFile);
sb.append(", hasReference=").append(hasReference);
sb.append(", hasDefaultResponse=").append(hasDefaultResponse);
sb.append(", hasErrorResponseObject=").append(hasErrorResponseObject);
sb.append(", isRestfulIndex=").append(isRestfulIndex);
sb.append(", isRestfulShow=").append(isRestfulShow);
sb.append(", isRestfulCreate=").append(isRestfulCreate);
@@ -363,6 +373,7 @@ public class CodegenOperation {
isResponseFile == that.isResponseFile &&
hasReference == that.hasReference &&
hasDefaultResponse == that.hasDefaultResponse &&
hasErrorResponseObject == that.hasErrorResponseObject &&
isRestfulIndex == that.isRestfulIndex &&
isRestfulShow == that.isRestfulShow &&
isRestfulCreate == that.isRestfulCreate &&
@@ -427,6 +438,7 @@ public class CodegenOperation {
produces, prioritizedContentTypes, servers, bodyParam, allParams, bodyParams, pathParams, queryParams,
headerParams, formParams, cookieParams, requiredParams, optionalParams, authMethods, tags,
responses, callbacks, imports, examples, requestBodyExamples, externalDocs, vendorExtensions,
nickname, operationIdOriginal, operationIdLowerCase, operationIdCamelCase, operationIdSnakeCase);
nickname, operationIdOriginal, operationIdLowerCase, operationIdCamelCase, operationIdSnakeCase,
hasErrorResponseObject);
}
}

View File

@@ -52,6 +52,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
public boolean hasValidation;
public boolean isNullable;
public boolean isDeprecated;
private CodegenProperty schema;
/**
* Determines whether this parameter is mandatory. If the parameter is in "path",
* this property is required and its value MUST be true. Otherwise, the property
@@ -107,6 +108,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
public boolean isNull;
private boolean hasRequired;
private boolean hasDiscriminatorWithNonEmptyMapping;
private CodegenComposedSchemas composedSchemas;
private boolean hasMultipleTypes = false;
private LinkedHashMap<String, CodegenMediaType> content;
public CodegenParameter copy() {
CodegenParameter output = new CodegenParameter();
@@ -158,7 +162,17 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
output.setHasVars(this.hasVars);
output.setHasRequired(this.hasRequired);
output.setHasDiscriminatorWithNonEmptyMapping(this.hasDiscriminatorWithNonEmptyMapping);
output.setHasMultipleTypes(this.hasMultipleTypes);
if (this.content != null) {
output.setContent(this.content);
}
if (this.schema != null) {
output.setSchema(this.schema);
}
if (this.composedSchemas != null) {
output.setComposedSchemas(this.getComposedSchemas());
}
if (this._enum != null) {
output._enum = new ArrayList<String>(this._enum);
}
@@ -216,7 +230,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
@Override
public int hashCode() {
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping);
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, schema, content);
}
@Override
@@ -264,13 +278,17 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
isDeprecated == that.isDeprecated &&
required == that.required &&
isNull == that.isNull &&
hasDiscriminatorWithNonEmptyMapping && that.getHasDiscriminatorWithNonEmptyMapping() &&
hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
hasMultipleTypes == that.getHasMultipleTypes() &&
getHasVars() == that.getHasVars() &&
getHasRequired() == that.getHasRequired() &&
getExclusiveMaximum() == that.getExclusiveMaximum() &&
getExclusiveMinimum() == that.getExclusiveMinimum() &&
getUniqueItems() == that.getUniqueItems() &&
Objects.equals(content, that.getContent()) &&
Objects.equals(schema, that.getSchema()) &&
Objects.equals(composedSchemas, that.getComposedSchemas()) &&
Objects.equals(baseName, that.baseName) &&
Objects.equals(paramName, that.paramName) &&
Objects.equals(dataType, that.dataType) &&
@@ -393,6 +411,10 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
sb.append(", getHasVars=").append(hasVars);
sb.append(", getHasRequired=").append(hasRequired);
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
sb.append(", composedSchemas=").append(composedSchemas);
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
sb.append(", schema=").append(schema);
sb.append(", content=").append(content);
sb.append('}');
return sb.toString();
}
@@ -706,5 +728,33 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
public void setIsAnyType(boolean isAnyType) {
this.isAnyType = isAnyType;
}
@Override
public void setComposedSchemas(CodegenComposedSchemas composedSchemas) {
this.composedSchemas = composedSchemas;
}
@Override
public CodegenComposedSchemas getComposedSchemas() {
return composedSchemas;
}
@Override
public boolean getHasMultipleTypes() {return hasMultipleTypes; }
@Override
public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
public CodegenProperty getSchema() {return schema; }
public void setSchema(CodegenProperty schema) { this.schema = schema; }
public LinkedHashMap<String, CodegenMediaType> getContent() {
return content;
}
public void setContent(LinkedHashMap<String, CodegenMediaType> content) {
this.content = content;
}
}

View File

@@ -191,6 +191,8 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
private boolean hasVars;
private boolean hasRequired;
private boolean hasDiscriminatorWithNonEmptyMapping;
private CodegenComposedSchemas composedSchemas = null;
private boolean hasMultipleTypes = false;
public String getBaseName() {
return baseName;
@@ -614,6 +616,16 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
this.xmlNamespace = xmlNamespace;
}
@Override
public void setComposedSchemas(CodegenComposedSchemas composedSchemas) {
this.composedSchemas = composedSchemas;
}
@Override
public CodegenComposedSchemas getComposedSchemas() {
return composedSchemas;
}
@Override
public CodegenProperty clone() {
try {
@@ -642,6 +654,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
if (this.vendorExtensions != null) {
cp.vendorExtensions = new HashMap<String, Object>(this.vendorExtensions);
}
if (this.composedSchemas != null) {
cp.composedSchemas = this.composedSchemas;
}
return cp;
} catch (CloneNotSupportedException e) {
@@ -787,6 +802,12 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
this.isAnyType = isAnyType;
}
@Override
public boolean getHasMultipleTypes() {return hasMultipleTypes; }
@Override
public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenProperty{");
@@ -882,6 +903,8 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
sb.append(", getHasVars=").append(getHasVars());
sb.append(", getHasRequired=").append(getHasRequired());
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
sb.append(", composedSchemas=").append(composedSchemas);
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
sb.append('}');
return sb.toString();
}
@@ -933,10 +956,12 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
isXmlAttribute == that.isXmlAttribute &&
isXmlWrapped == that.isXmlWrapped &&
isNull == that.isNull &&
hasMultipleTypes == that.getHasMultipleTypes() &&
hasDiscriminatorWithNonEmptyMapping == that.hasDiscriminatorWithNonEmptyMapping &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getHasVars() == that.getHasVars() &&
getHasRequired() ==that.getHasRequired() &&
Objects.equals(composedSchemas, that.composedSchemas) &&
Objects.equals(openApiType, that.openApiType) &&
Objects.equals(baseName, that.baseName) &&
Objects.equals(complexType, that.complexType) &&
@@ -999,6 +1024,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
vendorExtensions, hasValidation, isInherited, discriminatorValue, nameInCamelCase,
nameInSnakeCase, enumName, maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName,
xmlNamespace, isXmlWrapped, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired,
hasDiscriminatorWithNonEmptyMapping);
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes);
}
}

View File

@@ -21,6 +21,7 @@ import java.util.*;
public class CodegenResponse implements IJsonSchemaValidationProperties {
public final List<CodegenProperty> headers = new ArrayList<CodegenProperty>();
private List<CodegenParameter> responseHeaders = new ArrayList<CodegenParameter>();
public String code;
public boolean is1xx;
public boolean is2xx;
@@ -85,6 +86,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
private boolean hasVars;
private boolean hasRequired;
private boolean hasDiscriminatorWithNonEmptyMapping;
private CodegenComposedSchemas composedSchemas;
private boolean hasMultipleTypes = false;
private LinkedHashMap<String, CodegenMediaType> content;
@Override
public int hashCode() {
@@ -96,7 +100,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(),
getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(),
is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired,
hasDiscriminatorWithNonEmptyMapping);
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, responseHeaders, content);
}
@Override
@@ -141,9 +145,13 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
is4xx == that.is4xx &&
is5xx == that.is5xx &&
hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() &&
hasMultipleTypes == that.getHasMultipleTypes() &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getHasVars() == that.getHasVars() &&
getHasRequired() == that.getHasRequired() &&
Objects.equals(content, that.getContent()) &&
Objects.equals(responseHeaders, that.getResponseHeaders()) &&
Objects.equals(composedSchemas, that.getComposedSchemas()) &&
Objects.equals(vars, that.vars) &&
Objects.equals(requiredVars, that.requiredVars) &&
Objects.equals(headers, that.headers) &&
@@ -172,6 +180,22 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
}
public LinkedHashMap<String, CodegenMediaType> getContent() {
return content;
}
public void setContent(LinkedHashMap<String, CodegenMediaType> content) {
this.content = content;
}
public List<CodegenParameter> getResponseHeaders() {
return responseHeaders;
}
public void setResponseHeaders(List<CodegenParameter> responseHeaders) {
this.responseHeaders = responseHeaders;
}
@Override
public String getPattern() {
return pattern;
@@ -482,6 +506,10 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
sb.append(", getHasVars=").append(hasVars);
sb.append(", getHasRequired=").append(hasRequired);
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
sb.append(", composedSchemas=").append(composedSchemas);
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
sb.append(", responseHeaders=").append(responseHeaders);
sb.append(", content=").append(content);
sb.append('}');
return sb.toString();
}
@@ -570,4 +598,20 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
public void setIsAnyType(boolean isAnyType) {
this.isAnyType = isAnyType;
}
@Override
public void setComposedSchemas(CodegenComposedSchemas composedSchemas) {
this.composedSchemas = composedSchemas;
}
@Override
public CodegenComposedSchemas getComposedSchemas() {
return composedSchemas;
}
@Override
public boolean getHasMultipleTypes() {return hasMultipleTypes; }
@Override
public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; }
}

View File

@@ -147,8 +147,8 @@ public class DefaultCodegen implements CodegenConfig {
protected Map<String, String> typeMapping;
protected Map<String, String> instantiationTypes;
protected Set<String> reservedWords;
protected Set<String> languageSpecificPrimitives = new HashSet<String>();
protected Map<String, String> importMapping = new HashMap<String, String>();
protected Set<String> languageSpecificPrimitives = new HashSet<>();
protected Map<String, String> importMapping = new HashMap<>();
protected String modelPackage = "", apiPackage = "", fileSuffix;
protected String modelNamePrefix = "", modelNameSuffix = "";
protected String apiNamePrefix = "", apiNameSuffix = "Api";
@@ -159,25 +159,25 @@ public class DefaultCodegen implements CodegenConfig {
apiTemplateFiles are for API outputs only (controllers/handlers).
API templates may be written multiple times; APIs are grouped by tag and the file is written once per tag group.
*/
protected Map<String, String> apiTemplateFiles = new HashMap<String, String>();
protected Map<String, String> modelTemplateFiles = new HashMap<String, String>();
protected Map<String, String> apiTestTemplateFiles = new HashMap<String, String>();
protected Map<String, String> modelTestTemplateFiles = new HashMap<String, String>();
protected Map<String, String> apiDocTemplateFiles = new HashMap<String, String>();
protected Map<String, String> modelDocTemplateFiles = new HashMap<String, String>();
protected Map<String, String> reservedWordsMappings = new HashMap<String, String>();
protected Map<String, String> apiTemplateFiles = new HashMap<>();
protected Map<String, String> modelTemplateFiles = new HashMap<>();
protected Map<String, String> apiTestTemplateFiles = new HashMap<>();
protected Map<String, String> modelTestTemplateFiles = new HashMap<>();
protected Map<String, String> apiDocTemplateFiles = new HashMap<>();
protected Map<String, String> modelDocTemplateFiles = new HashMap<>();
protected Map<String, String> reservedWordsMappings = new HashMap<>();
protected String templateDir;
protected String embeddedTemplateDir;
protected Map<String, Object> additionalProperties = new HashMap<>();
protected Map<String, String> serverVariables = new HashMap<String, String>();
protected Map<String, Object> vendorExtensions = new HashMap<String, Object>();
protected Map<String, String> serverVariables = new HashMap<>();
protected Map<String, Object> vendorExtensions = new HashMap<>();
/*
Supporting files are those which aren't models, APIs, or docs.
These get a different map of data bound to the templates. Supporting files are written once.
See also 'apiTemplateFiles'.
*/
protected List<SupportingFile> supportingFiles = new ArrayList<SupportingFile>();
protected List<CliOption> cliOptions = new ArrayList<CliOption>();
protected List<SupportingFile> supportingFiles = new ArrayList<>();
protected List<CliOption> cliOptions = new ArrayList<>();
protected boolean skipOverwrite;
protected boolean removeOperationIdPrefix;
protected String removeOperationIdPrefixDelimiter = "_";
@@ -210,7 +210,7 @@ public class DefaultCodegen implements CodegenConfig {
*/
protected boolean supportsAdditionalPropertiesWithComposedSchema;
protected boolean supportsMixins;
protected Map<String, String> supportedLibraries = new LinkedHashMap<String, String>();
protected Map<String, String> supportedLibraries = new LinkedHashMap<>();
protected String library;
protected Boolean sortParamsByRequiredFlag = true;
protected Boolean sortModelPropertiesByRequiredFlag = false;
@@ -222,7 +222,7 @@ public class DefaultCodegen implements CodegenConfig {
// How to encode special characters like $
// They are translated to words like "Dollar" and prefixed with '
// Then translated back during JSON encoding and decoding
protected Map<String, String> specialCharReplacements = new HashMap<String, String>();
protected Map<String, String> specialCharReplacements = new HashMap<>();
// When a model is an alias for a simple type
protected Map<String, String> typeAliases = null;
protected Boolean prependFormOrBodyParameters = false;
@@ -236,7 +236,7 @@ public class DefaultCodegen implements CodegenConfig {
protected boolean useOneOfInterfaces = false;
// whether or not the oneOf imports machinery should add oneOf interfaces as imports in implementing classes
protected boolean addOneOfInterfaceImports = false;
protected List<CodegenModel> addOneOfInterfaces = new ArrayList<CodegenModel>();
protected List<CodegenModel> addOneOfInterfaces = new ArrayList<>();
// flag to indicate whether to only update files whose contents have changed
protected boolean enableMinimalUpdate = false;
@@ -260,7 +260,7 @@ public class DefaultCodegen implements CodegenConfig {
private Map<String, Schema> modelNameToSchemaCache;
// A cache to efficiently lookup schema `toModelName()` based on the schema Key
private Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
private final Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
@Override
public List<CliOption> cliOptions() {
@@ -440,7 +440,7 @@ public class DefaultCodegen implements CodegenConfig {
// Gather data from all the models that contain oneOf into OneOfImplementorAdditionalData classes
// (see docstring of that class to find out what information is gathered and why)
Map<String, OneOfImplementorAdditionalData> additionalDataMap = new HashMap<String, OneOfImplementorAdditionalData>();
Map<String, OneOfImplementorAdditionalData> additionalDataMap = new HashMap<>();
for (Map.Entry<String, Object> modelsEntry : objs.entrySet()) {
Map<String, Object> modelsAttrs = (Map<String, Object>) modelsEntry.getValue();
List<Object> models = (List<Object>) modelsAttrs.get("models");
@@ -503,7 +503,7 @@ public class DefaultCodegen implements CodegenConfig {
* @return map of all models indexed by names
*/
public Map<String, CodegenModel> getAllModels(Map<String, Object> objs) {
Map<String, CodegenModel> allModels = new HashMap<String, CodegenModel>();
Map<String, CodegenModel> allModels = new HashMap<>();
for (Entry<String, Object> entry : objs.entrySet()) {
String modelName = toModelName(entry.getKey());
Map<String, Object> inner = (Map<String, Object>) entry.getValue();
@@ -570,14 +570,7 @@ public class DefaultCodegen implements CodegenConfig {
List<Map<String, Object>> models = (List<Map<String, Object>>) inner.get("models");
for (Map<String, Object> mo : models) {
CodegenModel cm = (CodegenModel) mo.get("model");
for (CodegenProperty cp : cm.allVars) {
// detect self import
if (cp.dataType.equalsIgnoreCase(cm.classname) ||
(cp.isContainer && cp.items != null && cp.items.dataType.equalsIgnoreCase(cm.classname))) {
cm.imports.remove(cm.classname); // remove self import
cp.isSelfReference = true;
}
}
removeSelfReferenceImports(cm);
}
}
setCircularReferences(allModels);
@@ -585,6 +578,23 @@ public class DefaultCodegen implements CodegenConfig {
return objs;
}
/**
* Removes imports from the model that points to itself
* Marks a self referencing property, if detected
*
* @param model Self imports will be removed from this model.imports collection
*/
protected void removeSelfReferenceImports(CodegenModel model) {
for (CodegenProperty cp : model.allVars) {
// detect self import
if (cp.dataType.equalsIgnoreCase(model.classname) ||
(cp.isContainer && cp.items != null && cp.items.dataType.equalsIgnoreCase(model.classname))) {
model.imports.remove(model.classname); // remove self import
cp.isSelfReference = true;
}
}
}
public void setCircularReferences(Map<String, CodegenModel> models) {
final Map<String, List<CodegenProperty>> dependencyMap = models.entrySet().stream()
.collect(Collectors.toMap(Entry::getKey, entry -> getModelDependencies(entry.getValue())));
@@ -823,9 +833,9 @@ public class DefaultCodegen implements CodegenConfig {
public void preprocessOpenAPI(OpenAPI openAPI) {
if (useOneOfInterfaces) {
// we process the openapi schema here to find oneOf schemas and create interface models for them
Map<String, Schema> schemas = new HashMap<String, Schema>(openAPI.getComponents().getSchemas());
Map<String, Schema> schemas = new HashMap<>(openAPI.getComponents().getSchemas());
if (schemas == null) {
schemas = new HashMap<String, Schema>();
schemas = new HashMap<>();
}
Map<String, PathItem> pathItems = openAPI.getPaths();
@@ -858,12 +868,12 @@ public class DefaultCodegen implements CodegenConfig {
}
// also add all properties of all schemas to be checked for oneOf
Map<String, Schema> propertySchemas = new HashMap<String, Schema>();
Map<String, Schema> propertySchemas = new HashMap<>();
for (Map.Entry<String, Schema> e : schemas.entrySet()) {
Schema s = e.getValue();
Map<String, Schema> props = s.getProperties();
if (props == null) {
props = new HashMap<String, Schema>();
props = new HashMap<>();
}
for (Map.Entry<String, Schema> p : props.entrySet()) {
propertySchemas.put(e.getKey() + "/" + p.getKey(), p.getValue());
@@ -1431,7 +1441,7 @@ public class DefaultCodegen implements CodegenConfig {
public String toVarName(final String name) {
if (reservedWords.contains(name)) {
return escapeReservedWord(name);
} else if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) {
} else if (name.chars().anyMatch(character -> specialCharReplacements.containsKey(String.valueOf((char) character)))) {
return escape(name, specialCharReplacements, null, null);
}
return name;
@@ -1449,7 +1459,7 @@ public class DefaultCodegen implements CodegenConfig {
name = removeNonNameElementToCamelCase(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
if (reservedWords.contains(name)) {
return escapeReservedWord(name);
} else if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) {
} else if (name.chars().anyMatch(character -> specialCharReplacements.containsKey(String.valueOf((char) character)))) {
return escape(name, specialCharReplacements, null, null);
}
return name;
@@ -1547,7 +1557,7 @@ public class DefaultCodegen implements CodegenConfig {
.generationMessage(String.format(Locale.ROOT, "OpenAPI Generator: %s (%s)", getName(), codegenType.toValue()))
.build();
defaultIncludes = new HashSet<String>(
defaultIncludes = new HashSet<>(
Arrays.asList("double",
"int",
"long",
@@ -1564,7 +1574,7 @@ public class DefaultCodegen implements CodegenConfig {
"Float")
);
typeMapping = new HashMap<String, String>();
typeMapping = new HashMap<>();
typeMapping.put("array", "List");
typeMapping.put("set", "Set");
typeMapping.put("map", "Map");
@@ -1591,9 +1601,9 @@ public class DefaultCodegen implements CodegenConfig {
typeMapping.put("URI", "URI");
typeMapping.put("AnyType", "oas_any_type_not_mapped");
instantiationTypes = new HashMap<String, String>();
instantiationTypes = new HashMap<>();
reservedWords = new HashSet<String>();
reservedWords = new HashSet<>();
cliOptions.add(CliOption.newBoolean(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG,
CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC).defaultValue(Boolean.TRUE.toString()));
@@ -1748,7 +1758,7 @@ public class DefaultCodegen implements CodegenConfig {
if (!param.getRequired()) {
paramPart.append("]");
}
sb.append(paramPart.toString());
sb.append(paramPart);
}
}
}
@@ -2382,14 +2392,14 @@ public class DefaultCodegen implements CodegenConfig {
}
}
Map<NamedSchema, CodegenProperty> schemaCodegenPropertyCache = new HashMap<NamedSchema, CodegenProperty>();
Map<NamedSchema, CodegenProperty> schemaCodegenPropertyCache = new HashMap<>();
protected void updateModelForComposedSchema(CodegenModel m, Schema schema, Map<String, Schema> allDefinitions) {
final ComposedSchema composed = (ComposedSchema) schema;
Map<String, Schema> properties = new LinkedHashMap<String, Schema>();
List<String> required = new ArrayList<String>();
Map<String, Schema> allProperties = new LinkedHashMap<String, Schema>();
List<String> allRequired = new ArrayList<String>();
Map<String, Schema> properties = new LinkedHashMap<>();
List<String> required = new ArrayList<>();
Map<String, Schema> allProperties = new LinkedHashMap<>();
List<String> allRequired = new ArrayList<>();
// if schema has properties outside of allOf/oneOf/anyOf also add them to m
if (composed.getProperties() != null && !composed.getProperties().isEmpty()) {
@@ -2407,7 +2417,7 @@ public class DefaultCodegen implements CodegenConfig {
// TODO revise the logic below to set discriminator, xml attributes
if (supportsInheritance || supportsMixins) {
m.allVars = new ArrayList<CodegenProperty>();
m.allVars = new ArrayList<>();
if (composed.getAllOf() != null) {
int modelImplCnt = 0; // only one inline object allowed in a ComposedModel
int modelDiscriminators = 0; // only one discriminator allowed in a ComposedModel
@@ -2440,13 +2450,10 @@ public class DefaultCodegen implements CodegenConfig {
// interfaces (schemas defined in allOf, anyOf, oneOf)
List<Schema> interfaces = ModelUtils.getInterfaces(composed);
List<CodegenProperty> anyOfProps = new ArrayList<>();
List<CodegenProperty> allOfProps = new ArrayList<>();
List<CodegenProperty> oneOfProps = new ArrayList<>();
if (!interfaces.isEmpty()) {
// m.interfaces is for backward compatibility
if (m.interfaces == null)
m.interfaces = new ArrayList<String>();
m.interfaces = new ArrayList<>();
for (Schema interfaceSchema : interfaces) {
interfaceSchema = unaliasSchema(interfaceSchema, importMapping);
@@ -2467,7 +2474,6 @@ public class DefaultCodegen implements CodegenConfig {
LOGGER.warn("{} (anyOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType);
} else {
m.anyOf.add(languageType);
anyOfProps.add(interfaceProperty);
}
} else if (composed.getOneOf() != null) {
@@ -2475,7 +2481,6 @@ public class DefaultCodegen implements CodegenConfig {
LOGGER.warn("{} (oneOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType);
} else {
m.oneOf.add(languageType);
oneOfProps.add(interfaceProperty);
}
} else if (composed.getAllOf() != null) {
// no need to add primitive type to allOf, which should comprise of schemas (models) only
@@ -2511,29 +2516,22 @@ public class DefaultCodegen implements CodegenConfig {
if (composed.getAnyOf() != null) {
m.anyOf.add(modelName);
anyOfProps.add(interfaceProperty);
} else if (composed.getOneOf() != null) {
m.oneOf.add(modelName);
oneOfProps.add(interfaceProperty);
} else if (composed.getAllOf() != null) {
m.allOf.add(modelName);
allOfProps.add(interfaceProperty);
} else {
LOGGER.error("Composed schema has incorrect anyOf, allOf, oneOf defined: {}", composed);
}
}
}
m.oneOfProps = oneOfProps;
m.allOfProps = allOfProps;
m.anyOfProps = anyOfProps;
if (parent != null && composed.getAllOf() != null) { // set parent for allOf only
m.parentSchema = parentName;
m.parent = toModelName(parentName);
if (supportsMultipleInheritance) {
m.allParents = new ArrayList<String>();
m.allParents = new ArrayList<>();
for (String pname : allParents) {
String pModelName = toModelName(pname);
m.allParents.add(pModelName);
@@ -2685,7 +2683,7 @@ public class DefaultCodegen implements CodegenConfig {
// TODO remove the anyType check here in the future ANyType models can have enums defined
m.isEnum = true;
// comment out below as allowableValues is not set in post processing model enum
m.allowableValues = new HashMap<String, Object>();
m.allowableValues = new HashMap<>();
m.allowableValues.put("values", schema.getEnum());
}
if (!ModelUtils.isArraySchema(schema)) {
@@ -2696,6 +2694,7 @@ public class DefaultCodegen implements CodegenConfig {
}
m.setTypeProperties(schema);
m.setComposedSchemas(getComposedSchemas(schema));
if (ModelUtils.isArraySchema(schema)) {
CodegenProperty arrayProperty = fromProperty(name, schema);
m.setItems(arrayProperty.items);
@@ -2753,7 +2752,7 @@ public class DefaultCodegen implements CodegenConfig {
// set isDiscriminator on the discriminator property
if (m.discriminator != null) {
String discPropName = m.discriminator.getPropertyBaseName();
List<List<CodegenProperty>> listOLists = new ArrayList<List<CodegenProperty>>();
List<List<CodegenProperty>> listOLists = new ArrayList<>();
listOLists.add(m.requiredVars);
listOLists.add(m.vars);
listOLists.add(m.allVars);
@@ -3171,10 +3170,16 @@ public class DefaultCodegen implements CodegenConfig {
List<MappedModel> uniqueDescendants = new ArrayList();
if (sourceDiscriminator.getMapping() != null && !sourceDiscriminator.getMapping().isEmpty()) {
for (Entry<String, String> e : sourceDiscriminator.getMapping().entrySet()) {
String nameOrRef = e.getValue();
String name = nameOrRef.indexOf('/') >= 0 ? ModelUtils.getSimpleRef(nameOrRef) : nameOrRef;
String modelName = toModelName(name);
uniqueDescendants.add(new MappedModel(e.getKey(), modelName));
String name;
if (e.getValue().indexOf('/') >= 0) {
name = ModelUtils.getSimpleRef(e.getValue());
if (ModelUtils.getSchema(openAPI, name) == null) {
LOGGER.error("Failed to lookup the schema '{}' when processing the discriminator mapping of oneOf/anyOf. Please check to ensure it's defined properly.", name);
}
} else {
name = e.getValue();
}
uniqueDescendants.add(new MappedModel(e.getKey(), toModelName(name)));
}
}
@@ -3347,6 +3352,7 @@ public class DefaultCodegen implements CodegenConfig {
protected void updatePropertyForString(CodegenProperty property, Schema p) {
if (ModelUtils.isByteArraySchema(p)) {
property.setIsString(false);
property.isByteArray = true;
} else if (ModelUtils.isBinarySchema(p)) {
property.isBinary = true;
@@ -3471,13 +3477,13 @@ public class DefaultCodegen implements CodegenConfig {
//Inline enum case:
if (p.getEnum() != null && !p.getEnum().isEmpty()) {
List<Object> _enum = p.getEnum();
property._enum = new ArrayList<String>();
property._enum = new ArrayList<>();
for (Object i : _enum) {
property._enum.add(String.valueOf(i));
}
property.isEnum = true;
Map<String, Object> allowableValues = new HashMap<String, Object>();
Map<String, Object> allowableValues = new HashMap<>();
allowableValues.put("values", _enum);
if (allowableValues.size() > 0) {
property.allowableValues = allowableValues;
@@ -3490,7 +3496,7 @@ public class DefaultCodegen implements CodegenConfig {
if (referencedSchema.getEnum() != null && !referencedSchema.getEnum().isEmpty()) {
List<Object> _enum = referencedSchema.getEnum();
Map<String, Object> allowableValues = new HashMap<String, Object>();
Map<String, Object> allowableValues = new HashMap<>();
allowableValues.put("values", _enum);
if (allowableValues.size() > 0) {
property.allowableValues = allowableValues;
@@ -3514,6 +3520,7 @@ public class DefaultCodegen implements CodegenConfig {
}
property.setTypeProperties(p);
property.setComposedSchemas(getComposedSchemas(p));
if (ModelUtils.isIntegerSchema(p)) { // integer type
property.isNumeric = Boolean.TRUE;
if (ModelUtils.isLongSchema(p)) { // int64/long format
@@ -3792,7 +3799,7 @@ public class DefaultCodegen implements CodegenConfig {
Map<String, Schema> schemas,
CodegenOperation op,
ApiResponse methodResponse) {
handleMethodResponse(operation, schemas, op, methodResponse, Collections.<String, String>emptyMap());
handleMethodResponse(operation, schemas, op, methodResponse, Collections.emptyMap());
}
/**
@@ -3897,7 +3904,7 @@ public class DefaultCodegen implements CodegenConfig {
Map<String, Schema> schemas = ModelUtils.getSchemas(this.openAPI);
CodegenOperation op = CodegenModelFactory.newInstance(CodegenModelType.OPERATION);
Set<String> imports = new HashSet<String>();
Set<String> imports = new HashSet<>();
if (operation.getExtensions() != null && !operation.getExtensions().isEmpty()) {
op.vendorExtensions.putAll(operation.getExtensions());
@@ -3958,6 +3965,20 @@ public class DefaultCodegen implements CodegenConfig {
ApiResponse response = operationGetResponsesEntry.getValue();
addProducesInfo(response, op);
CodegenResponse r = fromResponse(key, response);
Map<String, Header> headers = response.getHeaders();
if (headers != null) {
List<CodegenParameter> responseHeaders = new ArrayList<>();
for (Entry<String, Header> entry: headers.entrySet()) {
String headerName = entry.getKey();
Header header = entry.getValue();
CodegenParameter responseHeader = heeaderToCodegenParameter(header, headerName, imports, String.format(Locale.ROOT, "%sResponseParameter", r.code));
responseHeaders.add(responseHeader);
}
r.setResponseHeaders(responseHeaders);
}
String mediaTypeSchemaSuffix = String.format(Locale.ROOT, "%sResponseBody", r.code);
r.setContent(getContent(response.getContent(), imports, mediaTypeSchemaSuffix));
if (r.baseType != null &&
!defaultIncludes.contains(r.baseType) &&
!languageSpecificPrimitives.contains(r.baseType)) {
@@ -3975,6 +3996,12 @@ public class DefaultCodegen implements CodegenConfig {
if (Boolean.TRUE.equals(r.isFile) && Boolean.TRUE.equals(r.is2xx) && Boolean.FALSE.equals(op.isResponseFile)) {
op.isResponseFile = Boolean.TRUE;
}
// check if any 4xx or 5xx reponse has an error response object defined
if ((Boolean.TRUE.equals(r.is4xx) || Boolean.TRUE.equals(r.is5xx)) &&
Boolean.FALSE.equals(r.primitiveType) && Boolean.FALSE.equals(r.simpleType)) {
op.hasErrorResponseObject = Boolean.TRUE;
}
}
op.responses.sort((a, b) -> {
int aScore = a.isWildcard() ? 2 : a.isRange() ? 1 : 0;
@@ -3995,15 +4022,15 @@ public class DefaultCodegen implements CodegenConfig {
}
List<Parameter> parameters = operation.getParameters();
List<CodegenParameter> allParams = new ArrayList<CodegenParameter>();
List<CodegenParameter> bodyParams = new ArrayList<CodegenParameter>();
List<CodegenParameter> pathParams = new ArrayList<CodegenParameter>();
List<CodegenParameter> queryParams = new ArrayList<CodegenParameter>();
List<CodegenParameter> headerParams = new ArrayList<CodegenParameter>();
List<CodegenParameter> cookieParams = new ArrayList<CodegenParameter>();
List<CodegenParameter> formParams = new ArrayList<CodegenParameter>();
List<CodegenParameter> requiredParams = new ArrayList<CodegenParameter>();
List<CodegenParameter> optionalParams = new ArrayList<CodegenParameter>();
List<CodegenParameter> allParams = new ArrayList<>();
List<CodegenParameter> bodyParams = new ArrayList<>();
List<CodegenParameter> pathParams = new ArrayList<>();
List<CodegenParameter> queryParams = new ArrayList<>();
List<CodegenParameter> headerParams = new ArrayList<>();
List<CodegenParameter> cookieParams = new ArrayList<>();
List<CodegenParameter> formParams = new ArrayList<>();
List<CodegenParameter> requiredParams = new ArrayList<>();
List<CodegenParameter> optionalParams = new ArrayList<>();
CodegenParameter bodyParam = null;
RequestBody requestBody = operation.getRequestBody();
@@ -4048,7 +4075,7 @@ public class DefaultCodegen implements CodegenConfig {
// add example
if (schemas != null) {
op.requestBodyExamples = new ExampleGenerator(schemas, this.openAPI).generate(null, new ArrayList<String>(getConsumesInfo(this.openAPI, operation)), bodyParam.baseType);
op.requestBodyExamples = new ExampleGenerator(schemas, this.openAPI).generate(null, new ArrayList<>(getConsumesInfo(this.openAPI, operation)), bodyParam.baseType);
}
}
}
@@ -4058,6 +4085,7 @@ public class DefaultCodegen implements CodegenConfig {
param = ModelUtils.getReferencedParameter(this.openAPI, param);
CodegenParameter p = fromParameter(param, imports);
p.setContent(getContent(param.getContent(), imports, "RequestParameter" + toModelName(param.getName())));
// ensure unique params
if (ensureUniqueParams) {
@@ -4265,8 +4293,10 @@ public class DefaultCodegen implements CodegenConfig {
}
r.setTypeProperties(responseSchema);
r.setComposedSchemas(getComposedSchemas(responseSchema));
if (ModelUtils.isArraySchema(responseSchema)) {
r.simpleType = false;
r.isArray = true;
r.containerType = cp.containerType;
ArraySchema as = (ArraySchema) responseSchema;
CodegenProperty items = fromProperty("response", getSchemaItems(as));
@@ -4286,6 +4316,7 @@ public class DefaultCodegen implements CodegenConfig {
} else if (ModelUtils.isUUIDSchema(responseSchema)) {
r.isUuid = true;
} else if (ModelUtils.isByteArraySchema(responseSchema)) {
r.setIsString(false);
r.isByteArray = true;
} else if (ModelUtils.isBinarySchema(responseSchema)) {
r.isFile = true; // file = binary in OAS3
@@ -4321,6 +4352,8 @@ public class DefaultCodegen implements CodegenConfig {
} else if (ModelUtils.isTypeObjectSchema(responseSchema)) {
if (ModelUtils.isFreeFormObject(openAPI, responseSchema)) {
r.isFreeFormObject = true;
} else {
r.isModel = true;
}
r.simpleType = false;
r.containerType = cp.containerType;
@@ -4332,9 +4365,6 @@ public class DefaultCodegen implements CodegenConfig {
LOGGER.debug("Property type is not primitive: {}", cp.dataType);
}
if (!r.isMap && !r.isArray) {
r.simpleType = true;
}
r.primitiveType = (r.baseType == null || languageSpecificPrimitives().contains(r.baseType));
if (r.baseType == null) {
@@ -4506,6 +4536,8 @@ public class DefaultCodegen implements CodegenConfig {
Schema parameterSchema;
if (parameter.getSchema() != null) {
parameterSchema = parameter.getSchema();
CodegenProperty prop = fromProperty(parameter.getName(), parameterSchema);
codegenParameter.setSchema(prop);
} else if (parameter.getContent() != null) {
Content content = parameter.getContent();
if (content.size() > 1) {
@@ -4538,7 +4570,7 @@ public class DefaultCodegen implements CodegenConfig {
return codegenParameter;
}
parameterSchema = unaliasSchema(parameterSchema, Collections.<String, String>emptyMap());
parameterSchema = unaliasSchema(parameterSchema, Collections.emptyMap());
if (parameterSchema == null) {
LOGGER.warn("warning! Schema not found for parameter \" {} \", using String", parameter.getName());
parameterSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to missing type definition.");
@@ -4547,6 +4579,7 @@ public class DefaultCodegen implements CodegenConfig {
}
ModelUtils.syncValidationProperties(parameterSchema, codegenParameter);
codegenParameter.setTypeProperties(parameterSchema);
codegenParameter.setComposedSchemas(getComposedSchemas(parameterSchema));
if (Boolean.TRUE.equals(parameterSchema.getNullable())) { // use nullable defined in the spec
codegenParameter.isNullable = true;
@@ -4761,7 +4794,7 @@ public class DefaultCodegen implements CodegenConfig {
return Collections.emptyList();
}
List<CodegenSecurity> codegenSecurities = new ArrayList<CodegenSecurity>(securitySchemeMap.size());
List<CodegenSecurity> codegenSecurities = new ArrayList<>(securitySchemeMap.size());
for (String key : securitySchemeMap.keySet()) {
final SecurityScheme securityScheme = securitySchemeMap.get(key);
if (SecurityScheme.Type.APIKEY.equals(securityScheme.getType())) {
@@ -4777,12 +4810,12 @@ public class DefaultCodegen implements CodegenConfig {
final CodegenSecurity cs = defaultCodegenSecurity(key, securityScheme);
cs.isKeyInHeader = cs.isKeyInQuery = cs.isKeyInCookie = cs.isApiKey = cs.isOAuth = false;
cs.isBasic = true;
if ("basic".equals(securityScheme.getScheme())) {
if ("basic".equalsIgnoreCase(securityScheme.getScheme())) {
cs.isBasicBasic = true;
} else if ("bearer".equals(securityScheme.getScheme())) {
} else if ("bearer".equalsIgnoreCase(securityScheme.getScheme())) {
cs.isBasicBearer = true;
cs.bearerFormat = securityScheme.getBearerFormat();
} else if ("signature".equals(securityScheme.getScheme())) {
} else if ("signature".equalsIgnoreCase(securityScheme.getScheme())) {
// HTTP signature as defined in https://datatracker.ietf.org/doc/draft-cavage-http-signatures/
// The registry of security schemes is maintained by IANA.
// https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml
@@ -4861,7 +4894,7 @@ public class DefaultCodegen implements CodegenConfig {
}
protected void setReservedWordsLowerCase(List<String> words) {
reservedWords = new HashSet<String>();
reservedWords = new HashSet<>();
for (String word : words) {
reservedWords.add(word.toLowerCase(Locale.ROOT));
}
@@ -4924,9 +4957,9 @@ public class DefaultCodegen implements CodegenConfig {
return null;
}
final List<Map<String, Object>> output = new ArrayList<Map<String, Object>>(examples.size());
final List<Map<String, Object>> output = new ArrayList<>(examples.size());
for (Map.Entry<String, Object> entry : examples.entrySet()) {
final Map<String, Object> kv = new HashMap<String, Object>();
final Map<String, Object> kv = new HashMap<>();
kv.put("contentType", entry.getKey());
kv.put("example", entry.getValue());
output.add(kv);
@@ -4982,7 +5015,7 @@ public class DefaultCodegen implements CodegenConfig {
co, Map<String, List<CodegenOperation>> operations) {
List<CodegenOperation> opList = operations.get(tag);
if (opList == null) {
opList = new ArrayList<CodegenOperation>();
opList = new ArrayList<>();
operations.put(tag, opList);
}
// check for operationId uniqueness
@@ -5090,8 +5123,8 @@ public class DefaultCodegen implements CodegenConfig {
m.hasVars = true;
m.hasEnums = false; // TODO need to fix as its false in both cases
Set<String> mandatory = required == null ? Collections.<String>emptySet()
: new TreeSet<String>(required);
Set<String> mandatory = required == null ? Collections.emptySet()
: new TreeSet<>(required);
// update "vars" without parent's properties (all, required)
addVars(m, m.vars, properties, mandatory);
@@ -5103,8 +5136,8 @@ public class DefaultCodegen implements CodegenConfig {
}
if (allProperties != null) {
Set<String> allMandatory = allRequired == null ? Collections.<String>emptySet()
: new TreeSet<String>(allRequired);
Set<String> allMandatory = allRequired == null ? Collections.emptySet()
: new TreeSet<>(allRequired);
// update "vars" with parent's properties (all, required)
addVars(m, m.allVars, allProperties, allMandatory);
m.allMandatory = allMandatory;
@@ -5114,14 +5147,14 @@ public class DefaultCodegen implements CodegenConfig {
}
// loop through list to update property name with toVarName
Set<String> renamedMandatory = new ConcurrentSkipListSet<String>();
Set<String> renamedMandatory = new ConcurrentSkipListSet<>();
Iterator<String> mandatoryIterator = m.mandatory.iterator();
while (mandatoryIterator.hasNext()) {
renamedMandatory.add(toVarName(mandatoryIterator.next()));
}
m.mandatory = renamedMandatory;
Set<String> renamedAllMandatory = new ConcurrentSkipListSet<String>();
Set<String> renamedAllMandatory = new ConcurrentSkipListSet<>();
Iterator<String> allMandatoryIterator = m.allMandatory.iterator();
while (allMandatoryIterator.hasNext()) {
renamedAllMandatory.add(toVarName(allMandatoryIterator.next()));
@@ -5171,17 +5204,7 @@ public class DefaultCodegen implements CodegenConfig {
cm.hasOnlyReadOnly = false;
}
// TODO revise the logic to include map
if (cp.isContainer) {
addImport(cm, typeMapping.get("array"));
}
addImport(cm, cp.baseType);
CodegenProperty innerCp = cp;
while (innerCp != null) {
addImport(cm, innerCp.complexType);
innerCp = innerCp.items;
}
addImportsForPropertyType(cm, cp);
// if required, add to the list "requiredVars"
if (Boolean.TRUE.equals(cp.required)) {
@@ -5202,6 +5225,28 @@ public class DefaultCodegen implements CodegenConfig {
return;
}
/**
* For a given property, adds all needed imports to the model
* This includes a flat property type (e.g. property type: ReferencedModel)
* as well as container type (property type: array of ReferencedModel's)
*
* @param model The codegen representation of the OAS schema.
* @param property The codegen representation of the OAS schema's property.
*/
protected void addImportsForPropertyType(CodegenModel model, CodegenProperty property) {
// TODO revise the logic to include map
if (property.isContainer) {
addImport(model, typeMapping.get("array"));
}
addImport(model, property.baseType);
CodegenProperty innerCp = property;
while (innerCp != null) {
addImport(model, innerCp.complexType);
innerCp = innerCp.items;
}
}
/**
* Determine all of the types in the model definitions (schemas) that are aliases of
* simple types.
@@ -5574,7 +5619,7 @@ public class DefaultCodegen implements CodegenConfig {
* @return sanitized string
*/
public String sanitizeName(String name, String removeCharRegEx) {
return sanitizeName(name, removeCharRegEx, new ArrayList<String>());
return sanitizeName(name, removeCharRegEx, new ArrayList<>());
}
/**
@@ -5833,7 +5878,7 @@ public class DefaultCodegen implements CodegenConfig {
enumName = String.valueOf(value);
} else {
enumName = value.toString().substring(truncateIdx);
if ("".equals(enumName)) {
if (enumName.isEmpty()) {
enumName = value.toString();
}
}
@@ -6063,7 +6108,7 @@ public class DefaultCodegen implements CodegenConfig {
return null;
}
Set<String> produces = new ConcurrentSkipListSet<String>();
Set<String> produces = new ConcurrentSkipListSet<>();
for (ApiResponse r : operation.getResponses().values()) {
ApiResponse response = ModelUtils.getReferencedApiResponse(openAPI, r);
@@ -6114,7 +6159,7 @@ public class DefaultCodegen implements CodegenConfig {
LOGGER.debug("debugging fromRequestBodyToFormParameters= {}", body);
Schema schema = ModelUtils.getSchemaFromRequestBody(body);
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
List<String> allRequired = new ArrayList<String>();
List<String> allRequired = new ArrayList<>();
Map<String, Schema> properties = new LinkedHashMap<>();
// this traverses a composed schema and extracts all properties in each schema into properties
// TODO in the future have this return one codegenParameter of type object or composed which includes all definition
@@ -6156,6 +6201,7 @@ public class DefaultCodegen implements CodegenConfig {
Schema ps = unaliasSchema(propertySchema, importMapping);
ModelUtils.syncValidationProperties(ps, codegenParameter);
codegenParameter.setTypeProperties(ps);
codegenParameter.setComposedSchemas(getComposedSchemas(ps));
if (ps.getPattern() != null) {
codegenParameter.pattern = toRegularExpression(ps.getPattern());
}
@@ -6294,7 +6340,7 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.datatypeWithEnum = codegenProperty.datatypeWithEnum;
codegenParameter.enumName = codegenProperty.enumName;
}
// import
if (codegenProperty.complexType != null) {
imports.add(codegenProperty.complexType);
@@ -6536,6 +6582,7 @@ public class DefaultCodegen implements CodegenConfig {
protected void updateRequestBodyForString(CodegenParameter codegenParameter, Schema schema, Set<String> imports, String bodyParameterName) {
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
if (ModelUtils.isByteArraySchema(schema)) {
codegenParameter.setIsString(false);
codegenParameter.isByteArray = true;
} else if (ModelUtils.isBinarySchema(schema)) {
codegenParameter.isBinary = true;
@@ -6559,6 +6606,77 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.pattern = toRegularExpression(schema.getPattern());
}
protected String toMediaTypeSchemaName(String contentType, String mediaTypeSchemaSuffix) {
return "SchemaFor" + mediaTypeSchemaSuffix + toModelName(contentType);
}
private CodegenParameter heeaderToCodegenParameter(Header header, String headerName, Set<String> imports, String mediaTypeSchemaSuffix) {
if (header == null) {
return null;
}
Parameter headerParam = new Parameter();
headerParam.setName(headerName);
headerParam.setIn("header");
headerParam.setDescription(header.getDescription());
headerParam.setRequired(header.getRequired());
headerParam.setDeprecated(header.getDeprecated());
Header.StyleEnum style = header.getStyle();
if (style != null) {
headerParam.setStyle(Parameter.StyleEnum.valueOf(style.name()));
}
headerParam.setExplode(header.getExplode());
headerParam.setSchema(header.getSchema());
headerParam.setExamples(header.getExamples());
headerParam.setExample(header.getExample());
headerParam.setContent(header.getContent());
headerParam.setExtensions(header.getExtensions());
CodegenParameter param = fromParameter(headerParam, imports);
param.setContent(getContent(headerParam.getContent(), imports, mediaTypeSchemaSuffix));
return param;
}
protected LinkedHashMap<String, CodegenMediaType> getContent(Content content, Set<String> imports, String mediaTypeSchemaSuffix) {
if (content == null) {
return null;
}
LinkedHashMap<String, CodegenMediaType> cmtContent = new LinkedHashMap<>();
for (Entry<String, MediaType> contentEntry: content.entrySet()) {
MediaType mt = contentEntry.getValue();
LinkedHashMap<String, CodegenEncoding> ceMap = null;
if (mt.getEncoding() != null ) {
ceMap = new LinkedHashMap<>();
Map<String, Encoding> encMap = mt.getEncoding();
for (Entry<String, Encoding> encodingEntry: encMap.entrySet()) {
Encoding enc = encodingEntry.getValue();
List<CodegenParameter> headers = new ArrayList<>();
if (enc.getHeaders() != null) {
Map<String, Header> encHeaders = enc.getHeaders();
for (Entry<String, Header> headerEntry: encHeaders.entrySet()) {
String headerName = headerEntry.getKey();
Header header = ModelUtils.getReferencedHeader(this.openAPI, headerEntry.getValue());
CodegenParameter param = heeaderToCodegenParameter(header, headerName, imports, mediaTypeSchemaSuffix);
headers.add(param);
}
}
CodegenEncoding ce = new CodegenEncoding(
enc.getContentType(),
headers,
enc.getStyle().toString(),
enc.getExplode().booleanValue(),
enc.getAllowReserved().booleanValue()
);
String propName = encodingEntry.getKey();
ceMap.put(propName, ce);
}
}
String contentType = contentEntry.getKey();
CodegenProperty schemaProp = fromProperty(toMediaTypeSchemaName(contentType, mediaTypeSchemaSuffix), mt.getSchema());
CodegenMediaType codegenMt = new CodegenMediaType(schemaProp, ceMap);
cmtContent.put(contentType, codegenMt);
}
return cmtContent;
}
public CodegenParameter fromRequestBody(RequestBody body, Set<String> imports, String bodyParameterName) {
if (body == null) {
LOGGER.error("body in fromRequestBody cannot be null!");
@@ -6580,6 +6698,7 @@ public class DefaultCodegen implements CodegenConfig {
if (schema == null) {
throw new RuntimeException("Request body cannot be null. Possible cause: missing schema in body parameter (OAS v2): " + body);
}
codegenParameter.setContent(getContent(body.getContent(), imports, "RequestBody"));
if (StringUtils.isNotBlank(schema.get$ref())) {
name = ModelUtils.getSimpleRef(schema.get$ref());
@@ -6590,6 +6709,7 @@ public class DefaultCodegen implements CodegenConfig {
ModelUtils.syncValidationProperties(unaliasedSchema, codegenParameter);
codegenParameter.setTypeProperties(unaliasedSchema);
codegenParameter.setComposedSchemas(getComposedSchemas(unaliasedSchema));
// TODO in the future switch al the below schema usages to unaliasedSchema
// because it keeps models as refs and will not get their referenced schemas
if (ModelUtils.isArraySchema(schema)) {
@@ -6633,6 +6753,8 @@ public class DefaultCodegen implements CodegenConfig {
} else if (ModelUtils.isObjectSchema(schema)) {
// object type schema OR (AnyType schema with properties defined)
this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, false);
} else {
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
}
addVarsRequiredVarsAdditionalProps(schema, codegenParameter);
} else {
@@ -6956,7 +7078,7 @@ public class DefaultCodegen implements CodegenConfig {
cm.name = type;
cm.classname = type;
cm.vendorExtensions.put("x-is-one-of-interface", true);
cm.interfaceModels = new ArrayList<CodegenModel>();
cm.interfaceModels = new ArrayList<>();
addOneOfInterfaces.add(cm);
}
@@ -7154,4 +7276,30 @@ public class DefaultCodegen implements CodegenConfig {
protected String getCollectionFormat(CodegenParameter codegenParameter) {
return null;
}
private CodegenComposedSchemas getComposedSchemas(Schema schema) {
if (!(schema instanceof ComposedSchema)) {
return null;
}
ComposedSchema cs = (ComposedSchema) schema;
return new CodegenComposedSchemas(
getComposedProperties(cs.getAllOf(), "allOf"),
getComposedProperties(cs.getOneOf(), "oneOf"),
getComposedProperties(cs.getAnyOf(), "anyOf")
);
}
private List<CodegenProperty> getComposedProperties(List<Schema> xOfCollection, String collectionName) {
if (xOfCollection == null) {
return null;
}
List<CodegenProperty> xOf = new ArrayList<>();
int i = 0;
for (Schema xOfSchema: xOfCollection) {
CodegenProperty cp = fromProperty(collectionName + "_" + i, xOfSchema);
xOf.add(cp);
i += 1;
}
return xOf;
}
}

View File

@@ -268,7 +268,11 @@ public class DefaultGenerator implements Generator {
URL url = URLPathUtils.getServerURL(openAPI, config.serverVariableOverrides());
contextPath = removeTrailingSlash(config.escapeText(url.getPath())); // for backward compatibility
basePathWithoutHost = contextPath;
basePath = removeTrailingSlash(config.escapeText(URLPathUtils.getHost(openAPI, config.serverVariableOverrides())));
if (URLPathUtils.isRelativeUrl(openAPI.getServers())) {
basePath = removeTrailingSlash(basePathWithoutHost);
} else {
basePath = removeTrailingSlash(config.escapeText(URLPathUtils.getHost(openAPI, config.serverVariableOverrides())));
}
}
private void configureOpenAPIInfo() {

View File

@@ -145,6 +145,14 @@ public interface IJsonSchemaValidationProperties {
void setIsAnyType(boolean isAnyType);
CodegenComposedSchemas getComposedSchemas();
void setComposedSchemas(CodegenComposedSchemas composedSchemas);
boolean getHasMultipleTypes();
void setHasMultipleTypes(boolean hasMultipleTypes);
/**
* Syncs all the schema's type properties into the IJsonSchemaValidationProperties instance
* for now this only supports types without format information

View File

@@ -129,6 +129,6 @@ public class SpecValidationException extends RuntimeException {
});
return super.getMessage() + " | " +
"Error count: " + errorCount + ", Warning count: " + warningCount + sb.toString();
"Error count: " + errorCount + ", Warning count: " + warningCount + sb;
}
}

View File

@@ -103,7 +103,7 @@ public class TemplateManager implements TemplatingExecutor, TemplateProcessor {
* @param name The location of the template
* @return The raw template contents
*/
@SuppressWarnings({"java:S112"})
@SuppressWarnings("java:S112")
// ignored rule java:S112 as RuntimeException is used to match previous exception type
public String readTemplate(String name) {
if (name == null || name.contains("..")) {

View File

@@ -26,7 +26,7 @@ public class TemplatingEngineLoader {
throw new IllegalStateException("Utility class");
}
@SuppressWarnings({"java:S112"}) // ignore java:S112 as generic RuntimeException is acceptable here
@SuppressWarnings("java:S112") // ignore java:S112 as generic RuntimeException is acceptable here
public static TemplatingEngineAdapter byIdentifier(String id) {
ServiceLoader<TemplatingEngineAdapter> loader = ServiceLoader.load(TemplatingEngineAdapter.class, TemplatingEngineLoader.class.getClassLoader());
@@ -42,7 +42,7 @@ public class TemplatingEngineLoader {
// Attempt to load skipping SPI
return (TemplatingEngineAdapter) Class.forName(id).getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw new RuntimeException(String.format(Locale.ROOT, "Couldn't load template engine adapter %s. Available options: %n%s", id, sb.toString()), e);
throw new RuntimeException(String.format(Locale.ROOT, "Couldn't load template engine adapter %s. Available options: %n%s", id, sb), e);
}
}
}

View File

@@ -534,9 +534,17 @@ public class CodegenConfigurator {
if (validationMessages.size() > 0) {
Set<String> warnings = new HashSet<>();
if (specification != null) {
List<String> unusedModels = ModelUtils.getUnusedSchemas(specification);
if (unusedModels != null) {
unusedModels.forEach(name -> warnings.add("Unused model: " + name));
// Wrap the getUnusedSchemas() in try catch block so it catches the NPE
// when the input spec file is not correct
try{
List<String> unusedModels = ModelUtils.getUnusedSchemas(specification);
if (unusedModels != null) {
unusedModels.forEach(name -> warnings.add("Unused model: " + name));
}
} catch (Exception e){
System.err.println("[error] There is an error with OpenAPI specification parsed from the input spec file: " + inputSpec);
System.err.println("[error] Please make sure the spec file has correct format and all required fields are populated with valid value.");
}
}

View File

@@ -165,7 +165,7 @@ public class ExampleGenerator {
}
} else if (modelName != null && mediaType.startsWith(MIME_TYPE_XML)) {
final Schema schema = this.examples.get(modelName);
String example = new XmlExampleGenerator(this.examples).toXml(schema, 0, Collections.<String>emptySet());
String example = new XmlExampleGenerator(this.examples).toXml(schema, 0, Collections.emptySet());
if (example != null) {
kv.put(EXAMPLE, example);
output.add(kv);

View File

@@ -44,7 +44,7 @@ public class XmlExampleGenerator {
}
public String toXml(Schema schema) {
return toXml(null, schema, 0, Collections.<String>emptySet());
return toXml(null, schema, 0, Collections.emptySet());
}
protected String toXml(Schema schema, int indent, Collection<String> path) {

View File

@@ -41,7 +41,7 @@ public class RootedFileRule extends Rule {
}
private String getExtensionPart(final String input, int stopIndex) {
return input.substring(stopIndex > 0 ? stopIndex+1: input.length(), input.length());
return input.substring(stopIndex > 0 ? stopIndex+1: input.length());
}
@Override

View File

@@ -50,7 +50,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
protected List<Map<String, Object>> orderedModels;
protected final Map<String, List<String>> modelDepends;
protected final Map<String, String> nullableTypeMapping;
protected final HashMap<String, String> operationsScopes;
protected final Map<String, String> operationsScopes;
protected int scopeIndex = 0;
public AbstractAdaCodegen() {
@@ -155,7 +155,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
"xor")
);
typeMapping = new HashMap<String, String>();
typeMapping = new HashMap<>();
typeMapping.put("date", "Swagger.Date");
typeMapping.put("DateTime", "Swagger.Datetime");
typeMapping.put("string", "Swagger.UString");
@@ -172,7 +172,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
typeMapping.put("binary", "Swagger.Binary");
// Mapping to convert an Ada required type to an optional type (nullable).
nullableTypeMapping = new HashMap<String, String>();
nullableTypeMapping = new HashMap<>();
nullableTypeMapping.put("Swagger.Date", "Swagger.Nullable_Date");
nullableTypeMapping.put("Swagger.Datetime", "Swagger.Nullable_Date");
nullableTypeMapping.put("Swagger.UString", "Swagger.Nullable_UString");
@@ -181,10 +181,10 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
nullableTypeMapping.put("Boolean", "Swagger.Nullable_Boolean");
nullableTypeMapping.put("Swagger.Object", "Swagger.Object");
modelDepends = new HashMap<String, List<String>>();
orderedModels = new ArrayList<Map<String, Object>>();
operationsScopes = new HashMap<String, String>();
super.importMapping = new HashMap<String, String>();
modelDepends = new HashMap<>();
orderedModels = new ArrayList<>();
operationsScopes = new HashMap<>();
super.importMapping = new HashMap<>();
// CLI options
addOption(CodegenConstants.PROJECT_NAME, "GNAT project name",
@@ -193,7 +193,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
modelNameSuffix = "Type";
embeddedTemplateDir = templateDir = "Ada";
languageSpecificPrimitives = new HashSet<String>(
languageSpecificPrimitives = new HashSet<>(
Arrays.asList("integer", "boolean", "number", "long", "float",
"double", "object", "string", "date", "DateTime", "binary"));
}
@@ -651,7 +651,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
Object v = model.get("model");
if (v instanceof CodegenModel) {
CodegenModel m = (CodegenModel) v;
List<String> d = new ArrayList<String>();
List<String> d = new ArrayList<>();
for (CodegenProperty p : m.vars) {
boolean isModel = false;
CodegenProperty item = p;
@@ -687,8 +687,8 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
// if I find a model that has no dependencies, or all of its dependencies are in revisedOrderedModels, consider it the independentModel
// put the independentModel at the end of revisedOrderedModels, and remove it from orderedModels
//
List<Map<String, Object>> revisedOrderedModels = new ArrayList<Map<String, Object>>();
List<String> collectedModelNames = new ArrayList<String>();
List<Map<String, Object>> revisedOrderedModels = new ArrayList<>();
List<String> collectedModelNames = new ArrayList<>();
int sizeOrderedModels = orderedModels.size();
for (int i = 0; i < sizeOrderedModels; i++) {
Map<String, Object> independentModel = null;
@@ -760,7 +760,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
* @return the authMethods to be used by the operation with its required scopes.
*/
private List<CodegenSecurity> postProcessAuthMethod(List<CodegenSecurity> authMethods, Map<String, List<String>> scopes) {
List<CodegenSecurity> result = (scopes == null) ? null : new ArrayList<CodegenSecurity>();
List<CodegenSecurity> result = (scopes == null) ? null : new ArrayList<>();
if (authMethods != null) {
for (CodegenSecurity authMethod : authMethods) {
if (authMethod.scopes != null) {
@@ -803,7 +803,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
opSecurity.isKeyInQuery = authMethod.isKeyInQuery;
opSecurity.flow = authMethod.flow;
opSecurity.tokenUrl = authMethod.tokenUrl;
List<Map<String, Object>> opAuthScopes = new ArrayList<Map<String, Object>>();
List<Map<String, Object>> opAuthScopes = new ArrayList<>();
for (String opScopeName : opScopes) {
for (Map<String, Object> scope : authMethod.scopes) {
String name = (String) scope.get("scope");

View File

@@ -81,9 +81,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
protected boolean supportNullable = Boolean.FALSE;
// nullable type
protected Set<String> nullableType = new HashSet<String>();
protected Set<String> nullableType = new HashSet<>();
protected Set<String> valueTypes = new HashSet<String>();
protected Set<String> valueTypes = new HashSet<>();
private final Logger LOGGER = LoggerFactory.getLogger(AbstractCSharpCodegen.class);
@@ -104,14 +104,14 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
outputFolder = "generated-code" + File.separator + this.getName();
embeddedTemplateDir = templateDir = this.getName();
collectionTypes = new HashSet<String>(
collectionTypes = new HashSet<>(
Arrays.asList(
"IList", "List",
"ICollection", "Collection",
"IEnumerable")
);
mapTypes = new HashSet<String>(
mapTypes = new HashSet<>(
Arrays.asList("IDictionary")
);
@@ -141,7 +141,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
);
// TODO: Either include fully qualified names here or handle in DefaultCodegen via lastIndexOf(".") search
languageSpecificPrimitives = new HashSet<String>(
languageSpecificPrimitives = new HashSet<>(
Arrays.asList(
"String",
"string",
@@ -184,7 +184,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
// Nullable types here assume C# 2 support is not part of base
typeMapping = new HashMap<String, String>();
typeMapping = new HashMap<>();
typeMapping.put("string", "string");
typeMapping.put("binary", "byte[]");
typeMapping.put("ByteArray", "byte[]");
@@ -207,11 +207,11 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
typeMapping.put("AnyType", "Object");
// nullable type
nullableType = new HashSet<String>(
nullableType = new HashSet<>(
Arrays.asList("decimal", "bool", "int", "float", "long", "double", "DateTime", "DateTimeOffset", "Guid")
);
// value Types
valueTypes = new HashSet<String>(
valueTypes = new HashSet<>(
Arrays.asList("decimal", "bool", "int", "float", "long", "double")
);
}
@@ -463,9 +463,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
*
* @param models processed models to be further processed for enum references
*/
@SuppressWarnings({"unchecked"})
@SuppressWarnings("unchecked")
private void postProcessEnumRefs(final Map<String, Object> models) {
Map<String, CodegenModel> enumRefs = new HashMap<String, CodegenModel>();
Map<String, CodegenModel> enumRefs = new HashMap<>();
for (Map.Entry<String, Object> entry : models.entrySet()) {
CodegenModel model = ModelUtils.getModelByName(entry.getKey(), models);
if (model.isEnum) {
@@ -1325,7 +1325,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
// only process files with .cs extension
if ("cs".equals(FilenameUtils.getExtension(file.toString()))) {
String command = csharpPostProcessFile + " " + file.toString();
String command = csharpPostProcessFile + " " + file;
try {
Process p = Runtime.getRuntime().exec(command);
int exitValue = p.waitFor();

View File

@@ -323,7 +323,7 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
}
// only process files with cpp extension
if ("cpp".equals(FilenameUtils.getExtension(file.toString())) || "h".equals(FilenameUtils.getExtension(file.toString()))) {
String command = cppPostProcessFile + " " + file.toString();
String command = cppPostProcessFile + " " + file;
try {
Process p = Runtime.getRuntime().exec(command);
p.waitFor();

View File

@@ -340,7 +340,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
// replace all characters that have a mapping but ignore underscores
// append an underscore to each replacement so that it can be camelized
if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) {
if (name.chars().anyMatch(character -> specialCharReplacements.containsKey(String.valueOf((char) character)))) {
name = escape(name, specialCharReplacements, Collections.singletonList("_"), "_");
}
// remove the rest
@@ -505,7 +505,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
super.postProcessModelProperty(model, property);
if (!model.isEnum && property.isEnum) {
// These are inner enums, enums which do not exist as models, just as properties.
// They are handled via the enum_inline template and and are generated in the
// They are handled via the enum_inline template and are generated in the
// same file as the containing class. To prevent name clashes the inline enum classes
// are prefix with the classname of the containing class in the template.
// Here the datatypeWithEnum template variable gets updated to match that scheme.
@@ -529,9 +529,9 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, List<Server> servers) {
final CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers);
for (CodegenResponse r : op.responses) {
// By default only set types are automatically added to operation imports, not sure why.
// By default, only set types are automatically added to operation imports, not sure why.
// Add all container type imports here, by default 'dart:core' imports are skipped
// but other sub classes may required specific container type imports.
// but other sub-classes may require specific container type imports.
if (r.containerType != null && typeMapping().containsKey(r.containerType)) {
final String value = typeMapping().get(r.containerType);
if (needToImport(value)) {
@@ -752,7 +752,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
// process all files with dart extension
if ("dart".equals(FilenameUtils.getExtension(file.toString()))) {
// currently supported is "dartfmt -w" and "dart format"
String command = dartPostProcessFile + " " + file.toString();
String command = dartPostProcessFile + " " + file;
try {
Process p = Runtime.getRuntime().exec(command);
int exitValue = p.waitFor();

View File

@@ -53,9 +53,9 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
"redefine", "rename", "require", "rescue", "Result", "retry", "select", "separate", "then", "True",
"TUPLE", "undefine", "until", "variant", "Void", "when", "xor"));
defaultIncludes = new HashSet<String>(Arrays.asList("map", "array"));
defaultIncludes = new HashSet<>(Arrays.asList("map", "array"));
languageSpecificPrimitives = new HashSet<String>(
languageSpecificPrimitives = new HashSet<>(
Arrays.asList("BOOLEAN", "INTEGER_8", "INTEGER_16", "INTEGER_32", "INTEGER_64", "NATURAL_8",
"NATURAL_16", "NATURAL_32", "NATURAL_64", "REAL_32", "REAL_64"));
@@ -559,7 +559,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
}
public Map<String, String> createMapping(String key, String value) {
Map<String, String> customImport = new HashMap<String, String>();
Map<String, String> customImport = new HashMap<>();
customImport.put(key, value);
return customImport;
@@ -592,7 +592,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
public String toEiffelFeatureStyle(String operationId) {
if (operationId.startsWith("get_")) {
return operationId.substring(4, operationId.length());
return operationId.substring(4);
} else {
return operationId;
}

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