162 Commits

Author SHA1 Message Date
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
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
Kuzma
4e5ecf271a
[Python] correct return types if multiple responses are defined (#7427)
* update python mustache templates

* bug fix

* rm response_type

* generated samples

* resolve conflict

* samples

* set None if a type is empty

* regenerated samples
2020-10-03 08:37:08 -07:00
Nicholas Muesch
32c591d9a7
Support multiple api keys in python example documentation (#7417)
* Support multiple api keys in config option

* Regenerate samples

* Update rest of examples
2020-09-15 13:40:48 -07:00
Ryan Rishi
2d5b2726d0
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
2020-09-05 10:22:04 -07:00
William Cheng
2fd23f505e
Prepare 5.0.0-SNAPSHOT (#7347)
* Revert "Prepare 5.0.0-beta2 release (#7345)"

This reverts commit 212b4f784742744b7b238607dcefb23ec9db64d7.

* update readme
2020-09-04 15:31:54 +08:00
William Cheng
212b4f7847
Prepare 5.0.0-beta2 release (#7345)
* update version

* update doc

* update samples
2020-09-04 13:03:45 +08:00
William Cheng
61789475ea update python samples 2020-07-03 18:51:31 +08:00
Jiri Kuncar
8b9c070e5d
[Python] Support for per-operation servers (#6557)
* Dynamic server support

* regenerated

* Apply suggestions from code review

Co-authored-by: Thomas Hervé <thomas.herve@datadoghq.com>

* regenerated

* Add ParameterizedServer feature to Python experimental

* Fix lookup of server variables

* Add tests and change default value for servers

* Fix server variables

* Return base path when index is None

* Use HOST

* Apply suggestions from code review

* Apply suggestions from code review

* regenerated

* Add specific tests for dynamic servers

* regenerated

* add docstring

* regenerated

* Fix wrong merge resolution

Co-authored-by: Thomas Hervé <thomas.herve@datadoghq.com>
2020-06-25 21:28:54 -07:00
Jiri Kuncar
046ba7de8e
[feature][python] Support aliasing of API keys (#6469)
* [python] Support aliasing of API keys

* Support for aliasing and prefix

* Make more realistic usage

* Regenerate

* Document alias in generated code

* Support override of aliased keys

* Use diferent id and name for api keys

* ensure up-to-date

* Simple example without x-auth-id-alias

* regenerate docs

* Regenerate

* Provide separate spec for x-auth-id-alias

* Apply suggestions from code review

* regenerated
2020-06-11 09:19:57 -07:00
Warren Gray
933ab0640a
[python-client] Enable per-request auth settings (#6569)
* Enable per-request access token in Python client.

* Add missing regenerated sample files.

* Rework to the more general case of overriding the auth settings for a request.

* Add unit tests.

* Update api_client.mustache so that request_auth overrides all other auth settings when specified.
2020-06-10 23:40:10 -07:00
Jim Schubert
835dab4b50
Fix typescript generator for parameter collectionFormat for pipes ssv (#6553)
Co-authored-by: David Biesack <David.Biesack@apiture.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
Co-authored-by: Vikrant Balyan <vvb@users.noreply.github.com>
Co-authored-by: Michele Albano <michele.albano@gmail.com>
Co-authored-by: Esteban Gehring <esteban.gehring@bithost.ch>
2020-06-05 19:32:32 -04:00
Alexey Volkov
6f6c8ede79
[Python] Fixed docstrings in api.mustache (#6391)
* [Python] Fixed docstrings

Fixes https://github.com/swagger-api/swagger-codegen/issues/9630

* Updated generated files

* Fixed python-experimental

* Updated generated files

* Fully fixed the format of the docstrings

* Updated generated files

* Updated generated files in openapi3
2020-06-04 08:46:35 -07:00
Jim Schubert
70ca93570e
[core][general] Add metadata file tracking to aid in "Golden Tests" regeneration (#6325) 2020-05-22 16:48:32 -04:00
Sebastien Rosset
b4954b0d80
[codegen][python-experimental] Add configuration knob to disable JSON schema validation (#6227)
* Add knob to disable JSON schema structural validation

* Add knob to disable JSON schema structural validation

* Fix formatting issues

* execute sample scripts

* execute sample scripts

* fix multipleOf validation issue

* Add validation log for multipleOf. Add customizable validation checks. add unit tests for JSON schema validation

* Add validation log for multipleOf. Add customizable validation checks. add unit tests for JSON schema validation

* Add validation log for multipleOf. Add customizable validation checks. add unit tests for JSON schema validation

* Add validation log for multipleOf. Add customizable validation checks. add unit tests for JSON schema validation. Fix for python 2

* address review comments
2020-05-17 09:11:01 -07:00
William Cheng
15794f8026
Fix build failure due to flake8 (#6265)
* fix flake8 folder

* fix flake8 folder in python2

* comment out flake8

* comment out flake8

* comment out flake8

* comment out flake8

* comment out flake8
2020-05-12 21:41:55 +08:00
William Cheng
4effa739eb
Add AnyType support to Java generators (#6246)
* add anytype support to java

* fix test

* fix primitive type

* update tests

* update samples
2020-05-11 15:27:03 +08:00
Sebastien Rosset
fa37a696a8
[python-experimental] Raise builtin AttributeError instead of custom ApiKeyError (#6229)
* Use AttributeError instead of ApiKeyError because that's what the hasattr builtin function uses

* Use AttributeError instead of ApiKeyError because that's what the hasattr builtin function uses

* fix unit tests

* create ApiAttributeError exception

* fix formatting

* run samples scripts
2020-05-10 19:02:41 -07:00
William Cheng
46216cd796 Merge remote-tracking branch 'origin/master' into 5.0.x 2020-04-28 20:35:28 +08:00
Justin Niessner
db5941379f
[Python] Fix Python UTF-8 Encoding Issue (#5679)
* Try decoding but don't bail on error

* Switch binary and ByteArray to bytes

* Read content type and parse appropriately

* Remove response parsing

* Remove response parsing and just return the data

* Update petshop examples w/ new generator code

* Fix copy/paste error with naming

* Update petstore examples

* Move response decoding to inside _preload_content block

* Update the clients again

* Use a raw string for the regex pattern

* Regenerate petstore clients

* Add bytes to python primitives as it's supported in 2.7 and 3

* Add bytes to the exports from model_utils

* Import bytes from model_utils

* Add conditional typing for regex pattern to match variable type

* Regenerate petstore clients

* Use read() instead of text() for asyncio

* Regenerate petstore clients

* Remove unused six import

* Regenerate petstore clients

* Add newline to kick Circle to re-run

* Remove whitespace from tox.ini

* Update more examples after ensure_updated

* Add sample updates that didn't run with the --batch flag

* Remove extra bracket in regex to remove warning

* Stop printing debug messages

* Add bytes examples to python doc generators

* Update generated FakeApi docs

* Regenerate api_client.py

* Remove print statements from generated clients

* Update bytes example in FakeApi.md. Again. I swear.

* Add yet another seemingly missing doc update

* Catch the error, decode the body, and re-throw

* Remove the updates now that the change is non-breaking

* Regenerate client

* Add bytes deserialization test

* Update exception parsing

* Add exception parsing for python-experimental

* Regenerate client with minor changes

* Revert test changes

* Regenerate model_utils.py

* Update confusing test name

* Remove bytes from mapping and examples

* Add back in the old binary/ByteArray to str mapping

* Update docs and api_client template

* Add experimental api_client changes

* Regenerate samples again

* Add Tornado handling to early return

* Try fixing Tornado python returns

* More documentation changes

* Re-generate the client code

* Remove bytes from test_format_test

* Remove more leftover bytes usages

* Switch bytes validation back to string

* Fix format_test template and regenerate

* Remove unused bytes var

* Remove bytes import from models and regenerate

* Remove bytes import from test_deserialization

* Reduce nested ifs

* Remove byte logic for now

* Regenerate client after latest changes

* Remove another bytes usage

* Regenerate after removing dangling byte string usage

* Reduce the scope of the try/catch in api_client

* Regenerate after try/catch cleanup

* Swap catch for except

* Regenerate Python client after api_client change

* Fix lint error on the generated api_client

* Add binary format test back in w/ string

* Add decoding to python-experimental and regenerate

* Import re into python-experimental api_client

* Ensure file upload json response is utf-8 encoded bytes
2020-04-26 13:33:42 -07:00
Sebastien Rosset
e8f486ba7f
[Python experimental] Readme improvements (#6031)
* Python experimental readme improvements

* Python experimental readme improvements

* execute scripts in bin directory
2020-04-25 00:10:32 +08:00
Justin Black
8e8471c1fd
[CORE] Fixes composed schema discriminator map (#4906)
* Adds addComposedMappedModels and testComposedSchemaOneOfDiscriminatorMap

* Requires that discriminators be required properties

* Strengthens discriminaotr validation, adds better error messages, adds schema oneof samples

* Adds oneOf and anyOf invalidDiscriminator tests

* Updates incorrect addOneOfInterfaceModel invocation

* Runs ensure-up-to-date

* Adds updates from Sebastien Rosset

* Removes newlines

* Uses df.isString

* Fixes tests be correctly setting df.isString

* Updates discriminatorExplicitMappingVerbose description per PR feedback

* Adds description of how mappedModels is populated

* Adds the suggestion exception raising when a MappedModel mappingName is null

* Actually resolves merge conflicts

* Switches two methods to package private because they are needed for testing

* Allow nulls in MappedModel.getMappingName

* Updates CLI flag name to legacyDiscriminatorBehavior, default=true

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-04-25 00:01:02 +08:00
Sebastien Rosset
6ad5e5fb45
[Python experimental] Add __setattr__ function to ensure signing_info.host is the same as configuration.host when the user assigns signing info (#6033)
* Add __setattr__ function to ensure signing_info.host is the same as configuration.host when the user assigns signing info

* Add __setattr__ function to ensure signing_info.host is the same as configuration.host when the user assigns signing info
2020-04-23 23:16:31 -07:00
William Cheng
5a9b0fcf9e update samples 2020-04-21 02:22:55 +08:00
William Cheng
faf6f197be Merge remote-tracking branch 'origin/master' into 5.0-sync-master 2020-04-17 15:51:00 +08:00
Tomasz Prus
7a0242311f
[python/asyncio] fix passing proxy parameters to aiohttp (#5943) 2020-04-15 18:16:08 -07:00
William Cheng
a0ca253218
update samples (#5722) 2020-03-27 13:55:55 +08:00
Tomasz Prus
625c734cfe
[python/asyncio] explicitly close client session via async context manager (#5621) 2020-03-25 07:59:27 -07:00
Justin Black
67e3bf5271
Fixes kwargs typos, removes E501s (#5552) 2020-03-06 20:22:19 -08:00
Tomasz Prus
3f0c163f0c
[python] add method to set/get default configuration (#5315)
* [python] add method to set/get default configuration

* [python] change method name and fix handling api_key

* python: using modified deepcopy to set/get default configuration

* python: update samples

* python: update samples
2020-02-23 14:10:44 -06:00
Sebastien Rosset
e08e05a2c7
[Python] add discard_unknown_keys parameter (#5362)
* add discard_unknown_key parameter

* add discard_unknown_key parameter

* add discard_unknown_key parameter

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* discard unknown keys in composed schema if configuration.discard_unknown_keys is set

* run sample scripts for python

* code reformatting

* execute script in bin directory

* improve unit tests for discarding properties
2020-02-21 16:51:24 -06:00
LoveIsGrief
33483b2f20
Respect usenose for Python CI (#5376)
* python: Respect useNose option in generated CI templates

Travis and Gitlab CI now use nosetests or pytests depending on the "useNose" option that is passed.

* python: Update CI samples

They now respect the "useNose" option
2020-02-20 21:47:13 +08:00
LoveIsGrief
910ce9fa89
python: Add gitlab-ci.mustache (#5342)
* python: Add gitlab-ci.mustache

It does the same stuff as in the .travis.yml but just for Gitlab CI

#5340 - Python .gitlab-ci.yml

* python: Run all scripts in bin

find bin/ -type f -name 'python*.sh' -exec {} \;

Had to update all samples
2020-02-17 22:36:21 +08:00
Fabian von Feilitzsch
c943ecfe28
[Python] 5094 followup - Reduce redundancy in docs (#5161)
* Reduce redundancy in python docs

This is a followup to PR #5094, which had a few unresolved comments at
merge time. This reduces the amount of redundant lines in the api
example doc templates, and ensures that referenced Configuration objects
are actually instantiated.

* Regenerate samples
2020-02-06 13:58:17 -08:00
William Cheng
100b01844a Merge remote-tracking branch 'origin/master' into 5.0.x 2020-02-04 15:31:10 +08:00
Sebastien Rosset
67e4cc8be1
[Python] Python HTTP signature update (#5154)
* improve python documentation and add import to __init__package.mustache

* improve python documentation and add import to __init__package.mustache

* add signing_info parameter conditionally

* add code comments and remove 'Content-Length' header from example

* Remove debug log statement

* set access_token to None by default

* set access_token to None by default

* fix unit tests for Python experimental

* fix trailing space
2020-02-03 09:39:17 -08:00
William Cheng
03a59046f4 Merge remote-tracking branch 'origin/4.3.x' 2020-01-31 19:00:28 +08:00
Fabian von Feilitzsch
15345e1620
[python] Cleanup ThreadPool with atexit rather than __del__ (#5094)
* [python] Cleanup ThreadPool with atexit rather than __del__

This removes the `__del__` function from the generated Python client,
and replaces it with a `cleanup` function. When a ThreadPool is created,
the cleanup function is registered with the `atexit` module.

This fixes #5093, where the API client could hang indefinitely at
garbage collection.

* Update petstore examples

* Test to ensure threadpool is cleaned up

* Docs now encourage using the context manager

* Regenerate docs

* Update samples
2020-01-28 21:58:11 -08:00
Sebastien Rosset
4f350bc01c [Python] Support for HTTP signature (#4958)
* start implementation of HTTP signature

* add api key parameters for http message signature

* HTTP signature authentication

* start implementation of HTTP signature

* add api key parameters for http message signature

* HTTP signature authentication

* HTTP signature authentication

* start implementation of HTTP signature

* fix merge issues

* Address formatting issues

* Address formatting issues

* move python-experimental-openapiv3-sample to a separate PR

* Add support for HTTP signature

* Add code comments

* Add code comments

* Fix formatting issues

* Fix formatting issues

* Fix formatting issues

* add code comments

* add code comments

* fix python formatting issues

* Make PKCS1v15 string constant consistent between Python and Golang

* fix python formatting issues

* Add code comments in generated Python. Start adding unit tests for HTTP signature

* compliance with HTTP signature draft 12

* compliance with HTTP signature draft 12

* working on review comments

* working on review comments

* working on review comments

* working on review comments

* working on review comments

* working on review comments

* working on review comments

* working on review comments

* working on review comments

* fix python formatting issues

* fix trailing white space

* address PR comments

* address PR comments

* address PR comments

* Add suppport for '(expires)' signature parameter

* address PR comments

* address PR comments

* Fix python formatting issues

* Fix python formatting issues

* Starting to move code to dedicated file for HTTP signatures

* Continue to refactor code to dedicated file for HTTP signatures

* Continue to refactor code to dedicated file for HTTP signatures

* Continue to refactor code to dedicated file for HTTP signatures

* Continue to refactor code to dedicated file for HTTP signatures

* move method to ProcessUtils

* conditionally build signing.py

* move method to ProcessUtils

* Code reformatting

* externalize http signature configuration

* address PR review comments

* address PR review comments

* run samples scripts

* Address PR review comments

* Move 'private_key' field to signing module

* Move 'private_key' field to signing module

* code cleanup

* remove use of strftime('%s'), which is non portable

* code cleanup

* code cleanup

* code cleanup

* run sample scripts

* Address PR review comments.

* Add http-signature security scheme

* Run sample scripts for go

* Fix issue uncovered in integration branch

* Fix issue uncovered in integration branch

* Fix issue uncovered in integration branch

* Fix issue uncovered in integration branch

* Run samples scripts

* move http signature tests to separate file

* move http signature tests to separate file

* unit tests for HTTP signature

* continue implementation of unit tests

* add http_signature_test to security scheme

* add unit tests for http signature

* address review comments

* remove http signature from petapi

* Add separate OAS file with support for HTTP signature

* Add support for private key passphrase. Add more unit tests

* Add unit test to validate the signature against the public key

* remove http signature from petstore-with-fake-endpoints-models-for-testing.yaml

* fix unit test issues

* run scripts in bin directory

* Refact unit test with better variable names

* do not throw exception if security scheme is unrecognized

* change URL of apache license to use https

* sync from master

* fix usage of escape character in python regex. Fix generated python documentation

* write HTTP signed headers in user-specified order. Fix PEP8 formatting issues

* write HTTP signed headers in user-specified order. Fix PEP8 formatting issues

* http signature unit tests

* Fix PEP8 format issue

* spread out each requirement to a separate line

* run samples scripts

* run sample scripts

* remove encoding of '+' character
2020-01-26 18:17:26 -08:00
William Cheng
82e2448bf2 Merge remote-tracking branch 'origin/4.3.x' into 5.0.x 2020-01-20 15:46:13 +08:00
William Cheng
04af5e0445 Merge remote-tracking branch 'origin/master' into 4.3.x 2020-01-20 15:04:34 +08:00
Sebastien Rosset
fa0ef2be25 [Python] Conditionally set auth attributes (#4988)
* Enhance python API keys

* Run python scripts under ./bin/openapi3

* fix unit test issue

* Fix unit tests

* Fix unit tests

* Invoke bin scripts
2020-01-16 17:42:23 +08:00
Jim Schubert
78bf3adc4a
[core] Initial FeatureSet structures and definitions (#3614)
[core] Initial FeatureSet structures and definitions
Add default feature set to DefaultCodegen
Initial FeatureSet definitions for:

*  ada 
*  android 
*  apache2 
*  asciidoc 
*  aspnetcore 
*  avro 
*  bash 
*  c 
*  clojure 
*  cpp-pistache-server 
*  cpp-qt5-client 
*  cpp-qt5-qhttpengine-server 
*  cpp-restbed-server 
*  cpp-restsdk 
*  cpp-tizen 
*  csharp 
*  csharp-nancyfx 
*  csharp-netcore 
*  cwiki 
*  dart 
*  eiffel 
*  elixir 
*  elm 
*  erlang 
*  flash 
*  fsharp-functions 
*  go  Client/Server
*  graphql-nodejs-express-server 
*  graphql-schema 
*  groovy 
*  haskell 
*  haskell-http-client 
*  java 
*  jmeter 
*  kotlin 
*  kotlin vertx 
*  kotlin-server 
*  kotlin-spring 
*  lua 
*  mysql 
*  nim 
*  nodejs 
*  nodejs-express 
*  objc 
*  ocaml 
*  openapi 
*  openapi-yaml 
*  perl 
*  php 
*  php-laravel 
*  php-lumen 
*  php-silex 
*  php-slim 
*  php-symfony 
*  php-ze-ph 
*  powershell 
*  protobuf 
*  protobuf-schema 
*  python 
*  python-aiohttp 
*  python-blueplanet 
*  python-experimental 
*  r 
*  ror 
*  ruby 
*  ruby 
*  ruby-sinatra 
*  rust 
*  scala-akka 
*  scala-finch 
*  scala-gatling 
*  scala-http-client 
*  scala-lagom 
*  scala-play 
*  scalatra 
*  scalaz 
*  spring 
*  static docs 
*  swift 
*  typescript
2020-01-11 16:20:47 -05:00
William Cheng
b450ce8a5a Merge remote-tracking branch 'origin/4.3.x' into 5.0.x 2019-12-28 12:34:30 +08:00
William Cheng
81e15ed0bf Merge remote-tracking branch 'origin/master' into 4.3.x 2019-12-28 12:00:09 +08:00