12694 Commits

Author SHA1 Message Date
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
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
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
ab688d4c3a
Update documentation (#9322)
* update doc

* update doc
2021-04-22 20:54:01 +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
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
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
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
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
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
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 6fc9712fb550d258d0332df243ea5080565c6770.

* 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