Compare commits

..

171 Commits

Author SHA1 Message Date
William Cheng
c317c753f0 comment out to speed up tests 2021-05-05 17:02:05 +08:00
William Cheng
d0a427a84c add elm client test 2021-05-05 17:01:50 +08:00
Julian G
8f5639554e [C++] [Pistache] Model validation, general overhaul (#9251)
* overhaul pistache templates

* fix function signature in model-source
return type now aligns with definition in model-header

* use default keyword for destructors

* generate pistache samples

* move bin/configs/other/cpp-pistache-server-cpp-pistache.yaml to bin/configs/cpp-pistache-server-cpp-pistache.yaml

* Only generate validation body if necessary

* generate pistache samples
2021-05-05 16:52:47 +08:00
shylacs
4d2b022619 Add VMware to users list (#9388)
* Add VMware to users list

LMK if I can provide the png for company logo. I tried uploading to img folder and could not.

* add logo, update readme

Co-authored-by: William Cheng <wing328hk@gmail.com>
2021-05-05 00:08:15 +08:00
Luca Mazzanti
e9fa936886 [csharp][netcore-httpclient] Refactor of constructors: removed obsolete attribute (#9373)
* Removed obsolete attribute on constructors without HttpClient prameter

* add clickable link in the tooltip

* update doc, add tests

Co-authored-by: William Cheng <wing328hk@gmail.com>
2021-05-04 23:58:20 +08:00
Stefan Wendt
d21743e9e5 [TypeScript-fetch] Fix issue 9360 (#9362)
* [TypeScript] Fix misplaced parentheses

* [TypeScript] Run PR relevant scripts

* [TypeScript] ensure up to date

* Revert "[TypeScript] ensure up to date"

This reverts commit 320ec45f

* Revert "[TypeScript] Run PR relevant scripts"

This reverts commit 23cda753

Co-authored-by: Stefan Wendt <stefan.wendt@isax.com>
2021-05-03 18:15:52 +02:00
Matthew
3da1999135 Fix typo in readme (#9387) 2021-05-03 22:45:55 +08:00
johnthagen
a88313c40c [Python] Avoid DeprecationWarning in inspect.getargspec on Python 3 (#9271)
* Avoid DeprecationWarning in inspect.getargspec on Python 3

* Regenerate samples
2021-04-30 11:59:33 -07:00
ex0ns
ebc1d7bd95 [scala][akka] Update dependencies for scala 2.13 in scala-akka (#8624)
* [scala][akka] Update dependencies for scala 2.13

* Update pom.mustache to support multiple scala's version

* Update pom.xml

* Scala cross build 2.12 and 2.13

* Update version. Migrate to sbt

* Remove space

* Add pom.xml back
2021-04-29 18:51:30 +08:00
Anders Aaen Springborg
dbb42f9027 [BUG] new.sh fix generator type , issue #9320 (#9321)
* generation type on  template dir path

* remove gen_type from template and resources
2021-04-29 18:23:13 +08:00
William Cheng
18cdb36d3e [Test] Migrate samples from 2.0 Spec to 3.0 spec (#9347)
* nim petstore to use 3.0 spec

* ktorm to use 3.0 spec

* update c petstore to use 3.0 spec

* Revert "update c petstore to use 3.0 spec"

This reverts commit a8ff0517ba.
2021-04-29 10:23:55 +08:00
William Cheng
5d946289ef Bump OkHTTP dependency to latest in build.sbt (#9361) 2021-04-28 22:36:29 +08:00
Ayman Bagabas
057c1080f8 [Codegen] Add hasDefaultResponse property (#9203)
Check if there's a default response in the specs.
2021-04-28 17:03:22 +08:00
Toby Murray
83adc064a4 Fixes #9151: Bump OkHTTP dependency to latest (#9353)
In 5.0.1 the generated line in `ApiClient` was:
```
return RequestBody.create(MediaType.parse(contentType), (byte[]) obj);
```
in 5.1.0 it is:
```
return RequestBody.create((byte[]) obj, MediaType.parse(contentType));
```

Looks like this change was introduced in #8969, and requires a more recent version of OkHttp to compile in some (all?) circumstances.
2021-04-28 16:55:12 +08:00
Andre Praca
ad9e2395ac [PHP] Fix parentSchema conditional causing parent call when parent isn't present (#8705)
* Fix parentSchema conditional

we cannot call `parent::` if parent isn't present. Everywhere else in the schema we're checking for `{{parentSchema}}` but here we're checking for `{{parent}}` which is causing errors when parent is not present

* Update samples
2021-04-28 15:08:50 +08:00
William Cheng
4aaaae765b [Scala][Akka] Use Files.createTempFile to address security concerns (#9348)
* fix scala akka server temp file issue

* update test templates
2021-04-28 14:53:51 +08:00
Toby Murray
4f84e86001 Support #9151: Default Java client to Java 8 (#9344)
My understanding of the version 5 release of OpenAPI generator was that Java 7 support was dropped. Currently the Java client defaults to Java 7, Java 8 can be opted in with the `java8` config option. This removes the conditional logic in `build.gradle` around that config option and defaults to Java 8. This is to support #9151, up-to-date dependency versions rely on Java 8 and it's easier if that is the default.

To be clear, this changes behavior - previous default version was Java 7, this changes it to Java 8.
2021-04-27 09:37:14 +08:00
dependabot[bot]
1f880f43d4 Bump actions/setup-java from v1 to v2 (#9187)
Bumps [actions/setup-java](https://github.com/actions/setup-java) from v1 to v2.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/v1...8764a52df183aa0ccea74521dfd9d506ffc7a19a)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-26 22:35:17 +08:00
William Cheng
ad3ecadd75 Move ensure up-to-date script to drone.io (#9339)
* move ensure up-to-date to drone.io

* fix tests

* Revert "fix tests"

This reverts commit ea5efd3b3b.

* skip 2.0 tests

* use mvnw

* fail fast

* fix meta-codegen

* test java 11 first
2021-04-26 22:08:49 +08:00
dersvenhesse
a62d22593e [DOCS] Updated pom.xml snippet with latest version (#9342) 2021-04-26 16:41:45 +08:00
William Cheng
f572125b30 [Python] Fix exclusive min and max (#9340)
* [Python] Fix exclusiveMinimum and exclusiveMaximum conditions

* add tests, update samples

Co-authored-by: Jiri Kuncar <jiri.kuncar@gmail.com>
2021-04-26 14:01:40 +08:00
Yuriy Belenko
b6197dd859 [core] Add refreshUrl to CodegenSecurity (#9210)
* Add refreshUrl to CodegenSecurity

Ref:
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#oauth-flow-object

* Add refreshUrl to setOauth2Info method
2021-04-26 10:33:18 +08:00
William Cheng
7df0f56fdc update samples 2021-04-26 10:21:48 +08:00
Ayman Bagabas
f7c3773903 Swift5 use json type for any (#9206)
* [swift5] Fix additionalProps inner type

* [swift5] Add and use AnyCodable type instead of any

* [swift5] Use the original petstore w/fake models for testing default

* [swift5] Update swift-tools-version to 5.1

* [swift5] Update samples and docs
2021-04-26 09:57:42 +08:00
Mateusz Hubert Stefaniak
b9a1c8f016 [Java][Spring] Fix for #8659 - Different in-parameter types generated for api and delegate for files (#9331) 2021-04-26 09:49:21 +08:00
Sai Giridhar P
812d563c78 [Java][Jersey2]: Fixing a package import (#9336) 2021-04-26 09:15:49 +08:00
Ayman Bagabas
0f5e7d1e3c Swift5 models improvements (#9205)
* [swift5] Add useClasses to use `final class` instead of `struct`

* [swift5] Always include CodingKeys enum

* [swift5] Implement model equals and hash functions

* [swift5] Encode `null` values

* [swift5] Test `useClasses` in urlsessionLibrary

* [swift5] Add a required nullable prop test case to 2_0/swift/petstore*.yaml

* [swift5] Update samples and docs
2021-04-24 10:04:30 +08:00
Stefan Hanselmann
22950fa2b2 [Kotlin][#9313] Generator should support optional form parameter (#9314)
* [Kotlin][#9313] Make form params optional in Kotlin retrofit2 template.

* [Kotlin][#9313] Update sample files.

* [Kotlin] [#9313] Remove new line at the end of the mustache template
2021-04-23 12:30:58 +08:00
William Cheng
ee905cf0fe add the u of aizu to the user list (#9326) 2021-04-23 12:11:57 +08:00
William Cheng
ab688d4c3a Update documentation (#9322)
* update doc

* update doc
2021-04-22 20:54:01 +08:00
William Cheng
05aa956fe1 update samples 2021-04-22 19:20:11 +08:00
Ayman Bagabas
33107c14de [Swift5] escape reserved words (#9204)
* [swift5] `List` is not a Swift data type

* [swift5] Escape reserved words using backticks

https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID412

* [swift5] Update tests

* [swift5] Update samples and docs
2021-04-22 19:13:39 +08:00
Stefan Hanselmann
5468b22b83 [Kotlin][#7925] Make ApiClient in jvm-retrofit2 be able to add additional retrofit Converter.Factory (#9316)
* [Kotlin][#7925] Add an optional Converter.Factory to the Kotlin retrofit2 ApiClient template.

* [Kotlin][#7925] Update sample project.
2021-04-22 19:07:55 +08:00
Stefan Hanselmann
05f329959c [Kotlin][#9317] Add parameter sorting to Kotlin client generator (as used in the Java generator). (#9318) 2021-04-22 18:48:26 +08:00
William Cheng
946d145d30 [bash] Update Bash Client Dockerfile.mustache (#9310)
* Update Dockerfile.mustache

Using alpine instead of ubuntu for leaner Docker images.

Small fix for welcome message.

Changing default shell to `zsh` and fixing entrypoint.

* update samples

* move config, add new files

Co-authored-by: avbenavides <62693723+avbenavides@users.noreply.github.com>
2021-04-22 15:02:38 +08:00
William Cheng
d7736366b7 add a link to twilio blog (#9312) 2021-04-22 12:28:17 +08:00
William Cheng
d44d9a3907 Add a link to blog post in unibuddy tech blog (#9311)
* Add a link to blog post in unibuddy tech blog

* minor change

* fix link
2021-04-22 12:17:07 +08:00
dependabot[bot]
347a4cef47 Bump actions/upload-artifact from v2.2.2 to v2.2.3 (#9198)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from v2.2.2 to v2.2.3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2.2.2...ee69f02b3dfdecd58bb31b4d133da38ba6fe3700)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-22 08:44:07 +08:00
dependabot[bot]
b38166305f Bump actions/cache from v2.1.4 to v2.1.5 (#9249)
Bumps [actions/cache](https://github.com/actions/cache) from v2.1.4 to v2.1.5.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2.1.4...1a9e2138d905efd099035b49d8b7a3888c653ca8)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-22 08:38:02 +08:00
Ayman Bagabas
3894aa4759 [swift5] Add useSPMFileStructure (#9074)
* [swift5] Add useSPMFileStructure

Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>

* [swift5] Add swiftPackagePath

Prioritize swiftPackagePath over useSPMFileStructure

* [swift5] Add cli options and update docs

* [swift5] Fix tests

* [swift5] Update XcodeGen source path

* [swift5] Update samples and docs

Add useSPMFileStructure to URLSession library
2021-04-22 00:43:33 +08:00
William Cheng
139e9e458f Minor improvements to go-echo server (#9303)
* minor improvements to go-echo server

* update go tech comm
2021-04-21 21:11:05 +08:00
William Cheng
b4f174753c [PS] minor improvements to the auto-generated appveyor.yml (#9300)
* appveyor improvement

* update samples
2021-04-21 18:18:02 +08:00
Farshad Nematdoust
733a180a62 Add Go echo server codegen (#9224)
* Update codegen config

* Add templates for Go Echo openapi-codegen

* Add the yaml config file!

* Add GoEchoServerCodegen.java.
This is the first iteration, it works but probably needs a lot of improvements.

* Update codegen, adds some comments.

* Update GoEchoServerCodegen.java

* Update GoEchoServerCodegen.java

* Update GoEchoServerCodegen.java and related yaml file

* Add the result of generate-samples.sh for CI purposes.

* Add the result of bin/utils/ensure-up-to-date for CI purposes.

* Update go-echo-server-petstore-new.yaml
Fix the outputdir

* Update in regard to result of ./bin/generate-samples.sh

* Update in regard to result of ./bin/generate-samples.sh

* Remove wrongly generated files

* Add correct generated files.

* Add changes regarding /bin/utils/ensure-up-to-date

* Update templates to include comments.

* Update/add result of ./bin/generate-samples.sh and ./bin/utils/export_docs_generators.sh
2021-04-21 16:22:10 +08:00
William Cheng
92561085ba update ruby sinatra samples 2021-04-21 16:00:23 +08:00
Yasuhiro ABE
d4748a7a20 Dockerfile for the Ruby-Sinatra generator (#9299)
* add the Dockerfile and updated the README and others.

Signed-off-by: Yasuhiro ABE <yasu-abe@u-aizu.ac.jp>

* fixed the indent to follow the coding style guide.

Signed-off-by: Yasuhiro ABE <yasu-abe@u-aizu.ac.jp>

* revised.

Signed-off-by: Yasuhiro ABE <yasu-abe@u-aizu.ac.jp>
2021-04-21 15:46:56 +08:00
William Cheng
ebc98ec848 [PowerShell] improve return type documentation (#9295)
* revise return type doc

* revise return type doc
2021-04-21 10:01:41 +08:00
Sean Kelly
ef2299ad65 Qt5 support date format enum (#9283)
* initial commit

* Update sample and make sure it builds

* PR feedback

* Limit scope of struct to within the class and fix whitespace
2021-04-21 09:55:30 +08:00
William Cheng
41f586bede update cpp ue4 samples 2021-04-20 21:47:12 +08:00
Josh Wittner
28e0d9b22e Support FGuid with helpers (#9291) 2021-04-20 21:23:36 +08:00
William Cheng
51028f0c1b prevent NPE in constructing oneOf example (#9231) 2021-04-20 15:05:34 +08:00
Esteban Gehring
aa5adbf3f5 update samples (#9288) 2021-04-19 08:11:00 +02:00
William Cheng
da37e980d3 [Kotlin]] add support for binary response (#9284)
* Support File responses for Kotlin client

* Regen samples

* Reset version

* Fix file class check

* Add imports

* use Files.createTempFile instead

* better tmp file naming

Co-authored-by: Mischa Spiegelmock <me@mish.dev>
2021-04-17 18:25:32 +08:00
William Cheng
77dfd40681 [Enhancement] added support for custom type & format mapping (#9285)
* resolve merge conflicts

* use + in type mapping, add tests

* add new test spec
2021-04-17 18:24:59 +08:00
Themi Tsiotas von Pfaler
a9c7644c32 [typescript-axios] add missing baseName when using set or append on FormData (#9273) 2021-04-17 09:14:55 +02:00
Emmanuel Roux
032911990d typescript-angular: Fix Cannot read property 'apiKey' of undefined (#9260)
* fix #9259

* avoid optional chaining operator
2021-04-16 16:54:58 +02:00
Cody Mikol
b5dac42959 feat(adapter): add BigDecimal kotlin support (#8880)
* feat(adapter): add BigDecimal kotlin support

this allows the kotlin client generator to support
BigDecimal values

Fixes #7196

* update samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2021-04-16 22:24:10 +08:00
Luca Mazzanti
3929afff7d [csharp][netcore-httpclient] Refactor of constructors (#9145)
* Refactor on constructors

Updated samples

Fixed a bug of previous commit

Refactor on constructors

* Fixed indentation in source code

* Updated samples

* Marked constructors with obsolete

* Updated obsolete constructors messages

* Updated samples
2021-04-16 22:03:07 +08:00
William Cheng
515d4a0153 [Java][JavaJaxRS] Respect readOnly/writeOnly attribute markers (#9276)
* [Java] [JavaJaxRS] Respect readOnly/writeOnly attribute markers

Generate jackson JsonProperty like following:
- `readOnly` is present in Spec: `@JsonProperty(value = "[name]", access = JsonProperty.Access.READ_ONLY)`
- `writeOnly` is present in Spec: `@JsonProperty(value = "[name]", access = JsonProperty.Access.WRITE_ONLY)`

Edge case: both are present -> Spec is invalid and generator cancels anyway with:
> org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
> | Error count: 1, Warning count: 1
> Errors: 
>	-attribute components.schemas.Example. writeOnly and readOnly are both present

* update samples

Co-authored-by: Michael Kroll <9883575+mickroll@users.noreply.github.com>
2021-04-16 18:07:41 +08:00
Christopher Schramm
4a63aae746 [Kotlin] Fix (de)serialization of enum classes (#7917)
While inner enum classes from dataClass.mustache work fine, standalone enum classes lack `@JsonProperty` annotations so that Jackson uses names instead of values.
2021-04-16 12:01:05 +08:00
Moshe Elisha
af992e4b29 [Java] [Native] Add response body to exception message (#9169)
* Fix #8027 - import the auto generated supporting JSON class only when generateSupportingFiles is true

* Fix #8027 - import the auto generated supporting JSON class only when generateSupportingFiles is true

* Fix #8027 - import the auto generated supporting JSON class only when generateSupportingFiles is true

* Revert "Fix #8027 - import the auto generated supporting JSON class only when generateSupportingFiles is true"

This reverts commit 56e2b1fb

* Revert "Fix #8027 - import the auto generated supporting JSON class only when generateSupportingFiles is true"

This reverts commit 335c304d

* Fix #8027 - import the auto generated supporting JSON class only when generateSupportingFiles is true

* Fix #8027 - import the auto generated supporting JSON class only when discriminator is needed

* Fix #8027 - import the auto generated supporting JSON class only when discriminator is needed

* Fix #8027 - import the auto generated supporting JSON class only when discriminator is needed

* [Java] [Native] Add response body to exception message

* [Java] [Native] Use default base URI if baseUri param is null

* [Java] [Native] Use default base URI if baseUri param is null
2021-04-16 11:02:56 +08:00
Stieglitz
6dce8179de [Kotlin] Fix (de)serialization of enum classes (kotlinx serialization) (#9143)
* fix kotlin enum serialization

* fix kotlin serialization compiler warning

* change samples
2021-04-16 10:46:51 +08:00
jenswet-el
786458e928 Add missing ResponseBody import (#9239) 2021-04-16 10:11:04 +08:00
Thomas Hervé
60dcf8613f Don't include read-only properties in Python examples. (#9252)
* Don't include read-only properties in Python examples.

When using a schema with read-only fields as API inputs, Python
generates examples for those: this excludes them.

* Fix tests
2021-04-14 11:43:28 -07:00
Vincent Galloy
9edf70e980 @Input and @Internal should not be apply on the same property (#9059)
Motivation:

In Gradle 7.0 apply @Input and @Internal on property is forbidden.
Before Gradle 7.0 applying both on the same property is confusing. According to the documentation:

* @Input: Attached to a task property to indicate that the property specifies some input value for the task.
* @Internal: Attached to a task property to indicate that the property is not to be taken into account for up-to-date checking
2021-04-14 17:02:48 +08:00
William Cheng
dbdb6c51c4 fix missing space in bash script 2021-04-14 16:55:12 +08:00
William Cheng
19b68f75de [Docker] support multi-arch build (#9246)
* multi arch build

* fix buildx

* use openjdk

* fix bash install

* remove armv7

* remove arm64

* use jre 11

* add v8

* skip bash install

* add back tests

* remove v8

* minor change

* fix tag and push

* fix tag

* skip pull request for dockerhub push
2021-04-14 11:15:12 +08:00
William Cheng
c285f393b0 switch to oas3 spec for php-symfony samples (#9248) 2021-04-14 10:36:48 +08:00
William Cheng
1b63822501 camelize name in nim (#9255) 2021-04-14 10:14:59 +08:00
Peter Leibiger
b4ea00ed42 [dart][dart-dio] Add built_value date support w/o timemachine (#9180)
* [dart][dart-dio] Add built_value date support w/o timemachine

* Test improvements

* Fix lists of dates not working
2021-04-13 16:52:27 +08:00
Eike Starkmann
7a1f7b2270 Update model_variables.mustache (#7074)
Recursive validate non primitive objects
2021-04-13 14:57:50 +08:00
Peter Leibiger
29c1688860 [dart][dart-dio] Update pubspec/readme templates (#9201)
* Add homepage option to pubspec.yaml

package validation fails when trying to publish to pub.dev

See: https://dart.dev/tools/pub/pubspec
Blocking https://github.com/bigpanther/trober/pull/108

cc: @kuhnroyal

* Add missing fields

* Update templates and generate samples

Co-authored-by: Harsimran Singh Maan <maan.harry@gmail.com>
2021-04-13 14:37:15 +08:00
William Cheng
13c0b2c3c7 Use warning instead of throwing exceptions (#9188)
* use warning instead of throwing exceptions

* comment out tests
2021-04-13 14:09:19 +08:00
William Cheng
1f227061c6 add sponsor message in F# giraffe generator (#9247) 2021-04-13 13:50:41 +08:00
Aliaksei Zhuk
53e5986800 [Go] Parse int arrays and respect the 'required' property (#9120)
* Added int arrays parsing in parameters. Respect the 'required' property.

* Replaced spaces with tabs

* Generate samples with new spacing

* Removed unused import

* Merged with latest master
2021-04-11 23:43:53 +08:00
johannes karoff
63fdd3eaf0 support uuid parameter (#9215) 2021-04-11 18:42:00 +08:00
gbmarc1
8e0955fd3c Bug - python client deserialization when attribute named self (#9006)
* fix by mapping outside of class

* tests

* regeneration and tests

* server

* INDENT

* a

* enable mapping

* Revert "server"

This reverts commit 6fc9712fb5.

* Samples regenerated

Co-authored-by: Justin Black <justin.a.black@gmail.com>
2021-04-10 19:00:32 -07:00
William Cheng
14c7f39c2b [C#][netcore] Add multiple frameworks support (#9196)
* add multiple frameworks support

* test in appveyor

* update samples
2021-04-09 21:25:56 +08:00
Guy King
23c9627b98 Resolve response type name conflict in angular typescript lib (#9216)
* fix: rename var

* fix: run pr checklist scripts

* fix: correct response type var name for http client

* chore: run build scripts

* test: ci and correct name?
2021-04-08 21:57:23 +02:00
Esteban Gehring
fa4462ef11 Revert "Resolve responseType name conflict in Angular Typescript lib (#9202)" (#9214)
This reverts commit 9dda4aa2e8.
2021-04-08 18:52:54 +02:00
mazrean
01ff635139 [Go] Fix golang comment typos (#9207)
* fix go comment typo insensitive

* fix go comment typo response

* update samples
2021-04-08 09:59:31 +08:00
Guy King
9dda4aa2e8 Resolve responseType name conflict in Angular Typescript lib (#9202)
* fix: rename var

* fix: run pr checklist scripts
2021-04-07 19:35:20 +02:00
Peter Leibiger
065c0281fa [dart] Improve types & imports (#9167)
* [dart] Improve types & imports

* don't use importMapping as it is intended for something different that is not possible in dart
* introduce imports map for dart specific features
* always import `dart:core`
* get rid of additionalReservedWords
* fix `--type-mappings` not working
* use required type mappings in samples
* no longer define additional reserved words  as it is impossible to list all anyways, they can now be configured via type-mapping parameter
* simplify dio imports

* Don't use guava for map instantiation

* Update docs
2021-04-07 00:33:35 +08:00
HexagonSun
acedd1cfba [typescript-angular] Provide return value for all code paths (#9174) (#9176)
In order to avoid a compiler error when using `noImplicitReturns `, we
change the mustache template to use provide a return value for the if-
and else branch.

Fixes #9174.
2021-04-06 07:21:11 +02:00
Makoto Aoyama
c3b7ecff21 Add Hashable for Struct (#9166)
* Add hashable for struct

* Remove x-swift-hashable

* Run the shell script ./bin/generate-samples.sh
2021-04-06 10:50:23 +08:00
Peter Leibiger
29c131e781 [dart][dart-dio] Update dependencies (#9178)
* finally use released versions for http mocking
2021-04-05 23:39:18 +08:00
Peter Leibiger
11eedc86dc [dart] Remove OS2 samples which have OAS3 counter parts (#9177)
These samples are the same as their OAS3 counterparts and don't give any additional benefits. This should speed up CI builds by a good amount.
2021-04-05 22:59:14 +08:00
Thibault Duperron
4462d35195 Link filehash with execution id (#7848)
Co-authored-by: William Cheng <wing328hk@gmail.com>
2021-04-05 21:11:27 +08:00
Yuri Orlov
659b00a4f9 use standard constant for UTF8 charset in generated java api clients (#7828) 2021-04-05 20:02:28 +08:00
William Cheng
5dae270c3e [Go][server] parse bool in query parameter (#9171)
* Add bool query in example

* Add parseBoolParameter

* test with boolean parameter

* add endpiont for testing boolean

* remove bool parameter test

Co-authored-by: Stéphane Guillemot <gmtstephane@gmail.com>
2021-04-05 16:45:38 +08:00
William Cheng
c79d056935 Allow to specify response headers (needed for redirecting clients) (#9170)
* Allow to specify response headers (needed for redirecting clients) (#8148)

Co-authored-by: Bernardo Pastorelli <13519917+randomswdev@users.noreply.github.com>

* add addResponseHeaders option

* enable addResponseHeaders

* fix comma

Co-authored-by: randomswdev <randomswdev@users.noreply.github.com>
Co-authored-by: Bernardo Pastorelli <13519917+randomswdev@users.noreply.github.com>
2021-04-05 16:27:41 +08:00
Matthew Dowdell
226a8b5f77 Update templating docs to correct the name of x-response-id (#7839) 2021-04-05 11:33:38 +08:00
Hippolyte HENRY
f8202df9aa [go] Add constructor and IsValid method to enum types (#8224)
* Add constructor and IsValid method to enum types

* Add samples
2021-04-04 17:32:17 +08:00
lerminou
7cf6ee1957 [php-symfony] fix double quoting string defaults values (#9126)
quoting for default values is already done in:
https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java#L533
2021-04-04 10:40:16 +08:00
Martin Delille
c9716fcebb Include QVariant helpers header (#9161) 2021-04-04 10:06:57 +08:00
William Cheng
403e9bca44 replace semver versin with just version 2021-04-03 14:46:22 +08:00
Marcono1234
7a3b01a0f6 Update usage.md with current CLI output (#9156) 2021-04-03 11:28:25 +08:00
William Cheng
4db6f46a00 Add links to blog posts about openapi-generator (#9164)
* Add links to blog posts about openapi-generator

* add more articles

* add more article
2021-04-03 11:18:05 +08:00
Justin Black
fc58adee31 Fixes serialization of array items in model_to_dict [python] (#9153)
* Adds tests of endpoint with inline and refed model

* Regen samples

* Samples regenerated
2021-04-01 13:34:19 -07:00
sforst
7bf792a348 [typescript-axios] handle uniqueItems in query and header parameters (#8965)
* [typescript-axios] handle uniqueItems in query and header parameters

add endpoint /fake/test-unique-paramters to petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml for demonstration

* update samples

* [typescript-axios] update samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2021-04-01 16:57:36 +08:00
cal
57e44e173f [cleanup] erefactor/EclipseJdt - Evaluate without null check (#9134)
EclipseJdt cleanup 'EvaluateNullable' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor
2021-04-01 11:32:10 +08:00
de1mos
b335ba834f fix #7325 kotlin-spring fix reactive delegate pattern combination (#8867)
* #7325 kotlin-spring remove exchange field from reactive delegate pattern

* #7325 remove examples from kotlin-spring reactive delegate and add missing import

* #7325 add test assertions

* fix swagger spec in test
2021-04-01 09:47:11 +08:00
Noor Dawod
26ca6ab27e [Dart2] Add initial support to use an isolate to offload JSON serialization/deserialization (#9100)
* Change signature of deserialize() to be a Future.

* Grammar tlc for a couple of sentences.

* Make serialize() use a Future also.

* Add useCompute as a parameter to ApiClient, adjust to use compute when serializing/deserializing.

* Updated Pet Store client code.

* Ordered imports.

* Remove Flutter-specific implementation.

* Rename global functions to serialize/deserialize JSON.

* Fix return type for apiClientSerialize.

* Updated pet store client code.

* Remove remark for _deserialize.

* Make _decodeBodyBytes a Future function.

* Updated pet store client code.

* Use await when calling serialize().

* Fix a grammatical error.

* Adjust doc.

* Centralize deserialization code in one function.

* Updated pet store client code.

* Add await to serialize() in few more tests.

* Make output look better for linting and humans.

* Updated pet store code.

* Add an empty line.

* Updated pet store code.

* Call the right serializer.

* Reuse same variable.

* Updated pet store code.

* Fix a logical error when deserializing.

* Calculate growable once.

* Ignore reassignment.

* Adjust a test.

* Regenerate petstore code.

* Revert back previous test.

* Use serialize() for testing.

* Revert using serialize() for testing.

* Add removal deprecation for serialize/deserialize.

* Updated petstore code.

* Updated deprecation note.

* Adjust tests to wait for futures.
2021-03-31 23:53:22 +08:00
Peter Leibiger
47e292c0e7 [dart][dart-dio] Remove sample formatting from dart-dio-next (#9121) 2021-03-31 16:45:47 +08:00
William Cheng
628e3d1914 remove pthread (#9130) 2021-03-31 15:56:50 +08:00
William Cheng
de5651adac [C#] fix integer enum without format (#9136)
* fix inner enum integer without format

* add line break, update samples

* remove line break

* add line break

* update SHA
2021-03-31 15:11:10 +08:00
Luca Mazzanti
e1ef00903e [csharp][netcore-httpclient] Reuse HttpClient, Allow use of external HttpClient. Patch to previous PR. (#9109)
* [csharp][netcore-httpclient] Reuse HttpClient, Allow use of external HttpClient.

* Updated samples

* Removed local variables no more useful

* Added InvalidOperationException when used a configuration not supported for the constructor

* Updated samples
2021-03-30 18:10:08 +08:00
Justin Black
ae099330b9 Feature fixed, samples regenerated (#9131) 2021-03-29 23:42:14 -07:00
William Cheng
a3072680cd update samples 2021-03-30 11:54:37 +08:00
Jakob
0af45b3823 [Java] add jackson annotations to setters (#9041)
* [Java] add jackson annotations to setters

Closes #6856

* [Java] fix conflictiong setter with JsonNullable
2021-03-30 11:17:15 +08:00
William Cheng
becb424455 [PHP] minor code enhancement (#9009)
* minor code enhancement

* remove unused files
2021-03-30 11:13:30 +08:00
William Cheng
f898bfc7d6 better default value handling in go generators (#9106) 2021-03-30 11:09:21 +08:00
Peter Leibiger
f66fbf6969 [dart][dart-dio] Update dependencies (#9122)
* [dart-dio] Update dio

* [dart-dio] Update to dio 4.0.0

* [dart-dio] Fix dependency problems with Dart 2.12 SDK during build

* Revert changes to analyzer

This only fails locally, not sure why. CI only shows a warning.

* Fix compile error after http_mock update
2021-03-30 00:17:37 +08:00
cal
7816ea076e [cleanup] erefactor/EclipseJdt - Invert equals arguments if parameter is constant string (#9111)
EclipseJdt cleanup 'InvertEquals' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor
2021-03-29 23:58:52 +08:00
cal
6daecb88c2 [cleanup] erefactor/EclipseJdt - Use primitive parse methods instead of wrapper. (#9113)
EclipseJdt cleanup 'ParsePrimitive' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor
2021-03-29 21:02:51 +08:00
Peter Leibiger
6c8bc1ec88 [core] Allow using lists as globalProperty in config files (#8339) 2021-03-29 20:56:11 +08:00
cal
d913b14d45 [cleanup] erefactor/EclipseJdt - Make inner class static (#9112)
EclipseJdt cleanup 'MakeInnerClassStatic' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor
2021-03-29 20:54:41 +08:00
cal
67d7f60f6a [cleanup] erefactor/EclipseJdt - Convert 'for' loops to enhanced (#9110)
EclipseJdt cleanup 'ConvertForLoopToEnhanced' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor
2021-03-29 12:13:26 +08:00
William Cheng
8d372fa66a better null check for response (#9105) 2021-03-29 12:05:17 +08:00
William Cheng
ab6c6962c2 add enum suffic support to rust client (#9107) 2021-03-29 11:40:26 +08:00
linnefromice
70616b541e [Ruby] remove duplicated supportingFiles.add (#9108)
* remove duplicated supportingFiles

* modify examples - remove duplicated supportingFiles
2021-03-29 11:31:24 +08:00
William Cheng
9fb97c6c29 postpone require models with parent (#9103) 2021-03-29 11:07:57 +08:00
Justin Black
fe52529f05 [python] fix custom model template feature (#9118)
* Removes colliding __init__model.mustache in PythonClientCodegen.java

* Removes unused files

* Regenerates samples
2021-03-28 11:28:25 -07:00
William Cheng
c99226900b update samples 2021-03-27 18:47:57 +08:00
Blackclaws
45654d28ed [csharp][netcore-httpclient] Reuse HttpClient, Allow use of external HttpClient, Fix Socket Exhaustion, Alternative With Constructor Injection (#9085)
* Do not allow not reusing HttpClient, fix socket exhaustion issues, add Readme on how to add your own client

* Add Readme change

* Alternative version via constructor injection

* Update samples

* Update usage in ExecAsync

* Clean Constructor

* Add Warning to constructor, Update Samples

* Add warning, fix last constructor, update samples

* Change client to private in constructor injection

* Add disposable to ApiClient

* Do not dispose handler if we did not create it

* Update samples

* Add disable switch and update samples and documentation
2021-03-27 15:20:58 +08:00
William Cheng
b7f389aacb minor code improvement (#9091) 2021-03-27 14:57:26 +08:00
Prakhar Gupta
b1837693b1 [JAVA][jaxrs-spec] Added custom methods to add/remove elements from Java Collections (#6468) 2021-03-27 13:59:49 +08:00
Jakub Surdej
711ce5431a Add method allowing to apply middleware to request (#7403)
Prepare custom auth function template to be optional one

Rename auth function to middleware

Move middleware execution below operations with context

Generate samples for go

Modify new line characters in template not to affect default one

Generate samples with modified template
2021-03-27 13:53:30 +08:00
Phillip Verheyden
fa624ef38c Use prepare script instead of prepack (#7807)
Including the generated JS client library code as a git repository did not work when executing npm install. It complained about not being able to find 'babel'. Apparently when referencing a dependency from git, both prepare and prepack are executing to build the 'dist' directory, but prepack does will not include any devDependencies. Therefore we need to switch this to prepare instead.
2021-03-27 13:45:11 +08:00
William Cheng
e6f56626ed Revert "Enable useOneOfInterfaces for the ruby generator (#8061)" (#9104)
This reverts commit 23bc2aaf6b.
2021-03-27 13:43:31 +08:00
Jacob Burroughs
23bc2aaf6b Enable useOneOfInterfaces for the ruby generator (#8061)
Tested against https://ftc-events.firstinspires.org/swagger/v2.0/swagger.json

Used to generate un-runnable code, now it works
2021-03-27 13:42:48 +08:00
William Cheng
3579094298 update samples 2021-03-27 13:03:16 +08:00
dependabot[bot]
474df9dd5e Bump actions/download-artifact from v1 to v2.0.8 (#8781)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from v1 to v2.0.8.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v1...4a7a711286f30c025902c28b541c10e147a9b843)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-27 10:04:20 +08:00
dependabot[bot]
a2401f71b0 Bump actions/upload-artifact from v1 to v2.2.2 (#8782)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from v1 to v2.2.2.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v1...e448a9b857ee2131e752b06002bf0e093c65e571)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-27 10:04:09 +08:00
dependabot[bot]
8e7440e294 Update actions/cache requirement to v2.1.4 (#8780)
Updates the requirements on [actions/cache](https://github.com/actions/cache) to permit the latest version.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](26968a09c0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-27 10:03:32 +08:00
tomred-net
38b49e77af fix #8755 [BUG] Java (jersey2) ApiClient debug cannot be enabled (#8756)
* fix #8755 [BUG] Java (jersey2) ApiClient debug cannot be enabled

* fix #8755 updating samples
2021-03-27 10:01:39 +08:00
avbenavides
2525639875 Update client.mustache (#8970)
Bash Client Escapes parameters with a 't' to %09 and leaves tabs unescaped
Fixes https://github.com/OpenAPITools/openapi-generator/issues/7303
2021-03-27 09:59:53 +08:00
sullis
764d7f3035 maven-jar-plugin 3.2.0 (#8248) 2021-03-27 09:57:23 +08:00
leonluc-dev
7e6ce69c64 [ASPNETCORE 3.x] Microsoft.AspNetCore.Authorization directive no longer requires useSwashbuckle condition (#8368)
* Update controller.mustache

Moved using directive for Microsoft.AspNetCore.Authorization outside of useSwashbuckle tag to prevent compilation errors with Authorize tag if Swashbuckle is disabled.

* Updated aspnetcore-3.x samples
2021-03-27 09:56:37 +08:00
William Cheng
5abf020be3 use interrupted exception instead of just exception (#9092) 2021-03-26 21:41:24 +08:00
William Cheng
854296634a better logging (#9090) 2021-03-26 18:21:59 +08:00
William Cheng
e71ae12e14 Restore interrupted state (#9084) 2021-03-26 09:42:27 +08:00
William Cheng
ba28702da0 Remove dart-jaguar configs and samples (#9081)
* remove dart jaguar config and samples

* update pom.xml
2021-03-26 09:42:15 +08:00
William Cheng
402cf9a3a2 Fix integer enum in csharp generators (#9035)
* fix integer enum in csharp generators

* add comment
2021-03-25 21:30:42 +08:00
cal
6a26ac8e20 [cleanup] erefactor/EclipseJdt - Remove trailing whitespace - All lines (#9077)
EclipseJdt cleanup 'RemoveAllTrailingWhitespace' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor
2021-03-25 21:24:24 +08:00
cal
97e27f2b36 [cleanup] erefactor/EclipseJdt - Remove trailing whitespace - All lines (#9076)
EclipseJdt cleanup 'RemoveAllTrailingWhitespace' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor
2021-03-25 21:23:29 +08:00
cal
9419de573e [cleanup] erefactor/EclipseJdt - Remove unused imports (#9075)
EclipseJdt cleanup 'RemoveUnusedImport' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor
2021-03-25 21:21:21 +08:00
cal
6e0ca448dd [cleanup] erefactor/EclipseJdt - Remove unused imports (#9068)
EclipseJdt cleanup 'RemoveUnusedImport' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor
2021-03-25 16:42:41 +08:00
William Cheng
fea1377603 Use InterruptedException, IOException instead of just Exception (#9063)
* use InterruptedException, IOException instead of just Exception

* undo changes to the license
2021-03-25 13:30:30 +08:00
cal
7813398e7e [cleanup] erefactor/EclipseJdt - Remove unused imports (#9067)
EclipseJdt cleanup 'RemoveUnusedImport' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor
2021-03-25 10:52:22 +08:00
cal
862e9cb79a [cleanup] erefactor/EclipseJdt - Remove unused imports (#9066)
EclipseJdt cleanup 'RemoveUnusedImport' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor
2021-03-25 10:51:53 +08:00
cal
ee2f585f37 [cleanup] erefactor/EclipseJdt - Remove unused imports (#9058)
EclipseJdt cleanup 'RemoveUnusedImport' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor
2021-03-24 20:48:14 +08:00
cal
8043a8b9f4 [cleanup] erefactor/EclipseJdt - Remove trailing whitespace - All lines (#9057)
EclipseJdt cleanup 'RemoveAllTrailingWhitespace' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor
2021-03-24 20:47:39 +08:00
cal
b7c5d38011 [cleanup] erefactor/EclipseJdt - Remove redundant semicolons (#9056)
EclipseJdt cleanup 'RemoveRedundantSemicolons' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor
2021-03-24 20:46:31 +08:00
William Cheng
7937e2e0c9 Merge branch 'master' of https://github.com/openapitools/openapi-generator 2021-03-24 13:46:54 +08:00
William Cheng
0e0dc3f26b update doc 2021-03-24 13:45:52 +08:00
vnq
74e5c3ccd3 [php-symfony] remove nested Valid constraint (#8994)
* Fix constraint Valid cannot be nested

* Update PetController.php

* Update UserController.php
2021-03-24 13:30:42 +08:00
Kam
f137f3331a Add possibility to generate only files needed for sources compilation (#9012) 2021-03-24 13:27:25 +08:00
Blackclaws
650aaa2bee Fix FromForm for complex parameters (#9040) 2021-03-24 12:33:17 +08:00
Blackclaws
b69fb79573 [csharp][aspnetcore] Enable Consumes Tag for Specs where not every operation consumes (#9039)
* Change break to consumes so that all operations will be processed

* Update Samples
2021-03-24 12:30:23 +08:00
Ze Wang
7e0382b08d [Java][Jaxrs-Resteasy] Fixes generator devaultValues for int64/float/… (#8988)
* [Java][Jaxrs-Resteasy] Fixes generator devaultValues for int64/float/double

* add test

* fix tests

* trigger rerun of timeout tests

* remove SmartBear line from comments for new files

* trigger rerun of validations

* trigger rerun of validations

* trigger rerun of validations

* trigger rerun of validations

* trigger rerun of validations

* move postProcessParameter to AbstractJavaCodegen

* move postProcessParameter to AbstractJavaCodegen

Co-authored-by: zewang <zewang@deepmap.ai>
2021-03-24 12:23:34 +08:00
Florian Kamella
03be3c612d Fix default value generation for composed schemas in AbstractJavaCodegen (#8918) 2021-03-24 00:36:54 +08:00
Blackclaws
0f981fffc3 [csharp][httpclient] Fix accidental use of c# 8 language feature (#9037)
* Fix c# 8 language feature being present

* Change config to refer to netstandard 2.0

* Update samples
2021-03-24 00:33:13 +08:00
William Cheng
d438d797da [C#][netcore] Fix model, property name check (#9049)
* fix model, property name check in c# generator

* remove file

* remove file

* specify name
2021-03-23 20:00:26 +08:00
William Cheng
bedfe156bb specify name (#9051) 2021-03-23 19:59:27 +08:00
William Cheng
97a3fc4b8e [C#][netcore] Set EmitDefaultValue to true for boolean property (#9042)
* set EmitDefaultValue to true for boolean property

* update samples
2021-03-23 10:43:35 +08:00
William Cheng
39f0177ede [Java] Update WebClient dependencies (#8972)
* update webclient dependencies

* update build.gradle
2021-03-22 13:58:04 +08:00
Blackclaws
46a7d972b9 [csharp][aspnetcore] Fix FileUpload Parameter Generation for aspnetcore (#9000)
* Aspnetcore fix file parameters

https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1183#issuecomment-612022568

* Update Samples

* Add Consumes to Controller. Needed for correct swashbuckle

* Add bodyParam annotation again

* Add InputFormatterStream

* Selective Use of IFormFIle

* Update samples

* Add missing List

* Fix duplicate consumes

* Update samples

* Remove executable bit

* Add missing files

* Add Comments
2021-03-22 12:35:45 +08:00
Justin Black
113d38eb71 Sets model.additionalProperties for composed schemas (#9033)
* Turns on setting model.additionalProperties for composed schemas when supportsAdditionalPropertiesWithComposedSchema is true, tests updated for v2 and v3 specs

* Comment change

* Samples updated

* Turns on supportsAdditionalPropertiesWithComposedSchema for CsharpNetCoreClient, samples regenerated

* Changes commented out, samples regnerated

* Refactors the update in setAddProps to not impact the charp client
2021-03-21 19:22:18 -07:00
William Cheng
e0021e662f update readme 2021-03-21 11:06:27 +08:00
William Cheng
773a8d8a08 move dart test to node 2, remove oas v2 dart tests (#9028) 2021-03-21 10:53:00 +08:00
William Cheng
0dc62e8b79 Prepare v5.1.1 in the master (#9027)
* Prepare v5.1.1 in the master

* move dart dio next to configs/other
2021-03-20 23:05:11 +08:00
4272 changed files with 56833 additions and 69722 deletions

View File

@@ -24,18 +24,18 @@ jobs:
uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
- uses: actions/cache@v1
- uses: actions/cache@v2.1.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', 'modules/**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/cache@v2
- uses: actions/cache@v2.1.5
with:
path: |
~/.gradle/caches
@@ -49,7 +49,7 @@ jobs:
run: mvn -nsu -B --quiet -Djacoco.skip=true -Dorg.slf4j.simpleLogger.defaultLogLevel=error --no-transfer-progress clean install --file pom.xml ${{ matrix.flags }}
- name: Upload Maven build artifact
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v2.2.3
if: matrix.java == '8' && matrix.os == 'ubuntu-latest'
with:
name: artifact
@@ -80,7 +80,7 @@ jobs:
- name: Check out code
uses: actions/checkout@v2
- name: Download build artifact
uses: actions/download-artifact@v1
uses: actions/download-artifact@v2.0.8
with:
name: artifact
- name: Run Ensures Script

View File

@@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11
- name: Compile with Maven

View File

@@ -62,6 +62,14 @@ addons:
- petstore.swagger.io
before_install:
- sudo rm -rf /var/lib/apt/lists/*
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge"
- sudo apt-get update
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
- mkdir -vp ~/.docker/cli-plugins/
- curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
- chmod a+x ~/.docker/cli-plugins/docker-buildx
# to run petstore server locally via docker
- echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin || true
- docker pull swaggerapi/petstore
@@ -149,6 +157,8 @@ install:
script:
# fail fast
- set -e
# show docker buildx version
- docker buildx version
# fail if the template files contains tabs
- /bin/bash ./bin/utils/detect_tab_in_templates.sh
# fail if the test files have changes
@@ -199,12 +209,14 @@ after_success:
echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin;
export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[');
export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ");
docker build --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/openapi-generator-online;
docker buildx create --use;
if [ ! -z "$TRAVIS_TAG" ]; then
docker tag $DOCKER_GENERATOR_IMAGE_NAME:latest $DOCKER_GENERATOR_IMAGE_NAME:$TRAVIS_TAG;
docker buildx build --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME:latest -t $DOCKER_GENERATOR_IMAGE_NAME:$TRAVIS_TAG -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/openapi-generator-online;
echo "Built and tagged $DOCKER_GENERATOR_IMAGE_NAME";
fi;
if [ ! -z "$TRAVIS_TAG" ] || [ "$TRAVIS_BRANCH" = "master" ]; then
docker push $DOCKER_GENERATOR_IMAGE_NAME && echo "Pushed to $DOCKER_GENERATOR_IMAGE_NAME";
if [ -z "$TRAVIS_TAG" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/openapi-generator-online;
echo "Pushed to $DOCKER_GENERATOR_IMAGE_NAME for master";
fi;
fi;
## docker: build cli image and push to Docker Hub
@@ -213,12 +225,14 @@ after_success:
cp docker-entrypoint.sh ./modules/openapi-generator-cli;
export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[');
export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ");
docker build --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli;
docker buildx create --use;
docker buildx build --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli;
if [ ! -z "$TRAVIS_TAG" ]; then
docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest $DOCKER_CODEGEN_CLI_IMAGE_NAME:$TRAVIS_TAG;
docker buildx build --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:$TRAVIS_TAG -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli;
echo "Built and tagged $DOCKER_GENERATOR_IMAGE_NAME";
fi;
if [ ! -z "$TRAVIS_TAG" ] || [ "$TRAVIS_BRANCH" = "master" ]; then
docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME;
if [ -z "$TRAVIS_TAG" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli;
echo "Pushed to $DOCKER_CODEGEN_CLI_IMAGE_NAME";
fi;
fi;

View File

@@ -2,57 +2,60 @@ kind: pipeline
name: default
steps:
# test nim client
- name: nim-client-test
image: nimlang/nim
# test Elm client
- name: elm
image: odesimple/elm:0.19
commands:
- (cd samples/client/petstore/nim/ && nim c sample_client.nim)
# test protobuf schema generator
- name: protobuf-schema-test
image: nanoservice/protobuf-go
commands:
- protoc --version
- mkdir /var/tmp/go/
- cd samples/config/petstore/protobuf-schema
- protoc --go_out=/var/tmp/go/ services/*
- protoc --go_out=/var/tmp/go/ models/*
# test aspnetcore 3.x
- name: aspnetcore-test
image: mcr.microsoft.com/dotnet/core/sdk:3.1
commands:
- (cd samples/server/petstore/aspnetcore-3.1/ && /bin/sh build.sh)
- (cd samples/server/petstore/aspnetcore-3.0/ && /bin/sh build.sh)
# test ocaml petstore client
- name: ocaml-test
image: ocaml/opam2:4.07
commands:
- sudo apt-get -y install m4
- cd samples/client/petstore/ocaml
- opam install ppx_deriving_yojson cohttp ppx_deriving cohttp-lwt-unix
- opam pin add ocaml-migrate-parsetree 1.3.1
- eval $(opam env)
- sudo chmod -R 777 .
- dune build --build-dir=./_build
# test haskell client
- name: haskell-client-test
image: haskell:8.6.5
commands:
- (cd samples/client/petstore/haskell-http-client/ && stack --install-ghc --no-haddock-deps haddock --fast && stack test --fast)
- (cd samples/openapi3/client/petstore/elm && ./elm-compile-test)
# test Java 11 HTTP client
- name: java11-test
image: openjdk:11.0
commands:
- ./mvnw --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- ./mvnw --quiet verify -Psamples.droneio -Dorg.slf4j.simpleLogger.defaultLogLevel=error
# test java native client
- ./mvnw clean test -f samples/client/petstore/java/native/pom.xml
- ./mvnw clean test -f samples/client/petstore/java/native-async/pom.xml
- ./mvnw clean test -f samples/openapi3/client/petstore/java/native/pom.xml
# test all generators with fake petstore spec (2.0, 3.0)
- /bin/bash bin/utils/test-fake-petstore-for-all.sh
# generate test scripts
- /bin/bash bin/tests/run-all-test
# generate all petstore samples (client, servers, doc)
- /bin/bash bin/generate-samples.sh
# generate all petstore samples (openapi3)
- /bin/bash bin/generate-samples.sh bin/configs/other/*.yaml
#- name: java11-test
# image: openjdk:11.0
# commands:
# - ./mvnw --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
# - ./mvnw --quiet verify -Psamples.droneio -Dorg.slf4j.simpleLogger.defaultLogLevel=error
# # run ensure up-to-date
# - /bin/bash bin/utils/ensure-up-to-date
# # test java native client
# - ./mvnw clean test -f samples/client/petstore/java/native/pom.xml
# - ./mvnw clean test -f samples/client/petstore/java/native-async/pom.xml
# - ./mvnw clean test -f samples/openapi3/client/petstore/java/native/pom.xml
# # test all generators with fake petstore spec (2.0, 3.0)
# - /bin/bash bin/utils/test-fake-petstore-for-all.sh
# # generate test scripts
# - /bin/bash bin/tests/run-all-test
## test nim client
#- name: nim-client-test
# image: nimlang/nim
# commands:
# - (cd samples/client/petstore/nim/ && nim c sample_client.nim)
## test protobuf schema generator
#- name: protobuf-schema-test
# image: nanoservice/protobuf-go
# commands:
# - protoc --version
# - mkdir /var/tmp/go/
# - cd samples/config/petstore/protobuf-schema
# - protoc --go_out=/var/tmp/go/ services/*
# - protoc --go_out=/var/tmp/go/ models/*
## test aspnetcore 3.x
#- name: aspnetcore-test
# image: mcr.microsoft.com/dotnet/core/sdk:3.1
# commands:
# - (cd samples/server/petstore/aspnetcore-3.1/ && /bin/sh build.sh)
# - (cd samples/server/petstore/aspnetcore-3.0/ && /bin/sh build.sh)
## test ocaml petstore client
#- name: ocaml-test
# image: ocaml/opam2:4.07
# commands:
# - sudo apt-get -y install m4
# - cd samples/client/petstore/ocaml
# - opam install ppx_deriving_yojson cohttp ppx_deriving cohttp-lwt-unix
# - opam pin add ocaml-migrate-parsetree 1.3.1
# - eval $(opam env)
# - sudo chmod -R 777 .
# - dune build --build-dir=./_build
## test haskell client
#- name: haskell-client-test
# image: haskell:8.6.5
# commands:
# - (cd samples/client/petstore/haskell-http-client/ && stack --install-ghc --no-haddock-deps haddock --fast && stack test --fast)

View File

@@ -23,7 +23,6 @@ function installDart {
sudo apt-get update
sudo apt-get install dart
export PATH="$PATH:/usr/lib/dart/bin"
export DART_POST_PROCESS="dart format"
}
if [ "$NODE_INDEX" = "1" ]; then
@@ -48,7 +47,8 @@ elif [ "$NODE_INDEX" = "2" ]; then
git checkout -- .
# look for outdated samples
./bin/utils/ensure-up-to-date
#./bin/utils/ensure-up-to-date
# UPDATE: moved to drone.io
fi
echo "Running node $NODE_INDEX to test haskell"
# install haskell
@@ -81,8 +81,6 @@ else
export PATH="/usr/local/go1.14/go/bin:$PATH"
go version
installDart
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.1.0`):
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.1.1`):
[![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=master)](https://app.shippable.com/github/OpenAPITools/openapi-generator)
@@ -18,6 +18,14 @@
[![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.2.x](https://github.com/OpenAPITools/openapi-generator/tree/5.2.x) (`5.2.x`):
[![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/5.2.x.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator/tree/5.2.x.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=5.2.x)](https://app.shippable.com/github/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=5.2.x&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
[![JDK11 Build](https://cloud.drone.io/api/badges/OpenAPITools/openapi-generator/status.svg?ref=refs/heads/5.2.x)](https://cloud.drone.io/OpenAPITools/openapi-generator)
[![Bitrise](https://img.shields.io/bitrise/4a2b10a819d12b67/5.2.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.org/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)
@@ -70,7 +78,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++** (cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (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), **Haskell** (Servant), **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, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (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), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant), **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, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (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** |
@@ -112,8 +120,9 @@ 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.1.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.1.0-SNAPSHOT/) | Mar/Apr 2021 | Minor release with breaking changes (with fallback) |
| [5.0.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.0.1) (latest stable release) | 06.02.2021 | Patch release with enhancements, bug fixes, etc |
| 5.2.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.2.0-SNAPSHOT/) | May/Jun 2021 | Minor release with breaking changes (with fallback) |
| 5.1.1 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.1.1-SNAPSHOT/) | Apr/May 2021 | Patch release (enhancements, bug fixes, etc) |
| [5.1.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.1.0) (latest stable release) | 20.03.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
@@ -553,7 +562,7 @@ When code is generated from this project, it shall be considered **AS IS** and o
### [3.5 - IDE Integration](#table-of-contents)
Here is a list of community-conitributed IDE plug-ins that integrate with OpenAPI Generator:
Here is a list of community-contributed IDE plug-ins that integrate with OpenAPI Generator:
- Eclipse: [Codewind OpenAPI Tools for Eclipse](https://www.eclipse.org/codewind/open-api-tools-for-eclipse.html) by [IBM](https://www.ibm.com)
- IntelliJ IDEA: [OpenAPI Generator](https://plugins.jetbrains.com/plugin/8433-openapi-generator) by [Jim Schubert](https://jimschubert.us/#/)
@@ -650,12 +659,14 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [Stingray](http://www.stingray.com)
- [Suva](https://www.suva.ch/)
- [Telstra](https://dev.telstra.com)
- [The University of Aizu](https://www.u-aizu.ac.jp/en/)
- [TravelTime platform](https://www.traveltimeplatform.com/)
- [TribalScale](https://www.tribalscale.com)
- [TUI InfoTec GmbH](http://www.tui-infotec.com/)
- [Twitter](https://twitter.com)
- [unblu inc.](https://www.unblu.com/)
- [Veamly](https://www.veamly.com/)
- [VMWare](https://www.vmware.com/)
- [wbt-solutions](https://www.wbt-solutions.de/)
- [Woleet](https://www.woleet.io/)
- [WSO2](https://wso2.com/)
@@ -805,6 +816,14 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- 2021-01-18 - [「アプリ開発あるある」を疑うことから始まった、API Clientコードの自動生成【デブスト2020】](https://codezine.jp/article/detail/13406?p=2) by [CodeZine編集部](https://codezine.jp/author/1)
- 2021-02-05 - [REST-API-Roundtrip with SpringDoc and OpenAPI Generator](https://blog.viadee.de/en/rest-api-roundtrip) by [Benjamin Klatt](https://twitter.com/benklatt) at [viadee](https://www.viadee.de/en/)
- 2021-02-17 - [REST-API-Roundtrip with SpringDoc and OpenAPI Generator](https://medium.com/nerd-for-tech/rest-api-roundtrip-with-springdoc-and-openapi-generator-30bd27ccf698) by [cloud @viadee](https://cloud-viadee.medium.com/)
- 2021-03-08 - [OpenAPI Generator 工具的躺坑尝试](https://blog.csdn.net/u013019701/article/details/114531975) by [独家雨天](https://blog.csdn.net/u013019701) at [CSDN官方博客](https://blog.csdn.net/)
- 2021-03-16 - [如何基于 Swagger 使用 OpenAPI Generator 生成 JMeter 脚本?](https://cloud.tencent.com/developer/article/1802704) by [高楼Zee](https://cloud.tencent.com/developer/user/5836255) at [腾讯云专栏](https://cloud.tencent.com/developer/column)
- 2021-03-24 - [openapi-generator-cli による TypeScript 型定義](https://zenn.dev/takepepe/articles/openapi-generator-cli-ts) by [Takefumi Yoshii](https://zenn.dev/takepepe)
- 2021-03-28 - [Trying out NestJS part 4: Generate Typescript clients from OpenAPI documents](https://dev.to/arnaudcortisse/trying-out-nestjs-part-4-generate-typescript-clients-from-openapi-documents-28mk) by [Arnaud Cortisse](https://dev.to/arnaudcortisse)
- 2021-03-31 - [Open API Server Implementation Using OpenAPI Generator](https://www.baeldung.com/java-openapi-generator-server) at [Baeldung](https://www.baeldung.com/)
- 2021-03-31 - [使用OpenAPI Generator實現Open API Server](https://www.1ju.org/article/java-openapi-generator-server) at [億聚網](https://www.1ju.org/)
- 2022-04-19 - [Introducing Twilios OpenAPI Specification Beta](https://www.twilio.com/blog/introducing-twilio-open-api-specification-beta) by [GARETH PAUL JONES](https://www.twilio.com/blog/author/gpj) at [Twilio Blog](https://www.twilio.com/blog)
- 2022-04-22 - [Leveraging OpenApi strengths in a Micro-Service environment](https://medium.com/unibuddy-technology-blog/leveraging-openapi-strengths-in-a-micro-service-environment-3d7f9e7c26ff) by Nicolas Jellab at [Unibuddy Technology Blog](https://medium.com/unibuddy-technology-blog)
## [6 - About Us](#table-of-contents)
@@ -917,6 +936,7 @@ Here is a list of template creators:
* Erlang Server: @galaxie
* F# (Giraffe) Server: @nmfisher
* Go Server: @guohuang
* Go (Echo) Server: @ph4r5h4d
* Go (Gin) Server: @kemokemo
* GraphQL Express Server: @renepardon
* Haskell Servant: @algas
@@ -1009,7 +1029,7 @@ If you want to join the committee, please kindly apply by sending an email to te
| Elm | @eriktim (2018/09) |
| Erlang | @tsloughter (2017/11) @jfacorro (2018/10) @robertoaloi (2018/10) |
| F# | @nmfisher (2019/05) |
| Go | @antihax (2017/11) @grokify (2018/07) @kemokemo (2018/09) @jirikuncar (2021/01) |
| Go | @antihax (2017/11) @grokify (2018/07) @kemokemo (2018/09) @jirikuncar (2021/01) @ph4r5h4d (2021/04) |
| GraphQL | @renepardon (2018/12) |
| Groovy | |
| Haskell | |

View File

@@ -32,7 +32,7 @@ install:
- git clone https://github.com/wing328/swagger-samples
- 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: $PSVersionTable.PSVersion
- ps: Install-Module Pester -Force -Scope CurrentUser
- ps: Install-Module -Name Pester -Force -Scope CurrentUser
build_script:
- dotnet --info
# build C# aspnetcore 5.0 server
@@ -43,6 +43,8 @@ build_script:
- dotnet build samples\server\petstore\aspnetcore-3.0\Org.OpenAPITools.sln
# build C# aspnetcore 2.2 server
- dotnet build samples\server\petstore\aspnetcore\Org.OpenAPITools.sln
# build C# API client (multiple frameworks)
- dotnet build samples\client\petstore\csharp-netcore\OpenAPIClientCoreAndNet47\Org.OpenAPITools.sln
# build C# API client (httpclient)
- dotnet build samples\client\petstore\csharp-netcore\OpenAPIClient-httpclient\Org.OpenAPITools.sln
# build C# API client (netcore)
@@ -66,6 +68,8 @@ build_script:
# run the locally installed openapi-generator-gradle-plugin
- gradle -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --stacktrace
test_script:
# test c# API client (multiple frameworks)
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClientCoreAndNet47\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
# test c# API client (httpclient)
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient-httpclient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
# test c# API client (netcore)

View File

@@ -9,4 +9,4 @@ additionalProperties:
useCompareNetObjects: true
disallowAdditionalPropertiesIfNotPresent: false
useOneOfDiscriminatorLookup: true
targetFramework: netstandard2.1
targetFramework: netstandard2.0

View File

@@ -0,0 +1,8 @@
generatorName: csharp-netcore
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClientCoreAndNet47
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
targetFramework: netstandard2.1;netcoreapp3.0
useCompareNetObjects: "true"

View File

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

View File

@@ -2,5 +2,9 @@ generatorName: dart-dio
outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/dart-dio
typeMappings:
Client: "ModelClient"
File: "ModelFile"
EnumClass: "ModelEnumClass"
additionalProperties:
hideGenerationTimestamp: "true"

View File

@@ -1,6 +0,0 @@
generatorName: dart-dio
outputDir: samples/client/petstore/dart-dio/petstore_client_lib
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/dart-dio
additionalProperties:
hideGenerationTimestamp: "true"

View File

@@ -1,7 +0,0 @@
generatorName: dart-jaguar
outputDir: samples/client/petstore/dart-jaguar/flutter_petstore/openapi
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/dart-jaguar
additionalProperties:
pubName: openapi
hideGenerationTimestamp: "true"

View File

@@ -1,8 +0,0 @@
generatorName: dart-jaguar
outputDir: samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml
templateDir: modules/openapi-generator/src/main/resources/dart-jaguar
additionalProperties:
serialization: proto
pubName: openapi
hideGenerationTimestamp: "true"

View File

@@ -1,7 +0,0 @@
generatorName: dart-jaguar
outputDir: samples/client/petstore/dart-jaguar/openapi
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/dart-jaguar
additionalProperties:
hideGenerationTimestamp: "true"
pubName: openapi

View File

@@ -1,8 +0,0 @@
generatorName: dart-jaguar
outputDir: samples/client/petstore/dart-jaguar/openapi_proto
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml
templateDir: modules/openapi-generator/src/main/resources/dart-jaguar
additionalProperties:
serialization: proto
pubName: openapi
hideGenerationTimestamp: "true"

View File

@@ -2,5 +2,8 @@ generatorName: dart
outputDir: samples/openapi3/client/petstore/dart2/petstore_client_lib_fake
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/dart2
typeMappings:
Client: "ModelClient"
File: "ModelFile"
additionalProperties:
hideGenerationTimestamp: "true"

View File

@@ -1,6 +0,0 @@
generatorName: dart
outputDir: samples/client/petstore/dart2/petstore_client_lib
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/dart2
additionalProperties:
hideGenerationTimestamp: "true"

View File

@@ -2,6 +2,9 @@ generatorName: dart
outputDir: samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/dart2
typeMappings:
Client: "ModelClient"
File: "ModelFile"
additionalProperties:
hideGenerationTimestamp: "true"
serializationLibrary: json_serializable

View File

@@ -0,0 +1,6 @@
generatorName: go-echo-server
outputDir: samples/server/petstore/go-echo-server
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/go-echo-server
additionalProperties:
hideGenerationTimestamp: "true"

View File

@@ -5,3 +5,4 @@ templateDir: modules/openapi-generator/src/main/resources/go-server
additionalProperties:
hideGenerationTimestamp: "true"
packageName: petstoreserver
addResponseHeaders: true

View File

@@ -1,7 +1,7 @@
generatorName: ktorm-schema
outputDir: samples/schema/petstore/ktorm
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/ktorm-schema
additionalProperties:
hideGenerationTimestamp: true
importModelPackageName: org.openapitools.client.models
importModelPackageName: org.openapitools.client.models

View File

@@ -1,6 +1,6 @@
generatorName: nim
outputDir: samples/client/petstore/nim
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/nim-client
additionalProperties:
packageName: petstore

View File

@@ -1,4 +1,4 @@
generatorName: php-symfony
outputDir: samples/server/petstore/php-symfony/SymfonyBundle-php
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/php-symfony

View File

@@ -1,6 +1,6 @@
generatorName: swift5
outputDir: samples/client/petstore/swift5/default
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/swift5
generateAliasAsModel: true
additionalProperties:

View File

@@ -9,3 +9,4 @@ additionalProperties:
podSummary: PetstoreClient
projectName: PetstoreClient
podHomepage: https://github.com/openapitools/openapi-generator
useBacktickEscapes: true

View File

@@ -9,3 +9,5 @@ additionalProperties:
podSummary: PetstoreClient
projectName: PetstoreClient
podHomepage: https://github.com/openapitools/openapi-generator
useSPMFileStructure: true
useClasses: true

View File

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

View File

@@ -1,5 +1,7 @@
#!/usr/bin/env bash
set -e
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
@@ -18,8 +20,8 @@ ags="meta -n myClientCodegen -t DOCUMENTATION -p com.my.company.codegen -o sampl
java $JAVA_OPTS -jar $executable $ags
(cd "$root"/samples/meta-codegen/ && mvn -B package -Djacoco.skip=true -DskipTests=true -f pom.xml)
(./mvnw -B package -Djacoco.skip=true -DskipTests=true -f "$root"/samples/meta-codegen/pom.xml)
ags2="generate -g myClientCodegen -i modules/openapi-generator/src/test/resources/2_0/petstore.json -o samples/meta-codegen/usage $@"
ags2="generate -g myClientCodegen -i modules/openapi-generator/src/test/resources/3_0/petstore.json -o samples/meta-codegen/usage $@"
java $JAVA_OPTS -cp ${root}/samples/meta-codegen/lib/target/myClientCodegen-openapi-generator-1.0.0.jar:$executable org.openapitools.codegen.OpenAPIGenerator $ags2
java $JAVA_OPTS -cp ${root}/samples/meta-codegen/lib/target/myClientCodegen-openapi-generator-1.0.0.jar:$executable org.openapitools.codegen.OpenAPIGenerator $ags2

View File

@@ -11,15 +11,16 @@ logfile="/tmp/generator-fake-petstore-output.log"
for GENERATOR in $(java -jar ${executable} list --short | sed -e 's/,/\'$'\n''/g')
do
if eval java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR} > ${logfile} 2>&1; then
echo "[OAS 2.0] Executed ${GENERATOR} successfully!"
else
echo "ERROR: Failed to run '${GENERATOR}' generator. The command was:"
echo "java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR}"
echo "ERROR: The output of the command was:"
cat ${logfile}
exit 1
fi
# no longer test 2.0 spec as we migrated to 3.0 spec
#if eval java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR} > ${logfile} 2>&1; then
# echo "[OAS 2.0] Executed ${GENERATOR} successfully!"
#else
# echo "ERROR: Failed to run '${GENERATOR}' generator. The command was:"
# echo "java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR}"
# echo "ERROR: The output of the command was:"
# cat ${logfile}
# exit 1
#fi
if eval java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/3.0/${GENERATOR} > ${logfile} 2>&1; then
echo "[OAS 3.0] Executed ${GENERATOR} successfully!"

View File

@@ -1,5 +1,7 @@
---
# csharp-netcore test files and image for upload
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/JSONComposedSchemaTests.cs"
sha256: 95e40cace36e7cd1608fa494161f06291f4cfb8f859ec4196ae9939f520b152a
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs"
sha256: dae985015ba461297927d544a78267f2def35e07c3f14ca66468fd61e1fd1c26
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/linux-logo.png"

View File

@@ -22,7 +22,6 @@ The following environment variables are supported by their respective generators
* `CPP_POST_PROCESS_FILE`
* `CSHARP_POST_PROCESS_FILE`
* `C_POST_PROCESS_FILE`
* `DART_POST_PROCESS`
* `DART_POST_PROCESS_FILE`
* `FSHARP_POST_PROCESS_FILE`
* `GO_POST_PROCESS_FILE`

View File

@@ -86,6 +86,7 @@ The following generators are available:
* [erlang-server](generators/erlang-server.md)
* [fsharp-functions (beta)](generators/fsharp-functions.md)
* [fsharp-giraffe-server (beta)](generators/fsharp-giraffe-server.md)
* [go-echo-server (beta)](generators/go-echo-server.md)
* [go-gin-server](generators/go-gin-server.md)
* [go-server](generators/go-server.md)
* [graphql-nodejs-express-server](generators/graphql-nodejs-express-server.md)

View File

@@ -29,7 +29,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.|<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></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

@@ -25,7 +25,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.|<dl><dt>**v3.5**</dt><dd>.NET Framework 3.5 compatible</dd><dt>**v4.0**</dt><dd>.NET Framework 4.0 compatible</dd><dt>**v4.5**</dt><dd>.NET Framework 4.5 compatible</dd><dt>**v4.5.2**</dt><dd>.NET Framework 4.5.2+ compatible</dd><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible (DEPRECATED. Please use `csharp-netcore` generator instead)</dd><dt>**uwp**</dt><dd>Universal Windows Platform (DEPRECATED. Please use `csharp-netcore` generator instead)</dd></dl>|v4.5|
|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.0`|<dl><dt>**v3.5**</dt><dd>.NET Framework 3.5 compatible</dd><dt>**v4.0**</dt><dd>.NET Framework 4.0 compatible</dd><dt>**v4.5**</dt><dd>.NET Framework 4.5 compatible</dd><dt>**v4.5.2**</dt><dd>.NET Framework 4.5.2+ compatible</dd><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible (DEPRECATED. Please use `csharp-netcore` generator instead)</dd><dt>**uwp**</dt><dd>Universal Windows Platform (DEPRECATED. Please use `csharp-netcore` generator instead)</dd></dl>|v4.5|
|useCollection|Deserialize array types to Collection&lt;T&gt; instead of List&lt;T&gt;.| |false|
|useCompareNetObjects|Use KellermanSoftware.CompareNetObjects for deep recursive object comparison. WARNING: this option incurs potential performance impact.| |false|
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|

View File

@@ -44,7 +44,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>String</li>
<li>bool</li>
<li>double</li>
<li>dynamic</li>
<li>int</li>
<li>num</li>
</ul>

View File

@@ -30,11 +30,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Type/Alias | Imports |
| ---------- | ------- |
|BuiltList|package:built_collection/built_collection.dart|
|BuiltMap|package:built_collection/built_collection.dart|
|BuiltSet|package:built_collection/built_collection.dart|
|JsonObject|package:built_value/json_object.dart|
|Uint8List|dart:typed_data|
## INSTANTIATION TYPES
@@ -49,7 +44,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>String</li>
<li>bool</li>
<li>double</li>
<li>dynamic</li>
<li>int</li>
<li>num</li>
</ul>

View File

@@ -44,7 +44,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>String</li>
<li>bool</li>
<li>double</li>
<li>dynamic</li>
<li>int</li>
<li>num</li>
</ul>

View File

@@ -43,7 +43,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>String</li>
<li>bool</li>
<li>double</li>
<li>dynamic</li>
<li>int</li>
<li>num</li>
</ul>

View File

@@ -0,0 +1,206 @@
---
title: Config Options for go-echo-server
sidebar_label: go-echo-server
---
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 |
| ------ | ----------- | ------ | ------- |
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|packageName|Go package name (convention: lowercase).| |openapi|
|packageVersion|Go package version.| |1.0.0|
|serverPort|The network port the generated server binds to| |8080|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>bool</li>
<li>byte</li>
<li>complex128</li>
<li>complex64</li>
<li>float32</li>
<li>float64</li>
<li>int</li>
<li>int32</li>
<li>int64</li>
<li>interface{}</li>
<li>map[string]interface{}</li>
<li>rune</li>
<li>string</li>
<li>uint</li>
<li>uint32</li>
<li>uint64</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>bool</li>
<li>break</li>
<li>byte</li>
<li>case</li>
<li>chan</li>
<li>complex128</li>
<li>complex64</li>
<li>const</li>
<li>continue</li>
<li>default</li>
<li>defer</li>
<li>else</li>
<li>error</li>
<li>fallthrough</li>
<li>float32</li>
<li>float64</li>
<li>for</li>
<li>func</li>
<li>go</li>
<li>goto</li>
<li>if</li>
<li>import</li>
<li>int</li>
<li>int16</li>
<li>int32</li>
<li>int64</li>
<li>int8</li>
<li>interface</li>
<li>map</li>
<li>nil</li>
<li>package</li>
<li>range</li>
<li>return</li>
<li>rune</li>
<li>select</li>
<li>string</li>
<li>struct</li>
<li>switch</li>
<li>type</li>
<li>uint</li>
<li>uint16</li>
<li>uint32</li>
<li>uint64</li>
<li>uint8</li>
<li>uintptr</li>
<li>var</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

@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|addResponseHeaders|To include response headers in ImplResponse| |false|
|enumClassPrefix|Prefix enum with class name| |false|
|featureCORS|Enable Cross-Origin Resource Sharing middleware| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|

View File

@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|enumNameSuffix|Suffix that will be appended to all enum names.| ||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|library|library template (sub-template) to use.|<dl><dt>**hyper**</dt><dd>HTTP client: Hyper.</dd><dt>**reqwest**</dt><dd>HTTP client: Reqwest.</dd></dl>|reqwest|
|packageName|Rust package name (convention: lowercase).| |openapi|

View File

@@ -12,6 +12,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|apiPackage|package for generated api classes| |null|
|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|
|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|

View File

@@ -33,7 +33,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift, Result, Combine are available.| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|swiftPackagePath|Set a custom source path instead of OpenAPIClient/Classes/OpenAPIs.| |null|
|swiftUseApiNamespace|Flag to make all the API classes inner-class of {{projectName}}API| |null|
|useBacktickEscapes|Escape reserved words using backticks (default: false)| |false|
|useSPMFileStructure|Use SPM file structure and set the source path to Sources/{{projectName}} (default: false).| |null|
## IMPORT MAPPING

View File

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

View File

@@ -910,9 +910,9 @@ x-content-type: application/json
### Rust-server
#### x-responseId
#### x-response-id
Each response may specify a unique `x-responseId`. `rust-server` will use this to name the corresponding enum variant in the code. e.g.
Each response may specify a unique `x-response-id`. `rust-server` will use this to name the corresponding enum variant in the code. e.g.
```yaml
paths:
@@ -921,7 +921,7 @@ paths:
responses:
200:
description: OK
x-responseId: Pong
x-response-id: Pong
```
### MySQL Schema

View File

@@ -10,12 +10,13 @@ This page demonstrates navigating the options via CLI. Commands are presented he
The `help` option lists all commands available to the CLI.
```bash
```text
openapi-generator-cli help
usage: openapi-generator-cli <command> [<args>]
The most commonly used openapi-generator-cli commands are:
author Utilities for authoring generators or customizing templates.
batch Generate code in batch via external configs.
config-help Config help for chosen lang
generate Generate code with the specified generator.
help Display help information about openapi-generator
@@ -30,26 +31,28 @@ command.
## version
The version command provides version information, returning either the semver version by default or the git sha when passed `--sha`.
The version command provides version information, returning either the version by default, the git commit sha when passed `--sha`, or verbose output when passed `--full`.
```bash
```text
NAME
openapi-generator-cli version - Show version information
openapi-generator-cli version - Show version information used in tooling
SYNOPSIS
openapi-generator-cli version [--sha]
openapi-generator-cli version [--full] [--sha]
OPTIONS
--full
Full version details
--sha
Git commit SHA version
```
## list
The `list` command outputs a formatted list of every available generator. Pass the `-s/--short` option if you would like a CSV output for easy parsing.
```bash
```text
openapi-generator-cli help list
NAME
openapi-generator-cli list - Lists the available generators
@@ -66,7 +69,6 @@ OPTIONS
-s, --short
shortened output (suitable for scripting)
```
Example:
@@ -81,26 +83,49 @@ For the full list of generators, refer to the [Generators List](./generators.md)
The `config-help` option provides details about
```bash
```text
openapi-generator-cli help config-help
NAME
openapi-generator-cli config-help - Config help for chosen lang
SYNOPSIS
openapi-generator-cli config-help
[(-f <output format> | --format <output format>)]
[(-f <output format> | --format <output format>)] [--feature-set]
[--full-details]
[(-g <generator name> | --generator-name <generator name>)]
[--markdown-header] [--named-header]
[(-o <output location> | --output <output location>)]
[--import-mappings] [--instantiation-types]
[--language-specific-primitive] [--markdown-header] [--named-header]
[(-o <output location> | --output <output location>)] [--reserved-words]
OPTIONS
-f <output format>, --format <output format>
Write output files in the desired format. Options are 'text',
'markdown' or 'yamlsample'. Default is 'text'.
--feature-set
displays feature set as supported by the generator
--full-details
displays CLI options as well as other configs/mappings (implies
--instantiation-types, --reserved-words,
--language-specific-primitives, --import-mappings,
--supporting-files)
-g <generator name>, --generator-name <generator name>
generator to get config help for
--import-mappings
displays the default import mappings (types and aliases, and what
imports they will pull into the template)
--instantiation-types
displays types used to instantiate simple type/alias names
--language-specific-primitive
displays the language specific primitives (types which require no
additional imports, or which may conflict with user defined model
names)
--markdown-header
When format=markdown, include this option to write out markdown
headers (e.g. for docusaurus).
@@ -112,6 +137,9 @@ OPTIONS
Optionally write help to this location, otherwise default is
standard output
--reserved-words
displays the reserved words which may result in renamed model or
property names
```
The option of note is `-g/--generator-name` (other options are exposed for tooling).
@@ -153,7 +181,7 @@ To pass these go client generator-specific options to the `generate` command for
The `meta` command creates a new Java class and template files, used for creating your own custom templates.
```bash
```text
openapi-generator-cli help meta
NAME
openapi-generator-cli meta - MetaGenerator. Generator for creating a new
@@ -161,11 +189,15 @@ NAME
the language you specify, and includes default templates to include.
SYNOPSIS
openapi-generator-cli meta [(-n <name> | --name <name>)]
openapi-generator-cli meta [(-l <language> | --language <language>)]
[(-n <name> | --name <name>)]
[(-o <output directory> | --output <output directory>)]
[(-p <package> | --package <package>)] [(-t <type> | --type <type>)]
OPTIONS
-l <language>, --language <language>
the implementation language for the generator class
-n <name>, --name <name>
the human-readable name of the generator
@@ -186,7 +218,7 @@ For an in-depth example of using the `meta` command, see [Customization](./custo
The `validate` command allows you to validate an input specification, optionally providing recommendations for error fixes or other improvements (if available).
```bash
```text
openapi-generator-cli help validate
NAME
openapi-generator-cli validate - Validate specification
@@ -200,7 +232,6 @@ OPTIONS
location of the OpenAPI spec, as URL or file (required)
--recommend
```
Valid Spec Example (using [petstore-v3.0.yaml](https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator-gradle-plugin/samples/local-spec/petstore-v3.0.yaml))
@@ -250,7 +281,7 @@ An example bash completion script can be found in the repo at [scripts/openapi-g
The `generate` command is the workhorse of the generator toolset. As such, it has _many_ more options available than the previous commands. The abbreviated options are below, but you may expand the full descriptions.
```bash
```text
openapi-generator-cli help generate
NAME
openapi-generator-cli generate - Generate code with the specified
@@ -269,23 +300,24 @@ SYNOPSIS
[--git-repo-id <git repo id>] [--git-user-id <git user id>]
[--global-property <global properties>...] [--group-id <group id>]
[--http-user-agent <http user agent>]
(-i <spec file> | --input-spec <spec file>)
[(-i <spec file> | --input-spec <spec file>)]
[--ignore-file-override <ignore file override location>]
[--import-mappings <import mappings>...]
[--instantiation-types <instantiation types>...]
[--invoker-package <invoker package>]
[--language-specific-primitives <language specific primitives>...]
[--library <library>] [--log-to-stderr] [--minimal-update]
[--legacy-discriminator-behavior] [--library <library>]
[--log-to-stderr] [--minimal-update]
[--model-name-prefix <model name prefix>]
[--model-name-suffix <model name suffix>]
[--model-package <model package>]
[(-o <output directory> | --output <output directory>)]
[(-p <additional properties> | --additional-properties <additional properties>)...]
[(-o <output directory> | --output <output directory>)] [(-p <additional properties> | --additional-properties <additional properties>)...]
[--package-name <package name>] [--release-note <release note>]
[--remove-operation-id-prefix]
[--reserved-words-mappings <reserved word mappings>...]
[(-s | --skip-overwrite)] [--server-variables <server variables>...]
[--skip-validate-spec] [--strict-spec <true/false strict behavior>]
[--skip-operation-example] [--skip-validate-spec]
[--strict-spec <true/false strict behavior>]
[(-t <template directory> | --template-dir <template directory>)]
[--type-mappings <type mappings>...] [(-v | --verbose)]
```
@@ -293,7 +325,7 @@ SYNOPSIS
<details>
<summary>generate OPTIONS</summary>
```bash
```text
OPTIONS
-a <authorization>, --auth <authorization>
adds authorization headers when fetching the OpenAPI definitions
@@ -303,7 +335,7 @@ OPTIONS
--api-name-suffix <api name suffix>
Suffix that will be appended to all API names ('tags'). Default:
Api. e.g. Pet => PetApi. Note: Only ruby, python, jaxrs generators
suppport this feature at the moment.
support this feature at the moment.
--api-package <api package>
package for generated api classes
@@ -367,7 +399,8 @@ OPTIONS
'OpenAPI-Generator/{packageVersion}/{language}'
-i <spec file>, --input-spec <spec file>
location of the OpenAPI spec, as URL or file (required)
location of the OpenAPI spec, as URL or file (required if not loaded
via config using -c)
--ignore-file-override <ignore file override location>
Specifies an override location for the .openapi-generator-ignore
@@ -394,13 +427,18 @@ OPTIONS
String,boolean,Boolean,Double. You can also have multiple
occurrences of this option.
--legacy-discriminator-behavior
Set to false for generators with better support for discriminators.
(Python, Java, Go, PowerShell, C#have this enabled by default).
--library <library>
library template (sub-template)
--log-to-stderr
write all log messages (not just errors) to STDOUT. Useful for
piping the JSON output of debug options (e.g. `--global-property debugOperations=true`)
to an external parser directly while testing a generator.
piping the JSON output of debug options (e.g. `--global-property
debugOperations`) to an external parser directly while testing a
generator.
--minimal-update
Only write output files that have changed.
@@ -445,6 +483,9 @@ OPTIONS
sets server variables overrides for spec documents which support
variable templating of servers.
--skip-operation-example
Skip examples defined in operations to avoid out of memory errors.
--skip-validate-spec
Skips the default behavior of validating an input specification.
@@ -464,7 +505,6 @@ OPTIONS
-v, --verbose
verbose mode
```
</details>
@@ -604,19 +644,22 @@ The `batch` command allows you to move all CLI arguments supported by the `gener
*NOTE*: This command supports an additional `!include` property which may point to another "shared" file, the base path to which can be
modified by `--includes-base-dir`. Starting with 5.0.0, the `!batch` command supports multiple `!include` properties, either sequential or nested. In order to support multiple `!include` properties in a JSON file, the property name can have a suffix, e.g. `!include1`, `!include2`, etc. The suffix have no meaning other than providing unique property names.
```bash
```text
openapi-generator-cli help batch
NAME
openapi-generator-cli batch - Generate code in batch via external
configs.
SYNOPSIS
openapi-generator-cli batch [--fail-fast]
openapi-generator-cli batch [--clean] [--fail-fast]
[--includes-base-dir <includes>] [(-r <threads> | --threads <threads>)]
[--root-dir <root>] [--timeout <timeout>] [(-v | --verbose)] [--]
<configs>...
OPTIONS
--clean
clean output of previously written files before generation
--fail-fast
fail fast on any errors
@@ -682,7 +725,7 @@ openapi-generator-cli batch *.yaml
This command group contains utilities for authoring generators or customizing templates.
```
```text
openapi-generator-cli help author
NAME
openapi-generator-cli author - Utilities for authoring generators or
@@ -690,9 +733,9 @@ NAME
SYNOPSIS
openapi-generator-cli author
openapi-generator-cli author template [(-v | --verbose)]
openapi-generator-cli author template [--library <library>]
[(-v | --verbose)]
[(-o <output directory> | --output <output directory>)]
[--library <library>]
(-g <generator name> | --generator-name <generator name>)
OPTIONS
@@ -708,13 +751,13 @@ COMMANDS
template
Retrieve templates for local modification
With --library option, library template (sub-template)
With --verbose option, verbose mode
With --output option, where to write the template files (defaults to
'out')
With --library option, library template (sub-template)
With --generator-name option, generator to use (see list command for
list)
```
@@ -723,7 +766,8 @@ COMMANDS
This command allows user to extract templates from the CLI jar which simplifies customization efforts.
```
```text
openapi-generator-cli help author template
NAME
openapi-generator-cli author template - Retrieve templates for local
modification
@@ -753,12 +797,12 @@ Example:
Extract Java templates, limiting to the `webclient` library.
```
```bash
openapi-generator-cli author template -g java --library webclient
```
Extract all Java templates:
```
```bash
openapi-generator-cli author template -g java
```

View File

@@ -1,6 +1,4 @@
FROM java:8-jre-alpine
RUN apk add --no-cache bash
FROM openjdk:11.0-jre-buster
ADD target/openapi-generator-cli.jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar

View File

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

View File

@@ -134,7 +134,8 @@ public class Generate extends OpenApiGeneratorCommand {
title = "type mappings",
description = "sets mappings between OpenAPI spec types and generated code types "
+ "in the format of OpenAPIType=generatedType,OpenAPIType=generatedType. For example: array=List,map=Map,string=String."
+ " You can also have multiple occurrences of this option.")
+ " You can also have multiple occurrences of this option."
+ " To map a specified format, use type+format, e.g. string+password=EncryptedString will map `type: string, format: password` to `EncryptedString`.")
private List<String> typeMappings = new ArrayList<>();
@Option(

View File

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

View File

@@ -26,10 +26,11 @@ import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicLong;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* Represents those settings applied to a generation workflow.
@@ -67,7 +68,7 @@ public class WorkflowSettings {
private String templateDir;
private String templatingEngineName = DEFAULT_TEMPLATING_ENGINE_NAME;
private String ignoreFileOverride;
private ImmutableMap<String, String> globalProperties = DEFAULT_GLOBAL_PROPERTIES;
private ImmutableMap<String, ?> globalProperties = DEFAULT_GLOBAL_PROPERTIES;
private WorkflowSettings(Builder builder) {
this.inputSpec = builder.inputSpec;
@@ -283,7 +284,15 @@ public class WorkflowSettings {
* @return the system properties
*/
public Map<String, String> getGlobalProperties() {
return globalProperties;
return globalProperties.entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, e -> {
if (e.getValue() instanceof List) {
return ((List<?>) e.getValue()).stream()
.map(Object::toString)
.collect(Collectors.joining(","));
}
return String.valueOf(e.getValue());
}));
}
/**

View File

@@ -16,9 +16,6 @@
package org.openapitools.codegen.meta;
import org.openapitools.codegen.meta.features.*;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

View File

@@ -21,7 +21,7 @@ import org.testng.annotations.Test;
import static org.testng.Assert.*;
public class ValidationRuleTest {
class Sample {
static class Sample {
private String name;
public Sample(String name) {

View File

@@ -212,7 +212,7 @@ apply plugin: 'org.openapi.generator'
|typeMappings
|Map(String,String)
|None
|Sets mappings between OpenAPI spec types and generated code types.
|Sets mappings between OpenAPI spec types and generated code types in the format of OpenAPIType=generatedType,OpenAPIType=generatedType. For example: `array=List,map=Map,string=String`. You can also have multiple occurrences of this option. To map a specified format, use type+format, e.g. string+password=EncryptedString will map `type: string, format: password` to `EncryptedString`.
|additionalProperties
|Map(String,Any)

View File

@@ -1,5 +1,5 @@
# RELEASE_VERSION
openApiGeneratorVersion=5.1.0
openApiGeneratorVersion=5.1.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.1.0</version>
<version>5.1.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -1,3 +1,3 @@
# RELEASE_VERSION
openApiGeneratorVersion=5.1.0-SNAPSHOT
openApiGeneratorVersion=5.1.1-SNAPSHOT
# /RELEASE_VERSION

View File

@@ -81,9 +81,8 @@ open class GenerateTask : DefaultTask() {
val outputDir = project.objects.property<String>()
@Suppress("unused")
@get:Internal
@set:Option(option = "input", description = "The input specification.")
@Input
@Internal
var input: String? = null
set(value) {
inputSpec.set(value)

View File

@@ -79,7 +79,7 @@ mvn clean compile
| `configOptions` | N/A | a **map** of language-specific parameters. To show a full list of generator-specified parameters (options), please use `configHelp` (explained below)
| `instantiationTypes` | `openapi.generator.maven.plugin.instantiationTypes` | sets instantiation type mappings in the format of type=instantiatedType,type=instantiatedType. For example (in Java): `array=ArrayList,map=HashMap`. In other words array types will get instantiated as ArrayList in generated code. You can also have multiple occurrences of this option
| `importMappings` | `openapi.generator.maven.plugin.importMappings` | specifies mappings between a given class and the import that should be used for that class in the format of type=import,type=import. You can also have multiple occurrences of this option
| `typeMappings` | `openapi.generator.maven.plugin.typeMappings` | sets mappings between OpenAPI spec types and generated code types in the format of OpenAPIType=generatedType,OpenAPIType=generatedType. For example: `array=List,map=Map,string=String`. You can also have multiple occurrences of this option
| `typeMappings` | `openapi.generator.maven.plugin.typeMappings` | sets mappings between OpenAPI spec types and generated code types in the format of OpenAPIType=generatedType,OpenAPIType=generatedType. For example: `array=List,map=Map,string=String`. You can also have multiple occurrences of this option. To map a specified format, use type+format, e.g. string+password=EncryptedString will map `type: string, format: password` to `EncryptedString`.
| `languageSpecificPrimitives` | `openapi.generator.maven.plugin.languageSpecificPrimitives` | specifies additional language specific primitive types in the format of type1,type2,type3,type3. For example: `String,boolean,Boolean,Double`. You can also have multiple occurrences of this option
| `additionalProperties` | `openapi.generator.maven.plugin.additionalProperties` | sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value. You can also have multiple occurrences of this option
| `serverVariableOverrides` | `openapi.generator.maven.plugin.serverVariableOverrides` | A map of server variable overrides for specs that support server URL templating

View File

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

View File

@@ -15,7 +15,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>5.1.0</version>
<version>5.1.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.1.0</version>
<version>5.1.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<dependencies>
<dependency>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>5.1.0</version>
<version>5.1.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.1.0</version>
<version>5.1.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.1.0</version>
<version>5.1.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.1.0</version>
<version>5.1.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -43,6 +43,7 @@ import com.google.common.io.CharSource;
import io.swagger.v3.parser.util.ClasspathHelper;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
@@ -423,6 +424,9 @@ public class CodeGenMojo extends AbstractMojo {
@Parameter(property = "codegen.configHelp")
private boolean configHelp = false;
@Parameter(defaultValue = "${mojoExecution}", readonly = true)
private MojoExecution mojo;
/**
* The project being built.
*/
@@ -847,7 +851,7 @@ public class CodeGenMojo extends AbstractMojo {
name = Files.getNameWithoutExtension(segments[segments.length - 1]);
}
return new File(output.getPath() + File.separator + ".openapi-generator" + File.separator + name + ".sha256");
return new File(output.getPath() + File.separator + ".openapi-generator" + File.separator + name + "-" + mojo.getExecutionId() + ".sha256");
}
private String getCompileSourceRoot() {

View File

@@ -16,10 +16,20 @@
package org.openapitools.codegen.plugin;
import org.junit.Test;
import org.apache.commons.io.FileUtils;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuilder;
import org.apache.maven.project.ProjectBuildingRequest;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.openapitools.codegen.plugin.stubs.StubUtility;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
public class CodeGenMojoTest extends BaseTestCase {
@@ -30,8 +40,8 @@ public class CodeGenMojoTest extends BaseTestCase {
@SuppressWarnings("unchecked")
public void testCommonConfiguration() throws Exception {
File testPom = StubUtility.basedPath(getUnitTestDir().toFile(), "common-maven", "common-maven.xml").toFile();
final CodeGenMojo mojo = (CodeGenMojo) lookupMojo("generate", testPom);
File folder = Files.createTempDirectory("test").toFile();
CodeGenMojo mojo = loadMojo(folder, "src/test/resources/default");
mojo.execute();
assertEquals("java", getVariableValueFromObject(mojo, "generatorName"));
assertEquals("jersey2", getVariableValueFromObject(mojo, "library"));
@@ -43,4 +53,49 @@ public class CodeGenMojoTest extends BaseTestCase {
assertNotNull(configOptions);
assertEquals("joda", configOptions.get("dateLibrary"));
}
public void testHashGenerationFileContainsExecutionId() throws Exception {
// GIVEN
Path folder = Files.createTempDirectory("test");
CodeGenMojo mojo = loadMojo(folder.toFile(), "src/test/resources/default", "executionId");
// WHEN
mojo.execute();
// THEN
Path hashFolder = folder.resolve("target/generated-sources/common-maven/remote-openapi/.openapi-generator");
assertTrue(hashFolder.resolve("petstore.yaml-executionId.sha256").toFile().exists());
}
protected CodeGenMojo loadMojo(File temporaryFolder, String projectRoot) throws Exception {
return loadMojo(temporaryFolder, projectRoot, "default");
}
protected CodeGenMojo loadMojo(File temporaryFolder, String projectRoot, String executionId) throws Exception {
File file = new File(projectRoot);
FileUtils.copyDirectory(file, temporaryFolder);
MavenProject project = readMavenProject(temporaryFolder);
MavenSession session = newMavenSession(project);
MojoExecution execution = newMojoExecution("generate");
MojoExecution executionWithId = copyWithExecutionId(executionId, execution);
return (CodeGenMojo) lookupConfiguredMojo(session, executionWithId);
}
private MojoExecution copyWithExecutionId(String executionId, MojoExecution execution) {
MojoExecution executionWithId = new MojoExecution(execution.getMojoDescriptor(), executionId);
executionWithId.setConfiguration(execution.getConfiguration());
return executionWithId;
}
protected MavenProject readMavenProject(File basedir)
throws Exception {
File pom = new File(basedir, "pom.xml");
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
request.setBaseDirectory(basedir);
ProjectBuildingRequest configuration = request.getProjectBuildingRequest();
configuration.setRepositorySession(new DefaultRepositorySystemSession());
MavenProject project = lookup(ProjectBuilder.class).build(pom, configuration).getProject();
assertNotNull(project);
return project;
}
}

View File

@@ -29,8 +29,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<configuration>
<project implementation="org.openapitools.codegen.plugin.stubs.CommonMavenProjectStub"/>
<inputSpec>${basedir}/src/test/resources/unit/common-maven/petstore.yaml</inputSpec>
<inputSpec>${basedir}/petstore.yaml</inputSpec>
<generatorName>java</generatorName>
<configOptions>
<dateLibrary>joda</dateLibrary>
@@ -43,7 +42,7 @@
</configuration>
<executions>
<execution>
<id>default</id>
<id>executionId</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>

View File

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

View File

@@ -42,7 +42,7 @@ public class OpenAPI2SpringBoot implements CommandLineRunner {
new SpringApplication(OpenAPI2SpringBoot.class).run(args);
}
class ExitException extends RuntimeException implements ExitCodeGenerator {
static class ExitException extends RuntimeException implements ExitCodeGenerator {
private static final long serialVersionUID = 1L;
@Override

View File

@@ -31,8 +31,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Properties;

View File

@@ -19,7 +19,6 @@ package org.openapitools.codegen.online.service;
import com.fasterxml.jackson.databind.JsonNode;
import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.core.util.Json;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.parser.core.models.AuthorizationValue;
import io.swagger.v3.parser.core.models.ParseOptions;

View File

@@ -30,7 +30,7 @@ import java.util.zip.ZipOutputStream;
/**
* This utility compresses a list of files to standard ZIP format file. It is able to compresses all
* sub files and sub directories, recursively.
*
*
* @author Ha Minh Nam
*
*/
@@ -42,7 +42,7 @@ public class ZipUtil {
/**
* Compresses a collection of files to a destination zip file.
*
*
* @param listFiles A collection of files and directories
* @param destZipFile The path of the destination zip file
* @throws FileNotFoundException if file not found
@@ -67,7 +67,7 @@ public class ZipUtil {
/**
* Adds a directory to the current zip output stream.
*
*
* @param folder the directory to be added
* @param parentFolder the path of parent directory
* @param zos the current zip output stream
@@ -99,7 +99,7 @@ public class ZipUtil {
/**
* Adds a file to the current zip output stream.
*
*
* @param file the file to be added
* @param zos the current zip output stream
* @throws FileNotFoundException if file not found

View File

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

View File

@@ -77,7 +77,7 @@ public class CliOption {
public String getOptValue() {
return this.optValue;
}
public void setOptValue(String optValue) {
if (this.enumValues!=null && this.enumValues.containsKey(optValue)) {
this.optValue = optValue;
@@ -106,7 +106,7 @@ public class CliOption {
/**
* Create new boolean command line option with a default of false
*
*
* @param opt Option name
* @param description Option description
* @return the CliOption created
@@ -117,7 +117,7 @@ public class CliOption {
/**
* Create new boolean command line option with the provided value as default
*
*
* @param opt Option name
* @param description Option description
* @param defaultValue the default value to use if option not specified

View File

@@ -123,9 +123,9 @@ public interface CodegenConfig {
List<CodegenSecurity> fromSecurity(Map<String, SecurityScheme> schemas);
List<CodegenServer> fromServers(List<Server> servers);
List<CodegenServerVariable> fromServerVariables(Map<String, ServerVariable> variables);
Set<String> defaultIncludes();
Map<String, String> typeMapping();

View File

@@ -206,7 +206,7 @@ public class CodegenConstants {
public static final String MODEL_PROPERTY_NAMING_DESC = "Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name";
public static final String DOTNET_FRAMEWORK = "targetFramework";
public static final String DOTNET_FRAMEWORK_DESC = "The target .NET framework version.";
public static final String DOTNET_FRAMEWORK_DESC = "The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.0`";
public static final String TEMPLATING_ENGINE = "templatingEngine";
public static final String TEMPLATING_ENGINE_DESC = "The templating engine plugin to use: \"mustache\" (default) or \"handlebars\" (beta)";

View File

@@ -1,7 +1,5 @@
package org.openapitools.codegen;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.util.TreeSet;
import java.util.Map;
import java.util.Objects;

View File

@@ -53,7 +53,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public String name;
// The language-specific name of the class that implements this schema.
// The name of the class is derived from the OpenAPI schema name with formatting rules applied.
// The classname is derived from the OpenAPI schema name, with sanitization and escaping rules applied.
// The classname is derived from the OpenAPI schema name, with sanitization and escaping rules applied.
public String classname;
// The value of the 'title' attribute in the OpenAPI document.
public String title;
@@ -109,7 +109,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
/**
* The type of the value for the additionalProperties keyword in the OAS document.
* Used in map like objects, including composed schemas.
*
*
* In most programming languages, the additional (undeclared) properties are stored
* in a map data structure, such as HashMap in Java, map in golang, or a dict in Python.
* There are multiple ways to implement the additionalProperties keyword, depending
@@ -122,7 +122,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
*
* For example, in the OAS schema below, the schema has a declared 'id' property
* and additional, undeclared properties of type 'integer' are allowed.
*
*
* type: object
* properties:
* id:
@@ -232,7 +232,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
* Return true if the classname property is sanitized, false if it is the same as the OpenAPI schema name.
* The OpenAPI schema name may be any valid JSON schema name, including non-ASCII characters.
* The name of the class may have to be sanitized with character escaping.
*
*
* @return true if the classname property is sanitized
*/
public boolean getIsClassnameSanitized() {
@@ -273,7 +273,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
/**
* Returns the discriminator for this schema object, or null if no discriminator has been specified.
*
*
* The list of all possible schema discriminator mapping values is obtained
* from explicit discriminator mapping values in the OpenAPI document, and from
* inherited discriminators through oneOf, allOf, anyOf.
@@ -283,7 +283,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
* 'objectType' properties are 'Dog' and 'Cat'.
* The allowed discriminator mapping value for the Dog schema is 'Dog'.
* The allowed discriminator mapping value for the Cat schema is 'Dog'.
*
*
* Pet:
* type: object
* discriminator:
@@ -307,7 +307,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
* properties:
* p2:
* type: string
*
*
* @return the discriminator.
*/
public CodegenDiscriminator getDiscriminator() {
@@ -323,7 +323,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
* In the OpenAPI document, the discriminator may be specified in the local schema or
* it may be inherited, such as through a 'allOf' schema which references another schema
* that has a discriminator, recursively.
*
*
* @return the name of the discriminator property.
*/
public String getDiscriminatorName() {

View File

@@ -29,9 +29,9 @@ public class CodegenOperation {
isArray, isMultipart,
isResponseBinary = false, isResponseFile = false, hasReference = false,
isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
isRestful, isDeprecated, isCallbackRequest, uniqueItems;
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false;
public String path, operationId, returnType, returnFormat, httpMethod, returnBaseType,
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse;
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse;
public CodegenDiscriminator discriminator;
public List<Map<String, String>> consumes, produces, prioritizedContentTypes;
public List<CodegenServer> servers = new ArrayList<CodegenServer>();
@@ -168,6 +168,15 @@ public class CodegenOperation {
return nonempty(examples);
}
/**
* Check if there's a default response
*
* @return true if responses contain a default response, false otherwise
*/
public boolean getHasDefaultResponse() {
return responses.stream().filter(response -> response.isDefault).findFirst().isPresent();
}
/**
* Check if act as Restful index method
*
@@ -270,6 +279,7 @@ public class CodegenOperation {
sb.append(", isResponseBinary=").append(isResponseBinary);
sb.append(", isResponseFile=").append(isResponseFile);
sb.append(", hasReference=").append(hasReference);
sb.append(", hasDefaultResponse=").append(hasDefaultResponse);
sb.append(", isRestfulIndex=").append(isRestfulIndex);
sb.append(", isRestfulShow=").append(isRestfulShow);
sb.append(", isRestfulCreate=").append(isRestfulCreate);
@@ -343,6 +353,7 @@ public class CodegenOperation {
isResponseBinary == that.isResponseBinary &&
isResponseFile == that.isResponseFile &&
hasReference == that.hasReference &&
hasDefaultResponse == that.hasDefaultResponse &&
isRestfulIndex == that.isRestfulIndex &&
isRestfulShow == that.isRestfulShow &&
isRestfulCreate == that.isRestfulCreate &&
@@ -400,7 +411,7 @@ public class CodegenOperation {
return Objects.hash(responseHeaders, hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams,
hasRequiredParams, returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap,
isArray, isMultipart, isResponseBinary, isResponseFile, hasReference, isRestfulIndex,
isArray, isMultipart, isResponseBinary, isResponseFile, hasReference, hasDefaultResponse, isRestfulIndex,
isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy, isRestful, isDeprecated,
isCallbackRequest, uniqueItems, path, operationId, returnType, httpMethod, returnBaseType,
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse, discriminator, consumes,

View File

@@ -157,7 +157,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
public Map<String, Object> allowableValues;
// If 'additionalProperties' is not set, items is null.
// If 'additionalProperties' is set to a type or refers to a type, 'items' provides the type information for
// the undeclared properties.
// the undeclared properties.
public CodegenProperty items;
public CodegenProperty additionalProperties;
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>(); // all properties (without parent's properties)

View File

@@ -20,7 +20,6 @@ package org.openapitools.codegen;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
@@ -40,7 +39,7 @@ public class CodegenSecurity {
public String keyParamName;
public Boolean isKeyInQuery, isKeyInHeader, isKeyInCookie;
// Oauth specific
public String flow, authorizationUrl, tokenUrl;
public String flow, authorizationUrl, tokenUrl, refreshUrl;
public List<Map<String, Object>> scopes;
public Boolean isCode, isPassword, isApplication, isImplicit;
@@ -67,6 +66,7 @@ public class CodegenSecurity {
filteredSecurity.flow = flow;
filteredSecurity.tokenUrl = tokenUrl;
filteredSecurity.authorizationUrl = authorizationUrl;
filteredSecurity.refreshUrl = refreshUrl;
// It is not possible to deep copy the extensions, as we have no idea what types they are.
// So the filtered method *will* refer to the original extensions, if any.
filteredSecurity.vendorExtensions = new HashMap<String, Object>(vendorExtensions);
@@ -110,6 +110,7 @@ public class CodegenSecurity {
Objects.equals(flow, that.flow) &&
Objects.equals(authorizationUrl, that.authorizationUrl) &&
Objects.equals(tokenUrl, that.tokenUrl) &&
Objects.equals(refreshUrl, that.refreshUrl) &&
Objects.equals(scopes, that.scopes) &&
Objects.equals(isCode, that.isCode) &&
Objects.equals(isPassword, that.isPassword) &&
@@ -123,7 +124,7 @@ public class CodegenSecurity {
return Objects.hash(name, type, scheme, isBasic, isOAuth, isApiKey,
isBasicBasic, isHttpSignature, isBasicBearer, bearerFormat, vendorExtensions,
keyParamName, isKeyInQuery, isKeyInHeader, isKeyInCookie, flow,
authorizationUrl, tokenUrl, scopes, isCode, isPassword, isApplication, isImplicit);
authorizationUrl, tokenUrl, refreshUrl, scopes, isCode, isPassword, isApplication, isImplicit);
}
@Override
@@ -147,6 +148,7 @@ public class CodegenSecurity {
sb.append(", flow='").append(flow).append('\'');
sb.append(", authorizationUrl='").append(authorizationUrl).append('\'');
sb.append(", tokenUrl='").append(tokenUrl).append('\'');
sb.append(", refreshUrl='").append(refreshUrl).append('\'');
sb.append(", scopes=").append(scopes);
sb.append(", isCode=").append(isCode);
sb.append(", isPassword=").append(isPassword);

View File

@@ -461,7 +461,7 @@ public class DefaultCodegen implements CodegenConfig {
/**
* Return a map from model name to Schema for efficient lookup.
*
*
* @return map from model name to Schema.
*/
protected Map<String, Schema> getModelNameToSchemaCache() {
@@ -813,11 +813,13 @@ public class DefaultCodegen implements CodegenConfig {
schemas.put(opId, requestSchema);
}
// process all response bodies
for (Map.Entry<String, ApiResponse> ar : op.getValue().getResponses().entrySet()) {
ApiResponse a = ModelUtils.getReferencedApiResponse(openAPI, ar.getValue());
Schema responseSchema = ModelUtils.getSchemaFromResponse(a);
if (responseSchema != null) {
schemas.put(opId + ar.getKey(), responseSchema);
if (op.getValue().getResponses() != null) {
for (Map.Entry<String, ApiResponse> ar : op.getValue().getResponses().entrySet()) {
ApiResponse a = ModelUtils.getReferencedApiResponse(openAPI, ar.getValue());
Schema responseSchema = ModelUtils.getSchemaFromResponse(a);
if (responseSchema != null) {
schemas.put(opId + ar.getKey(), responseSchema);
}
}
}
}
@@ -2041,6 +2043,10 @@ public class DefaultCodegen implements CodegenConfig {
private String getPrimitiveType(Schema schema) {
if (schema == null) {
throw new RuntimeException("schema cannot be null in getPrimitiveType");
} else if (typeMapping.containsKey(schema.getType() + "+" + schema.getFormat())) {
// allows custom type_format mapping.
// use {type}+{format}
return typeMapping.get(schema.getType() + "+" + schema.getFormat());
} else if (ModelUtils.isNullType(schema)) {
// The 'null' type is allowed in OAS 3.1 and above. It is not supported by OAS 3.0.x,
// though this tooling supports it.
@@ -2615,35 +2621,47 @@ public class DefaultCodegen implements CodegenConfig {
}
private void setAddProps(Schema schema, IJsonSchemaValidationProperties property){
if (schema.equals(new Schema())) {
// if we are trying to set additionalProperties on an empty schema stop recursing
return;
}
boolean additionalPropertiesIsAnyType = false;
CodegenModel m = null;
if (property instanceof CodegenModel) {
m = (CodegenModel) property;
}
CodegenProperty addPropProp = null;
boolean isAdditionalPropertiesTrue = false;
if (schema.getAdditionalProperties() == null) {
if (!disallowAdditionalPropertiesIfNotPresent) {
isAdditionalPropertiesTrue = true;
CodegenProperty cp = fromProperty("", new Schema());
property.setAdditionalProperties(cp);
property.setAdditionalPropertiesIsAnyType(true);
addPropProp = fromProperty("", new Schema());
additionalPropertiesIsAnyType = true;
}
} else if (schema.getAdditionalProperties() instanceof Boolean) {
if (Boolean.TRUE.equals(schema.getAdditionalProperties())) {
isAdditionalPropertiesTrue = true;
CodegenProperty cp = fromProperty("", new Schema());
property.setAdditionalProperties(cp);
property.setAdditionalPropertiesIsAnyType(true);
addPropProp = fromProperty("", new Schema());
additionalPropertiesIsAnyType = true;
}
} else {
CodegenProperty cp = fromProperty("", (Schema) schema.getAdditionalProperties());
property.setAdditionalProperties(cp);
addPropProp = fromProperty("", (Schema) schema.getAdditionalProperties());
if (isAnyTypeSchema((Schema) schema.getAdditionalProperties())) {
property.setAdditionalPropertiesIsAnyType(true);
additionalPropertiesIsAnyType = true;
}
}
if (additionalPropertiesIsAnyType) {
property.setAdditionalPropertiesIsAnyType(true);
}
if (m != null && isAdditionalPropertiesTrue) {
m.isAdditionalPropertiesTrue = true;
}
if (ModelUtils.isComposedSchema(schema) && !supportsAdditionalPropertiesWithComposedSchema) {
return;
}
if (addPropProp != null) {
property.setAdditionalProperties(addPropProp);
}
}
@@ -2688,14 +2706,14 @@ public class DefaultCodegen implements CodegenConfig {
String modelName = ModelUtils.getSimpleRef(oneOf.get$ref());
CodegenProperty thisCp = discriminatorFound(composedSchemaName, oneOf, discPropName, openAPI);
if (thisCp == null) {
throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced OneOf schema '" + modelName + "' is missing " + discPropName);
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced OneOf schema '" + modelName + "' is missing " + discPropName);
}
if (cp.dataType == null) {
cp = thisCp;
continue;
}
if (cp != thisCp) {
throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the OneOf schema '" + modelName + "' has a different " + discPropName + " definition than the prior OneOf schema's. Make sure the " + discPropName + " type and required values are the same");
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the OneOf schema '" + modelName + "' has a different " + discPropName + " definition than the prior OneOf schema's. Make sure the " + discPropName + " type and required values are the same");
}
}
return cp;
@@ -2707,14 +2725,14 @@ public class DefaultCodegen implements CodegenConfig {
String modelName = ModelUtils.getSimpleRef(anyOf.get$ref());
CodegenProperty thisCp = discriminatorFound(composedSchemaName, anyOf, discPropName, openAPI);
if (thisCp == null) {
throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced AnyOf schema '" + modelName + "' is missing " + discPropName);
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced AnyOf schema '" + modelName + "' is missing " + discPropName);
}
if (cp.dataType == null) {
cp = thisCp;
continue;
}
if (cp != thisCp) {
throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the AnyOf schema '" + modelName + "' has a different " + discPropName + " definition than the prior AnyOf schema's. Make sure the " + discPropName + " type and required values are the same");
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the AnyOf schema '" + modelName + "' has a different " + discPropName + " definition than the prior AnyOf schema's. Make sure the " + discPropName + " type and required values are the same");
}
}
return cp;
@@ -2773,7 +2791,7 @@ public class DefaultCodegen implements CodegenConfig {
}
}
if (discriminatorsPropNames.size() > 1) {
throw new RuntimeException("The oneOf schemas have conflicting discriminator property names. " +
LOGGER.warn("The oneOf schemas have conflicting discriminator property names. " +
"oneOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames));
}
if (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getOneOf().size() && discriminatorsPropNames.size() == 1) {
@@ -2802,7 +2820,7 @@ public class DefaultCodegen implements CodegenConfig {
}
}
if (discriminatorsPropNames.size() > 1) {
throw new RuntimeException("The anyOf schemas have conflicting discriminator property names. " +
LOGGER.warn("The anyOf schemas have conflicting discriminator property names. " +
"anyOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames));
}
if (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getAnyOf().size() && discriminatorsPropNames.size() == 1) {
@@ -2852,7 +2870,7 @@ public class DefaultCodegen implements CodegenConfig {
// schemas also has inline composed schemas
// Note: if it is only inline one level, then the inline model resolver will move it into its own
// schema and make it a $ref schema in the oneOf/anyOf location
throw new RuntimeException("Invalid inline schema defined in oneOf/anyOf in '" + composedSchemaName + "'. Per the OpenApi spec, for this case when a composed schema defines a discriminator, the oneOf/anyOf schemas must use $ref. Change this inline definition to a $ref definition");
LOGGER.warn("Invalid inline schema defined in oneOf/anyOf in '" + composedSchemaName + "'. Per the OpenApi spec, for this case when a composed schema defines a discriminator, the oneOf/anyOf schemas must use $ref. Change this inline definition to a $ref definition");
}
CodegenProperty df = discriminatorFound(composedSchemaName, sc, discPropName, openAPI);
String modelName = ModelUtils.getSimpleRef(ref);
@@ -2872,7 +2890,7 @@ public class DefaultCodegen implements CodegenConfig {
msgSuffix += spacer + "invalid optional definition of " + discPropName + ", include it in required";
}
}
throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced schema '" + modelName + "' is incorrect. " + msgSuffix);
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced schema '" + modelName + "' is incorrect. " + msgSuffix);
}
MappedModel mm = new MappedModel(modelName, toModelName(modelName));
descendentSchemas.add(mm);
@@ -3078,7 +3096,7 @@ public class DefaultCodegen implements CodegenConfig {
/**
* Convert OAS Property object to Codegen Property object.
*
*
* The return value is cached. An internal cache is looked up to determine
* if the CodegenProperty return value has already been instantiated for
* the (String name, Schema p) arguments.
@@ -4711,13 +4729,13 @@ public class DefaultCodegen implements CodegenConfig {
* of the 'additionalProperties' keyword. Some language generator use class inheritance
* to implement additional properties. For example, in Java the generated model class
* has 'extends HashMap' to represent the additional properties.
*
*
* TODO: it's not a good idea to use single class inheritance to implement
* additionalProperties. That may work for non-composed schemas, but that does not
* work for composed 'allOf' schemas. For example, in Java, if additionalProperties
* is set to true (which it should be by default, per OAS spec), then the generated
* code has extends HashMap. That wouldn't work for composed 'allOf' schemas.
*
*
* @param model the codegen representation of the OAS schema.
* @param name the name of the model.
* @param schema the input OAS schema.
@@ -5585,6 +5603,7 @@ public class DefaultCodegen implements CodegenConfig {
private void setOauth2Info(CodegenSecurity codegenSecurity, OAuthFlow flow) {
codegenSecurity.authorizationUrl = flow.getAuthorizationUrl();
codegenSecurity.tokenUrl = flow.getTokenUrl();
codegenSecurity.refreshUrl = flow.getRefreshUrl();
if (flow.getScopes() != null && !flow.getScopes().isEmpty()) {
List<Map<String, Object>> scopes = new ArrayList<>();
@@ -6157,6 +6176,7 @@ public class DefaultCodegen implements CodegenConfig {
}
private void addVarsRequiredVarsAdditionalProps(Schema schema, IJsonSchemaValidationProperties property){
setAddProps(schema, property);
if (!"object".equals(schema.getType())) {
return;
}
@@ -6178,7 +6198,6 @@ public class DefaultCodegen implements CodegenConfig {
property.setHasRequired(true);
}
}
setAddProps(schema, property);
}
private void addJsonSchemaForBodyRequestInCaseItsNotPresent(CodegenParameter codegenParameter, RequestBody body) {
@@ -6600,7 +6619,7 @@ public class DefaultCodegen implements CodegenConfig {
/**
* Returns the additionalProperties Schema for the specified input schema.
*
*
* The additionalProperties keyword is used to control the handling of additional, undeclared
* properties, that is, properties whose names are not listed in the properties keyword.
* The additionalProperties keyword may be either a boolean or an object.
@@ -6608,7 +6627,7 @@ public class DefaultCodegen implements CodegenConfig {
* By default when the additionalProperties keyword is not specified in the input schema,
* any additional properties are allowed. This is equivalent to setting additionalProperties
* to the boolean value True or setting additionalProperties: {}
*
*
* @param schema the input schema that may or may not have the additionalProperties keyword.
* @return the Schema of the additionalProperties. The null value is returned if no additional
* properties are allowed.

View File

@@ -29,7 +29,6 @@ import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.responses.ApiResponses;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -38,7 +38,7 @@ import java.util.*;
* </ul>
* <p>
* The corresponding {@code add...} method on the passed configurator is called for each key-value pair (or value).
* </p>
* </p>
*/
public final class CodegenConfiguratorUtils {
@@ -60,7 +60,7 @@ public final class CodegenConfiguratorUtils {
applyInstantiationTypesKvp(propString, configurator);
}
}
public static void applyInstantiationTypesKvp(String instantiationTypes, CodegenConfigurator configurator) {
final Map<String, String> map = createMapFromKeyValuePairs(instantiationTypes);
for (Map.Entry<String, String> entry : map.entrySet()) {
@@ -143,9 +143,9 @@ public final class CodegenConfiguratorUtils {
final Map<String, String> map = createMapFromKeyValuePairs(reservedWordMappings);
for (Map.Entry<String, String> entry : map.entrySet()) {
configurator.addAdditionalReservedWordMapping(entry.getKey(), entry.getValue());
}
}
}
private static Set<String> createSetFromCsvList(String csvProperty) {
final List<String> values = OptionUtils.splitCommaSeparatedList(csvProperty);
return new HashSet<String>(values);

View File

@@ -25,7 +25,7 @@ import java.util.Properties;
*
* This provides a set of properties specific to the executing thread, such that the generator may not modify system properties
* consumed by other threads.
*
*
* @author gndrm
* @since 2018
*/

View File

@@ -32,7 +32,6 @@ import org.slf4j.LoggerFactory;
import java.util.*;
import static org.openapitools.codegen.utils.OnceLogger.once;
import static org.openapitools.codegen.utils.StringUtils.camelize;
public abstract class AbstractApexCodegen extends DefaultCodegen implements CodegenConfig {

View File

@@ -32,9 +32,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.util.*;
import static org.openapitools.codegen.utils.OnceLogger.once;
import static org.openapitools.codegen.utils.StringUtils.camelize;
public abstract class AbstractCSharpCodegen extends DefaultCodegen implements CodegenConfig {
@@ -399,7 +399,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
// check to see if model name is same as the property name
// which will result in compilation error
// if found, prepend with _ to workaround the limitation
if (var.name.equalsIgnoreCase(cm.name)) {
if (var.name.equalsIgnoreCase(cm.classname)) {
var.name = "_" + var.name;
}
}
@@ -500,6 +500,12 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
}
}
/* Comment out the following as model.dataType is always the model name, eg. OuterIntegerEnum,
* and this will fix the integer enum via #9035.
* Only x-enum-byte is used in the template but it won't work due to the bug mentioned above.
* A better solution is to introduce isLong, isInteger, etc in the DefaultCodegen
* so that there is no need for each generator to post-process model enums.
*
// We're looping all models here.
if (model.isEnum) {
// We now need to make allowableValues.enumVars look like the context of CodegenProperty
@@ -543,7 +549,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
if (!newEnumVars.isEmpty()) {
model.allowableValues.put("enumVars", newEnumVars);
}
}
} */
} else {
LOGGER.warn("Expected to retrieve model %s by name, but no model was found. Check your -Dmodels inclusions.", openAPIName);
}
@@ -570,7 +576,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
var.isString = false;
var.isLong = false;
var.isInteger = false;
} else if ("int32".equals(var.dataFormat)) {
} else if ("int".equals(var.dataType) || "int32".equals(var.dataFormat)) {
var.isInteger = true;
var.isString = false;
var.isLong = false;
@@ -1263,8 +1269,10 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
} else {
LOGGER.info("Successfully executed: " + command);
}
} catch (Exception e) {
} catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
// Restore interrupted state
Thread.currentThread().interrupt();
}
}
}

View File

@@ -40,6 +40,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
@@ -330,8 +331,10 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
} else {
LOGGER.info("Successfully executed: " + command);
}
} catch (Exception e) {
} catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
// Restore interrupted state
Thread.currentThread().interrupt();
}
}
}

View File

@@ -1,6 +1,7 @@
package org.openapitools.codegen.languages;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.media.ArraySchema;
@@ -17,6 +18,7 @@ import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.*;
@@ -50,9 +52,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
protected String apiTestPath = "test" + File.separator;
protected String modelTestPath = "test" + File.separator;
// Names that must not be used as model names because they clash with existing
// default imports (dart:io, dart:async, package:http etc.) but are not basic dataTypes.
protected Set<String> additionalReservedWords;
protected Map<String, String> imports = new HashMap<>();
public AbstractDartCodegen() {
super();
@@ -111,13 +111,13 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
}
setReservedWordsLowerCase(reservedWordsList);
// These types return isPrimitive=true in templates
languageSpecificPrimitives = Sets.newHashSet(
"String",
"bool",
"int",
"num",
"double",
"dynamic"
"double"
);
typeMapping = new HashMap<>();
@@ -148,29 +148,31 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
typeMapping.put("object", "Object");
typeMapping.put("AnyType", "Object");
// DataTypes of the above values which are automatically imported.
// They are also not allowed to be model names.
// Data types of the above values which are automatically imported
defaultIncludes = Sets.newHashSet(
"String",
"bool",
"int",
"num",
"double",
"dynamic",
"List",
"Set",
"Map",
"DateTime",
"Object",
"MultipartFile"
"Object"
);
additionalReservedWords = Sets.newHashSet(
"File",
"Client",
"Future",
"Response"
);
imports.put("String", "dart:core");
imports.put("bool", "dart:core");
imports.put("int", "dart:core");
imports.put("num", "dart:core");
imports.put("double", "dart:core");
imports.put("List", "dart:core");
imports.put("Set", "dart:core");
imports.put("Map", "dart:core");
imports.put("DateTime", "dart:core");
imports.put("Object", "dart:core");
imports.put("MultipartFile", "package:http/http.dart");
cliOptions.add(new CliOption(PUB_LIBRARY, "Library name in generated code"));
cliOptions.add(new CliOption(PUB_NAME, "Name in generated pubspec"));
@@ -181,7 +183,6 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
cliOptions.add(new CliOption(PUB_HOMEPAGE, "Homepage in generated pubspec"));
cliOptions.add(new CliOption(USE_ENUM_EXTENSION, "Allow the 'x-enum-values' extension for enums"));
cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, "Source folder for generated code"));
}
@Override
@@ -278,13 +279,17 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
}
}
@Override
protected boolean needToImport(String type) {
// Import everything, unless it is from dart:core.
return StringUtils.isNotBlank(type) && (!imports.containsKey(type) || !imports.get(type).equals("dart:core"));
}
@Override
protected boolean isReservedWord(String word) {
// consider everything as reserved that is either a keyword,
// a default included type, or a type include through some library
return super.isReservedWord(word) ||
defaultIncludes().contains(word) ||
additionalReservedWords.contains(word);
return super.isReservedWord(word) || defaultIncludes().contains(word);
}
@Override
@@ -366,32 +371,46 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
@Override
public String toModelName(final String name) {
String nameWithPrefixSuffix = sanitizeName(name);
String sanitizedName = sanitizeName(name);
if (!StringUtils.isEmpty(modelNamePrefix)) {
// add '_' so that model name can be camelized correctly
nameWithPrefixSuffix = modelNamePrefix + "_" + nameWithPrefixSuffix;
sanitizedName = modelNamePrefix + "_" + sanitizedName;
}
if (!StringUtils.isEmpty(modelNameSuffix)) {
// add '_' so that model name can be camelized correctly
nameWithPrefixSuffix = nameWithPrefixSuffix + "_" + modelNameSuffix;
sanitizedName = sanitizedName + "_" + modelNameSuffix;
}
// camelize the model name
// phone_number => PhoneNumber
final String camelizedName = camelize(nameWithPrefixSuffix);
final String camelizedName = camelize(sanitizedName);
// Check if there is a mapping that can be used
if (typeMapping().containsKey(camelizedName)) {
String typeName = typeMapping().get(camelizedName);
if (imports.containsKey(typeName)) {
// Anything with an import mapping is likely
// generator specific and can not be used as model name.
final String modelName = "Model" + camelizedName;
LOGGER.warn("{} (existing type) cannot be used as model name. Renamed to {}", camelizedName, modelName);
return modelName;
}
return typeName;
}
// model name cannot use reserved keyword, e.g. return
if (isReservedWord(camelizedName)) {
final String modelName = "Model" + camelizedName;
LOGGER.warn(camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName);
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", camelizedName, modelName);
return modelName;
}
// model name starts with number
if (camelizedName.matches("^\\d.*")) {
final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize)
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name, modelName);
return modelName;
}
@@ -470,13 +489,10 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
public String getSchemaType(Schema p) {
String openAPIType = super.getSchemaType(p);
if (openAPIType == null) {
LOGGER.error("No Type defined for Schema " + p);
LOGGER.error("No Type defined for Schema {}", p);
}
if (typeMapping.containsKey(openAPIType)) {
return typeMapping.get(openAPIType);
}
if (languageSpecificPrimitives.contains(openAPIType)) {
return openAPIType;
if (typeMapping().containsKey(openAPIType)) {
return typeMapping().get(openAPIType);
}
return toModelName(openAPIType);
}
@@ -600,14 +616,15 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
// method name cannot use reserved keyword, e.g. return
if (isReservedWord(operationId)) {
String newOperationId = camelize("call_" + operationId, true);
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId);
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
return newOperationId;
}
// operationId starts with a number
if (operationId.matches("^\\d.*")) {
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize("call_" + operationId), true);
operationId = camelize("call_" + operationId, true);
String newOperationId = camelize("call_" + operationId, true);
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, newOperationId);
operationId = newOperationId;
}
return operationId;
@@ -684,36 +701,11 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
} else {
LOGGER.info("Successfully executed: {}", command);
}
} catch (Exception e) {
} catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
// Restore interrupted state
Thread.currentThread().interrupt();
}
}
}
@Override
public void postProcess() {
if (isEnablePostProcessFile()) {
// Using the condition here to have way to still disable this
// for older Dart generators in CI by default.
// Post processing the whole dart output is much faster then individual files.
// Setting this variable to "dart format" is the suggested way of doing this.
final String dartPostProcess = System.getenv("DART_POST_PROCESS");
if (!StringUtils.isEmpty(dartPostProcess)) {
final String command = dartPostProcess + " " + getOutputDir();
try {
Process p = Runtime.getRuntime().exec(command);
int exitValue = p.waitFor();
if (exitValue != 0) {
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
} else {
LOGGER.info("Successfully executed: {}", command);
}
} catch (Exception e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
}
}
}
super.postProcess();
}
}

View File

@@ -31,7 +31,6 @@ import org.slf4j.LoggerFactory;
import java.util.*;
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.openapitools.codegen.utils.OnceLogger.once;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import static org.openapitools.codegen.utils.StringUtils.underscore;
@@ -91,7 +90,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
instantiationTypes.put("array", "ARRAYED_LIST");
instantiationTypes.put("list", "ARRAYED_LIST");
instantiationTypes.put("map", "STRING_TABLE");
importMapping.put("List", "LIST");
importMapping.put("Set", "SET");
importMapping.put("file", "FILE");
@@ -153,7 +152,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
name = escapeReservedWord(name);
}
// for reserved word or word starting with number, append
// for reserved word or word starting with number, append
if (name.matches("^\\d.*")) {
name = escapeReservedWord(name);
}
@@ -349,7 +348,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
+ camelize("call_" + operationId));
sanitizedOperationId = "call_" + sanitizedOperationId;
}
// operationId starts with a number
if (operationId.matches("^\\d.*")) {
LOGGER.warn(operationId + " (starting with a number) cannot be used as method sname. Renamed to " + camelize("call_" + operationId), true);

View File

@@ -30,9 +30,8 @@ import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.Exception;
import java.io.File;
import java.io.IOException;
import java.util.*;
import static org.openapitools.codegen.utils.StringUtils.camelize;
@@ -1124,8 +1123,10 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
} else {
LOGGER.info("Successfully executed: " + command);
}
} catch (Exception e) {
} catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
// Restore interrupted state
Thread.currentThread().interrupt();
}
}
}

View File

@@ -27,6 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.util.*;
import static org.openapitools.codegen.utils.StringUtils.camelize;
@@ -310,16 +311,17 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
@Override
public String toApiFilename(String name) {
final String apiName;
// replace - with _ e.g. created-at => created_at
name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
String api = name.replaceAll("-", "_");
// e.g. PetApi.go => pet_api.go
name = "api_" + underscore(name);
if (isReservedFilename(name)) {
LOGGER.warn(name + ".go with suffix (reserved word) cannot be used as filename. Renamed to " + name + "_.go");
name += "_";
api = "api_" + underscore(api);
if (isReservedFilename(api)) {
LOGGER.warn(name + ".go with suffix (reserved word) cannot be used as filename. Renamed to " + api + "_.go");
api += "_";
}
return name;
apiName = api;
return apiName;
}
/**
@@ -594,7 +596,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
// The 'go-experimental/model.mustache' template conditionally generates accessor methods.
// For primitive types and custom types (e.g. interface{}, map[string]interface{}...),
// the generated code has a wrapper type and a Get() function to access the underlying type.
// For containers (e.g. Array, Map), the generated code returns the type directly.
// For containers (e.g. Array, Map), the generated code returns the type directly.
if (property.isContainer || property.isFreeFormObject || property.isAnyType) {
property.vendorExtensions.put("x-golang-is-container", true);
}
@@ -787,6 +789,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
@Override
public String toDefaultValue(Schema schema) {
schema = ModelUtils.unaliasSchema(this.openAPI, schema);
if (schema.getDefault() != null) {
return schema.getDefault().toString();
} else {
@@ -805,7 +808,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
return; // skip if GO_POST_PROCESS_FILE env variable is not defined
}
// only procees the following type (or we can simply rely on the file extension to check if it's a Go file)
// only process the following type (or we can simply rely on the file extension to check if it's a Go file)
Set<String> supportedFileType = new HashSet<String>(
Arrays.asList(
"supporting-mustache",
@@ -830,8 +833,10 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
} else {
LOGGER.info("Successfully executed: " + command);
}
} catch (Exception e) {
} catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
// Restore interrupted state
Thread.currentThread().interrupt();
}
}
}

View File

@@ -42,6 +42,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
@@ -274,12 +275,12 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
}
if (additionalProperties.containsKey(SUPPORT_JAVA6)) {
this.setSupportJava6(Boolean.valueOf(additionalProperties.get(SUPPORT_JAVA6).toString()));
this.setSupportJava6(Boolean.parseBoolean(additionalProperties.get(SUPPORT_JAVA6).toString()));
}
additionalProperties.put(SUPPORT_JAVA6, supportJava6);
if (additionalProperties.containsKey(DISABLE_HTML_ESCAPING)) {
this.setDisableHtmlEscaping(Boolean.valueOf(additionalProperties.get(DISABLE_HTML_ESCAPING).toString()));
this.setDisableHtmlEscaping(Boolean.parseBoolean(additionalProperties.get(DISABLE_HTML_ESCAPING).toString()));
}
additionalProperties.put(DISABLE_HTML_ESCAPING, disableHtmlEscaping);
@@ -289,7 +290,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
additionalProperties.put(BOOLEAN_GETTER_PREFIX, booleanGetterPrefix);
if (additionalProperties.containsKey(IGNORE_ANYOF_IN_ENUM)) {
this.setIgnoreAnyOfInEnum(Boolean.valueOf(additionalProperties.get(IGNORE_ANYOF_IN_ENUM).toString()));
this.setIgnoreAnyOfInEnum(Boolean.parseBoolean(additionalProperties.get(IGNORE_ANYOF_IN_ENUM).toString()));
}
additionalProperties.put(IGNORE_ANYOF_IN_ENUM, ignoreAnyOfInEnum);
@@ -426,17 +427,17 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
}
if (additionalProperties.containsKey(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING)) {
this.setSerializeBigDecimalAsString(Boolean.valueOf(additionalProperties.get(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING).toString()));
this.setSerializeBigDecimalAsString(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING).toString()));
}
// need to put back serializableModel (boolean) into additionalProperties as value in additionalProperties is string
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, serializableModel);
if (additionalProperties.containsKey(FULL_JAVA_UTIL)) {
this.setFullJavaUtil(Boolean.valueOf(additionalProperties.get(FULL_JAVA_UTIL).toString()));
this.setFullJavaUtil(Boolean.parseBoolean(additionalProperties.get(FULL_JAVA_UTIL).toString()));
}
if (additionalProperties.containsKey(DISCRIMINATOR_CASE_SENSITIVE)) {
this.setDiscriminatorCaseSensitive(Boolean.valueOf(additionalProperties.get(DISCRIMINATOR_CASE_SENSITIVE).toString()));
this.setDiscriminatorCaseSensitive(Boolean.parseBoolean(additionalProperties.get(DISCRIMINATOR_CASE_SENSITIVE).toString()));
} else {
// By default, the discriminator lookup should be case sensitive. There is nothing in the OpenAPI specification
// that indicates the lookup should be case insensitive. However, some implementations perform
@@ -452,12 +453,12 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
additionalProperties.put("javaUtilPrefix", javaUtilPrefix);
if (additionalProperties.containsKey(WITH_XML)) {
this.setWithXml(Boolean.valueOf(additionalProperties.get(WITH_XML).toString()));
this.setWithXml(Boolean.parseBoolean(additionalProperties.get(WITH_XML).toString()));
}
additionalProperties.put(WITH_XML, withXml);
if (additionalProperties.containsKey(OPENAPI_NULLABLE)) {
this.setOpenApiNullable(Boolean.valueOf(additionalProperties.get(OPENAPI_NULLABLE).toString()));
this.setOpenApiNullable(Boolean.parseBoolean(additionalProperties.get(OPENAPI_NULLABLE).toString()));
}
additionalProperties.put(OPENAPI_NULLABLE, openApiNullable);
@@ -941,6 +942,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
return super.toDefaultValue(schema);
}
return null;
} else if (ModelUtils.isComposedSchema(schema)) {
if (schema.getDefault() != null) {
return super.toDefaultValue(schema);
}
return null;
}
return super.toDefaultValue(schema);
@@ -1430,6 +1436,27 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
return op;
}
@Override
public void postProcessParameter(CodegenParameter p) {
// we use a custom version of this function to remove the l, d, and f suffixes from Long/Double/Float
// defaultValues
// remove the l because our users will use Long.parseLong(String defaultValue)
// remove the d because our users will use Double.parseDouble(String defaultValue)
// remove the f because our users will use Float.parseFloat(String defaultValue)
// NOTE: for CodegenParameters we DO need these suffixes because those defaultValues are used as java value
// literals assigned to Long/Double/Float
if (p.defaultValue == null) {
return;
}
Boolean fixLong = (p.isLong && "l".equals(p.defaultValue.substring(p.defaultValue.length()-1)));
Boolean fixDouble = (p.isDouble && "d".equals(p.defaultValue.substring(p.defaultValue.length()-1)));
Boolean fixFloat = (p.isFloat && "f".equals(p.defaultValue.substring(p.defaultValue.length()-1)));
if (fixLong || fixDouble || fixFloat) {
p.defaultValue = p.defaultValue.substring(0, p.defaultValue.length()-1);
}
}
private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) {
// This generator uses inline classes to define enums, which breaks when
// dealing with models that have subTypes. To clean this up, we will analyze
@@ -1813,8 +1840,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
} else {
LOGGER.info("Successfully executed: " + command);
}
} catch (Exception e) {
} catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
// Restore interrupted state
Thread.currentThread().interrupt();
}
}
}
@@ -1847,7 +1876,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) {
if (!supportsAdditionalPropertiesWithComposedSchema) {
// The additional (undeclared) propertiees are modeled in Java as a HashMap.
//
//
// 1. supportsAdditionalPropertiesWithComposedSchema is set to false:
// The generated model class extends from the HashMap. That does not work
// with composed schemas that also use a discriminator because the model class

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