1199 Commits

Author SHA1 Message Date
William Cheng
90f7bcd909
Prepare v5.2.0 release (#9920)
* 5.2.0 release

* update samples

* update meta codegen
2021-07-09 17:06:55 +08:00
John Boyes
7084a79ede
[BUG][PYTHON] Do not set Content-Type for GET, HEAD or DELETE requests (#9852)
* [BUG][PYTHON] Do not set Content-Type for GET, HEAD or DELETE requests

The Python generator no longer sets a default `Content-Type` of
`application/json` for `GET`, `HEAD` and `DELETE` requests.

Having the `Content-Type` set for these requests was causing issues with
other tools which insist that GET, HEAD and DELETE requests do not have
a Content-Type (as per the OpenAPI 3 specification).

An example of the problem that this commit fixes is when using
[Prism][1] as a [validation proxy][2].

[Prism rejects any GET request that has a Content-Type][3].

Here is [an example of the problem manifesting itself][4].

To validate the fix in this commit:

1. Start with any OpenAPI3 spec e.g. the Petstore example at
https://editor.swagger.io/
2. Generate Python client code for the spec
3. Look at the generated `rest.py` e.g. in the [standard sample in this
repo][5] and see that the `Content-Type` defaults to `application/json`
for all HTTP methods (including `GET`, `HEAD` and `DELETE`), rather than
there being no `Content-Type` for `GET`, `HEAD` and `DELETE`.

Fixes #9831

[1]: https://github.com/stoplightio/prism
[2]: https://meta.stoplight.io/docs/prism/docs/guides/03-validation-proxy.md
[3]: https://github.com/stoplightio/prism/issues/1408#issuecomment-690948020
[4]: https://github.com/agilepathway/gauge-openapi-example/pull/28/checks?check_run_id=2888606052#step:13:18
[5]: 969cea8ce1/samples/openapi3/client/petstore/python/petstore_api/rest.py (L141)

* update samples

* Fix Python DELETE bug introduced in earlier commit

The earlier commit 9dfe1f6 introduced a bug for `DELETE` requests on the
standard Python generator.  This commit fixes that bug and also includes
the updated samples.

Co-authored-by: William Cheng <wing328hk@gmail.com>
2021-07-07 11:04:26 +08:00
Jens Fischer
870c1e1894
[Java] [Native] Unify exception messages for async, add the status code (#9825)
* [Java] [Native] Unify exception messages for async, add the status code

The template has two methods for creating API exceptions, and the enhancements from #9169 didn't make it to the async version.

- unify the signatures of the two methods (name, arguments)
- make sure the sync version is not generated with asyncNative
- extract the formatting logic into a common formatExceptionMessage() method
- add the status code to the exception message as well, not just the body
- shortened "call received non-success response" to a more concise "call failed with"

* Treat an empty body the same as a null body

Co-authored-by: Jens Fischer <jens.fischer@vier.ai>
2021-07-05 08:57:40 +08:00
Bastien Gérard
510e64fa43
Fix minor typo in @cached_property docstring (#9886) 2021-07-04 12:29:55 +08:00
Gabriel Rohden
44c1fee3e2
[dart] fix some compilation issues and added casts for analyzer implicit-casts flag (#8244)
* fix: missing dart casts and analyzer issues

* chore: regenerate dart template files

* refactor: remove unneeded implicit-casts:false and regenerate sources

* chore: regenerate templates after merge

* chore: regenerate dart pet store codes
2021-06-24 10:24:28 +08:00
William Cheng
c5405aa59a
[Go-client] Fix inability to download files (#9812)
* Revert a change to the Go Client code that broke
the ability to download files. This reverts the change
from 14d41310b9

* Missed import for "io/ioutil"

* update samples

Co-authored-by: icubbon <icubbon@gmail.com>
2021-06-19 11:23:05 +08:00
Daniel Krebs
2e65e6f62d
[python][client] allow passing floats for _request_timeout (#9532)
* [python][client] allow passing floats for _request_timeout

While several method docstrings suggested that you could pass floats for
_request_timeout and the underlying urllib3.Timeout can deal with them,
the code only allowed integer values so far when passed as a single
number.

* [python][samples] update with fix for _request_timeout type
2021-06-18 15:09:55 +08:00
shartte
8a31064028
[Java] Remove JAX-RS dependency from generated java-native client. (#8320) (#9585) 2021-06-18 15:05:55 +08:00
Tino Fuhrmann
0dcae66e0c
Revert "[typescript] Generate documentation and examples (#9413)" (#9758)
This reverts commit 624b6a7a85a22579f26be47698c99e583f582c64.
2021-06-14 08:12:41 +02:00
NouemanKHAL
624b6a7a85
[typescript] Generate documentation and examples (#9413)
* generate docs for typescript

* commit changed files
2021-06-12 09:31:40 +02:00
FallenRiteMonk
6611ae64bb
[dart] fix Date.toDateTime utc (#9717) 2021-06-10 11:11:08 +08:00
Peter Leibiger
fdbf02764d
[dart][dart-dio] Add support for query collection parameter format (#9635)
* [dart][dart-dio] Add support for query collection parameter format

* add support for collectionFormat in query parameters and www-url-encoded content
* add tests
* remove empty query parameter maps from generated code
* closes #6681
* closes #9522
* closes #8271 (the last remaining parts)

* Fix formatting
2021-06-07 09:49:59 +08:00
Peter Leibiger
afd65b3cb0
Update query parameter sample to include pipe delimiter (#9590) 2021-05-30 17:45:38 +08:00
Peter Leibiger
f7b93ebdf2
Update fake API to contain sample with binary body (#9610) 2021-05-29 10:26:01 +08:00
William Cheng
28c3e1d544 update samples, docs 2021-05-28 10:26:48 +08:00
adessoDpd
12c34d4658
New generator: WSDL (#9545)
* init port

* add outputDir

* fill out current .md

* update samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2021-05-28 10:22:28 +08:00
Peter Leibiger
6edbc91eeb
[dart][dart-dio] Update docs for dart-dio-next (#9584)
* remove deprecated author field from all pubspec templates
* improve dart-dio-next readme/markdown documentation
* add a lot of dart-doc to model and API classes
2021-05-27 10:58:37 +08:00
William Cheng
32d5900611 update samples, docs 2021-05-27 10:40:32 +08:00
desmese
4f1d8f4699
- added localVar prefix to the contentType variable defined in the api.mustache template in the java resttemplate library (#9568)
- rerun generate-samples.sh and export_docs_generators.sh
2021-05-27 10:24:38 +08:00
Peter Leibiger
ab11acd634
[dart][dart-dio-next] Improve support for file uploads (#9542)
* [dart][dart-dio] Improve support for file uploads

* add support for filenames in multipart requests by using  `MultipartFile` from dio directly
* add support for binary/file body data
* fixes #6671
* fixes #9079

* Add and fix tests

* Only use MultipartFile for body/multipart parameters

* Fix test

* Actually fix tests
2021-05-25 23:58:39 +08:00
alespour
e360228a76
fix: dart2 mustache templates minor improvements (#9539)
* fix: prefer_is_not_empty linter suggestion

* fix: annotate_overrides linter suggestion

* chore: update samples
2021-05-24 11:01:53 +08:00
Peter Leibiger
be84c44fcc
[dart][dart-dio-next] Add stacktraces to manual DioError instances (#9549) 2021-05-24 10:54:51 +08:00
Peter Leibiger
48924eb1a0
[dart] Improve content-type handling (#9517)
* [dart] Improve content-type handling

* fixes #9334
* superseeds #9454
* use `prioritizedContentTypes` in the same way `JavaClientCodegen` does
* move `application/json` to the front if it exists
* don't do anything if it is multi-part or url-encoded as for this the first content-type already needs to match
* log warning if an unsupported content-type is first after prioritizing
* remove some unused code blocks from dio generators

* Only use first prioritized content-type in dio generators

* don't default to any content-type in dio-next, dio defaults itself to JSON
2021-05-24 10:53:39 +08:00
Rinish Sam
9eb9c30a92
[dart][dart-dio] Fix gitignore comment style (#9554)
* Fix gitignore comment style in templates

* Update samples
2021-05-23 11:27:07 +08:00
Peter Leibiger
b8c5a647e0
[dart][ci] Move Dart samples from CircleCI to Github actions (#9515)
* [dart] Move Dart samples from CircleCI to Github actions

* Fix format failing with latest Dart version

* Workflow naming

* Split dart samples depending on version

* use fixed version to prevent flaky builds

* Change branch pattern for release branches
2021-05-21 14:45:50 +08:00
Peter Leibiger
55b95bc9c5
Fix CircleCI failures (#9503)
* Fix go-echo-server sample not running in CircleCI

* remove wrong argument

* [dart] Fix petstore sample tests & Multipart not working

* follow up to #9392
* `MultipartRequest(null, null)` is no longer valid after `http` package upgrade
* fix petstore sample project not compiling
* disable live petstore tests
* use template to strip out unused code blocks
2021-05-18 23:09:29 +08:00
Justin Black
fb3aed6dc4
Fixes python test_fake_api tests (#9483)
* Fixes test_upload_download_file

* Fixes test_string

* Fixes test_string_enum

* Fixes test_number_with_validations test_composed_one_of_number_with_validations

* Fixes two more tests

* Fixes test_array_of_enums

* Fixes two tests

* Removes comment

* Fixes serializationf of composed schema object models, fixes test

* Samples regenerated

* Removes pdb
2021-05-17 20:15:53 -07:00
Kuzma
e1ef7d40b3
add OAuth2 to typescript template (#9466)
* add OAuth to typescript

* generate samples
2021-05-17 18:22:18 +02:00
William Cheng
5e29d61639 Merge remote-tracking branch 'origin/master' into 6.0.x 2021-05-13 18:44:58 +08:00
gbmarc1
c966b5fe1f
[python] readonly constructors (#9409)
* readonly

* other tests

* doc

* python samples

* model utils
2021-05-10 18:41:26 -07:00
Kuzma
686b2110e6
[BUG] [typescript] Duplicate parameter's names (rename options to _options and config to _config) (#9428)
* rename options to _options and config to _config

* add samples
2021-05-10 19:52:58 +02:00
Adi1231234
1961c661f3
upgrade dart generator dependencies (#9392)
* upgrade intl package

* upgrade http package and change url to uri

* update petstore sample

* update pubspec files

* upgrade http dependency

* upgrade dev dependencies

* update json_serializable and test

* delete nullable - deprecated on json_serializable 4.1.1

* fixed NNBD issue

* change test version
2021-05-10 16:07:03 +08:00
William Cheng
be214dc349 Merge remote-tracking branch 'origin/master' into 5.2.x 2021-05-07 10:15:12 +08:00
William Cheng
560bf7e080
v5.1.1 release (#9421) 2021-05-07 09:57:19 +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
William Cheng
b63d735312 update samples 2021-04-28 21:14:23 +08:00
William Cheng
3e58b0908c Merge remote-tracking branch 'origin/5.2.x' into 6.0.x 2021-04-28 18:08:24 +08:00
William Cheng
73564bc046 update samples 2021-04-28 17:57:26 +08:00
William Cheng
37eaf70755 Merge remote-tracking branch 'origin/master' into 5.2.x 2021-04-28 17:48:21 +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
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
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
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
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
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
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
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
Peter Leibiger
29c131e781
[dart][dart-dio] Update dependencies (#9178)
* finally use released versions for http mocking
2021-04-05 23:39:18 +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
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