1230 Commits

Author SHA1 Message Date
Peter Leibiger
f484e0db42
[dart][dart-dio] Formatting improvements (#8180)
* always add trailing commas in arrays and break each line
* make variables final
* improve API formatting (mainly leading spaces)
* remove empty lines and whitespaces
* fix formatting of datatype and description and docs
* consistently use single quotation marks (dart already does this)
2020-12-15 09:55:33 +08:00
Peter Leibiger
e412145a1f
[dart][dart-dio] More enum fixes for inner types (#8174)
* correctly generate enums from `mostInnerItems`
* use `datatypeWithEnum` which should always be he correct type
* dart generators prefix inner enums with the classname of the containing class, ensure datatypeWithEnum always matches
2020-12-14 23:05:31 +08:00
Peter Leibiger
351377ca29
[dart-dio] Fix x-www-form-urlencoded body not working (#8175)
* only use `FormData.fromMap()` for multipart content, `FormData` does not work with `x-www-form-urlencoded`
* use a basic map for `x-www-form-urlencoded` content
* fix formatting
2020-12-14 15:36:18 +08:00
Peter Leibiger
7f9012c554
[dart-dio] Use built_value collection types without string replacement (#8153) 2020-12-14 00:00:18 +08:00
Peter Leibiger
cd0257b0e5
[dart][dart-dio] Enum improvements (#8149)
* [dart] Always use the correct enum data type

* use raw strings for enum string values

* [dart-dio] Use raw strings for built_value enums

`@BuiltValueEnumConst` does some wierd string handling in the generated code `r'\$'` becomes `'$'`. This is different compared to the wireName in `@BuiltValueField`
2020-12-13 23:59:29 +08:00
agilob
79395de9b7
[java] Generate "static final" instead "final static" (#8158)
* Generate java code with "static final" instead "final static"

* Regenerate code with "static final"
2020-12-11 10:51:57 +08:00
Peter Leibiger
a93a60b6eb
[dart] Handle enumVarNames for negative names (#8143) 2020-12-10 18:59:23 +08:00
Peter Leibiger
4ad6d0bfe5
[dart] Variable/Operation/Model naming (#8123)
* [dart] Properly escape param/var names that clash with Dart types

* [dart] Add tests for var/enumVar names

* note: public and private are no keywords in Dart
* some tests are still wrong, some are commented out

* Fix typo

* [dart] Improve variable name escaping

* add more tests

* [dart] Fix operationId naming

* [dart] Fix upper case var name with leading underscore

* [dart] Correctly support model prefix/suffix

* [dart] Support spaces in property names

* Call super for empty operationId

* [dart] Fix and improve enumVar naming/generation

* use same handling for all 3 generators
* allow `updateEnumVarsWithExtensions` to have access to the data type
* improve `x-enum-values` handling and add supprt for other enum vendor extensions
* remove duplicate and outdated tests from `DartDioModelTest`
* add more tests to `DartModelTest`
* no longer force lowercase enums for plain dart generator (breaking)
* this change also removes the trailing underscore from plain dart generator (breaking)
2020-12-09 23:21:08 +08:00
Peter Leibiger
2cdbfd63eb
[dart][dart-dio] Enum fixes specific to Dart DIO (#8114)
* [dart-dio] Fix wrong escaped serializer names

* [dart-dio] Prevent enum name collisions in inlined enums

Prefix the private built_value instances with the enum class name. Prevents clashes when multiple inline enums contain the same value - for example `EnumTest`.  No breaking changes here as all the changed fields/references are private and automatically re-generated with built_value.
2020-12-09 21:12:03 +08:00
Peter Leibiger
144e08b4fc
[dart] Use raw strings for json/header parameter names (#8131)
This should fix all problems related to unescaped characters in strings that are assumed to be raw - e.g. `json[r'$special[property.name]']`
2020-12-09 11:12:48 +08:00
Josh Burton
e346593766
[dart-dio] fixes Enum classes with integer values (#8129)
* [dart-dio] Enum classes with int values now generate correct BuiltValueEnumConst annotation

* [dart-dio] Address PR comments
2020-12-09 11:09:57 +08:00
Josh Burton
7fb5e2538b
[dart-dio] Fixes errors when primitive return types are attempted to … (#7411)
* [dart-dio] Fixes errors when primitive return types are attempted to be deserialized as json

* Updates samples

* Removes old files
2020-12-09 11:07:29 +08:00
Peter Leibiger
7fae4ab411
[dart] type improvements (#8111)
* [dart] Configure and use import mapping

This prevents models from being generated which would clash with exisiting dart types, e.g. List.

* [dart] Fix decimal format not supported

* [dart-dio] Remove redundant modelToIgnore & ignore dart:core import

* modelToIgnore is now handled via importMappings the same way other generators do this
* choose not to import dart:core as this is available by default

* [dart-dio] EnumClass is a reserved word in built_value

* Review changes

* Fix regenerate docs
2020-12-08 12:00:12 +08:00
fbl100
99d83712a8
Fixes issue #8014, _check_type flag not being honored. (#8053)
* Fixes issue 8014, _check_type flag not being honored.

Updated model_utils.mustache to pass the check_type flag into attempt_convert_item(). Failure to do so
results in type validation errors occurring when the user has specifically requested that they be disabled.

* regenerated samples

Co-authored-by: Frank Levine <frank.levine@blacklynx.tech>
2020-12-07 12:18:16 -08:00
Ülgen Sarıkavak
e00ac502f1
[python] Update python versions (#8042)
* Remove redundant encoding definitions

UTF-8 is already the default encoding in Python 3.

* Remove Python3.4 related requirements

* Remove dead Python version 3.5

* Add Python 3.9 to CI and test configs

* Update petstore example
2020-12-07 12:07:35 -08:00
itaru2622
35d616c9af
Fix bug [python][client] generated python client code cannot POST object in multipart/form-data (#8075)
* encode object in json and add content-type:application/json for multipart/form-data

fix issue https://github.com/OpenAPITools/openapi-generator/issues/8068

* update samples by ./bin/generate-samples.sh

* non-ascii chars supported in encoding object to json, and add "content-type:application/json; charset=utf-8"

* update samples again, by ./bin/generate-samples.sh

* update comment(docstring) in parameters_to_multipart according to the discussion in PR review.

* fix default value in parameters_to_multipart function as described in PR review comment.

* update samples again, by ./bin/generate-samples.sh
2020-12-07 09:50:09 -08:00
Peter Leibiger
751ffad8db
[dart] Cleanup and OAS3 support (#8085)
* [dart] Cleanup and regnerate old/wrong tests and docs

* docs path seems to be doc now in all dart generators
* generated tests are very old and use wrong classes

* [dart-dio] Improve formatting

* [dart][dart-dio] Restructure tests to same layout

* remove duplicate/old openapi sample for which there is no generation config
* generate to `petstore_client_lib` for both generators
* run generated tests as integration tests for dart2 even if empty - this makes it easier to find compile errors

* [dart] Improve gitignore handling for Dart generators

* globally ignore all dart related files that should not be commited
* remove old ignores that are no longer valid

* [dart][dart-dio] Add OAS3 generation and integration tests

Dart2 doesn't compile, needs fixes.

* [dart] Do not attempt to deserialize binary content from JSON fields

Not sure if that case is ever relevant but for now there doesn't seem to be a better option.

* [dart] Fix integration tests for OAS3 petstore

Some POST operations now return 200 with content.

* [dart] Generate Petstore Fake API but don't add to integration tests yet

Explicitly not adding the new integration tests to the master POM. They do not work but having them allows for quickly iterating on open issues without breaking existing basic OAS2/OAS3 petstore examples. Instead they should be run manually until everything is fixed.
2020-12-07 21:38:39 +08:00
Toby Murray
cbe1fd9728
Bump Gradle in generated Java projects to 6.7.1 (#8079)
* Bump Gradle in Java projects from 6.0.1 to 6.7.1

Regular maintenance, 6.0.1 was released November 18th, 2019 and the latest release (November 16th, 2020) is 6.7.1. This updates all the wrapper templatesto the latest version.

* Updated generated Java samples

Generated via `./bin/generate-samples.sh bin/configs/java-*`

* update samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-12-07 10:44:23 +08:00
Sergey
13f1c610d9
[python] Re-merge Subclass Python exceptions (#7321) (#8095)
* Subclass Python exceptions (#7321)

* Subclass Python exceptions:
- UnauthorizedException (401)
- ForbiddenException (403)
- NotFoundException (404)
- ServiceException [500 - 599]

Fixes #2151

* add generated sample code

* use Python 2 flavor inheritance

* regenerate samples

* update samples

Co-authored-by: Ryan Rishi <ryan@ryanrishi.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-12-05 12:02:00 -08:00
Julien Feltesse
adcf54bc09
[ruby] document the *_with_http_info methods (#8094) 2020-12-05 18:27:49 +08:00
fuxs
38dbcdd752
[Go] Fixes missing return statement (#8072) (#8090) 2020-12-05 18:24:22 +08:00
Thomas Hervé
634c4c09e4
Fix generation of map model examples (#8063)
When generation examples of objects with additional properties, we use
the map syntax inside a model instantiation, which is incorrect. This
fixes it by checking for model at the right place.
2020-12-01 19:04:23 -08:00
William Cheng
e040a5fdde
Fix port when the URL doesn't have port specified (#8049)
* fix port missingin oas 3 spec

* update samples
2020-12-01 15:24:28 +08:00
Thomas Hervé
3f75691da2
Fix list examples in Python (for real) (#8034)
The patch in #7967 forgot the prefix, this fixes it, and change the
sampels so that we can see the effect this time.
2020-11-26 14:28:27 -08:00
Thomas Hervé
616b44f3b1
Improve generated Java examples (#8012)
* Add basic types imports to generated examples

This adds an extension to include basic types imports to generated Java
examples.

* Make some fixes to example generation

* Generate OffsetDatetime correctly

* Create a useful sample for enums, regenerate samples

* Fix BigDecimal as well
2020-11-26 18:14:26 +08:00
Adam Dobrawy
be07bd13af
Allows install typescript client via npm from Git (#7878)
* Allows install typescript client via npm from Git

'prepublishOnly' is run before the package is published. 'prepack' is run before the package is published and after installation local installation eg. via Git.

* Update examples for Typescript
2020-11-24 21:05:07 +01:00
Julien Feltesse
522faf835a
[ruby] fix oneOf handling (#5706)
* [ruby] fix oneOf handling

* use previous ruby configs due to issue #4690

* check for oneOf model in base_object

* validate the attributes in partial_oneof_module
2020-11-23 22:43:34 +08:00
Thomas Hervé
14ff8e0ffd
Remove links to basic types in java API docs (#7989)
* Remove links to basic types in java API docs

This removes (most) wrong links to basic types in Java API docs.

* Regenerate some more samples
2020-11-23 16:24:31 +08:00
Thomas Hervé
1c1e4f4476
Fixes to go API documentation generation (#7963)
* More fixes to go doc generation

* Regenerate samples

* Fix indent

* Remove additonal bracket on time objects
2020-11-23 16:08:55 +08:00
William Cheng
2578ef5e63
Prepare snapshot (v5.0.0) (#7986)
* Revert "prepare 5.0.0-beta3 release"

This reverts commit 3ebe774df37b43348bac1310a272de53a2d7040b.

* revert to snapshot

* update samples
2020-11-20 19:19:59 +08:00
William Cheng
2715f1371a
Prepare 5.0.0 beta3 (#7984)
* prepare 5.0.0-beta3 release

* update samples

* remove beta3 from readme
2020-11-20 15:18:58 +08:00
William Cheng
3bf8ca7484
[python] Renames python generators (#7965)
* python->python-legacy, python-experimental->python

* test with openjdk8

* test with openjdk11

* comment out rm

* move kotlin tests to circleci

* move kotlin tests

* move tests to circleci

* fix circleci

* rearrange test

* move tests

* use wrapper

Co-authored-by: Justin Black <justin.a.black@gmail.com>
2020-11-18 14:34:00 +08:00
Thomas Hervé
777031f24f
Fix a few issues with go examples generation (#7873)
* Fix a few issues with go examples generation

This fixes a bunch of issues seen when generating go examples, namely
 - Numbers aren't casted to the right type
 - The time import is missing
 - Enums are treated as regular models

* Rebuild more samples

* Use examples properly

* Handle multiple instances in the same doc

* Fix wrong array closure

* Handle model arrays

* Fix file and enum namespace

* Regenerate samples

* Handle maps of complex types

* Handle oneOf

* Fix padding

* Fix enum doc

* Removes links to basic types in arrays

* Remove links to basic types in maps

* Fix enum links

* Minor indent fix

* Handle review comments
2020-11-12 23:36:40 +08:00
Justin Black
13673962cb
Adds tests case showing not sending optional params (#7918) 2020-11-10 08:52:43 -08:00
Nicholas Muesch
eceac6a63c
Skip validation if input_value is None (#7845) 2020-11-08 12:27:58 -08:00
debugman
01d0b5d478
added serialize option in to_dict function in python generated model (#7555)
* added to_json_dict in python generated model

* update to_dict

* updated to_dict

Co-authored-by: sunkaicheng <sunkaicheng@bigo.sg>
2020-11-05 09:42:35 -08:00
Tomasz Prus
b3bc926b1d
[python] check output content-type only if preload_content is set (#7847) 2020-11-04 08:41:00 -08:00
William Cheng
9377dbca56
Add "decimal" support (#7808)
* rename BigDecimal to decimal

* add isDecimal

* fix tests

* minor fixes

* fix mapping, update doc

* update test spec

* update c# samples
2020-11-02 21:31:32 +08:00
Steve B
ea2cdd23c2
[python] add socket_options to configuration for the rest client (#7795)
* [python] add socket_options to configuration for the rest client

* (python-experimental) add socket_options to configuration for the rest client

This mirrors work done on the python generator

* (python-experimental) add test to cover socket_options is passed on from configuration

Co-authored-by: steve brazier <steve.brazier@trioptima.com>
2020-10-27 18:22:28 -07:00
William Cheng
fe38a50365
[Ruby][faraday] fix response streaming (#7734)
* test file return

* fix stream response

* use options

* use local var

* fix nil tempfile

* fix tempfile

* fix tempfile

* use stream

* check content

* open temp file

* test ruby file download

* fix stream data

* test faraday

* catch connection error

* catch Faraday::ConnectionFailed

* catch all error

* use sream

* refactor

* fi download file in faraday

* local fix

* fi streaming download

* undo changess to spec, test

* undo changes to spec
2020-10-26 10:07:45 +08:00
Maksym Melnychok
b70edd7f1b
[python] Add option to return None instead of raising exception when accessing unset attribute (#7784)
* add option to return None instead of raising exception when accessing unset attribute

* update python samples

* reimplement getattr using getitem or get depending on attrNoneIfUnset

* move getattr and setattr to respective templates

* update docstrings, def get/setattr methods to have docstrings in them, use __dict__ to avoid recursion issues

* revert required_properties change

* add manual tests for .get method
2020-10-25 09:13:22 -07:00
William Cheng
ec74b06d2c
[Ruby] Replace DateTime with Time (#7656)
* replace DateTime with Time

* add require time

* update doc
2020-10-21 14:13:59 +08:00
William Cheng
d6c71ff0fb
[java][jersey2] add proxy support (#7752)
* add client config getter and setter

* update gradle, sbt config

* update client config

* update samples

* add code sample to set proxy
2020-10-20 10:11:01 +08:00
William Cheng
b733312707
update doc to include proxy instruction (#7749) 2020-10-19 22:14:34 +08:00
Justin Black
3d337db207
Unifies naming for isArray in Schema class properties (#7691)
* Updates key java files

* Adds all lingering isArray fixes

* Adds two files

* Reverts two cs files

* Fixes lingering isListContainer + isArrayModel references

* Some ensure up to date updates
2020-10-18 21:58:59 -07:00
Justin Black
2ee0913d4a
Changes lingering isMapContainer to isMap (#7747)
* Changes lingering isMapContainer to isMap

* Adds ensure up to date updates
2020-10-18 20:07:33 -07:00
Hippolyte HENRY
8afb067ec9
[go] Improve examples generation (#7576)
* fix go examples

* use constructor with required args
2020-10-16 00:04:30 +08:00
bgong-mdsol
edf153eede
[Java][Native] Support oneOf/anyOf schemas (#7263)
* Java-native add models of oneOf/anyOf

* Java-native refresh samples

* Java-native add a sample project for openapi3
2020-10-15 17:29:51 +08:00
William Cheng
6046c3da94
remove github.com/antihax/optional from go.sum (#7692) 2020-10-14 10:11:05 +08:00
William Cheng
b768e42704
Update junit to newer version (4.13.1) (#7690)
* update junit to newer version

* update junit to newer version
2020-10-14 10:10:32 +08:00