Robert Schweizer
61fde48501
fix: Disable warnings for model_* properties ( #17066 )
...
For model classes with model_something fields, pydantic raises a warning by default:
`Field "model_something" has conflict with protected namespace "model_".`.
These warnings make no sense here, because most users of the generator have established APIs
that they cannot change to conform to pydantic's safety rules.
Pydantic will raise an error if we ever conflict with a current attribute like `model_dump`.
2023-11-14 21:50:35 +08:00
Rolf Rando
2ca958642b
Add socks5 proxy support for OpenAPI generated python client ( #16918 )
...
* add socks5 proxy support (requires additional import)
* updated examples
* build samples. updated to support pydantic python option
* rename sock to socks for correct protocol name
* add proxy headers for pydantic
* fixed param changes from conflict resolution
2023-11-14 12:28:05 +08:00
OliverTetzTT
d1b148a7d3
[python] added handling for boolean content type ( #17020 )
...
* added handling for boolean content type
* adapted addition to newer version of template
* [python] updated samples
2023-11-14 11:30:10 +08:00
William Cheng
53289263d9
Prepare v7.2.0 ( #17050 )
...
* update version to 7.2.0-SNAPSHOT
* update samples
* update doc
2023-11-13 18:53:20 +08:00
Robert Schweizer
65ccf0492c
fix: Raise exceptions on non-2xx responses ( #16999 )
2023-11-07 10:44:45 +08:00
William Cheng
49208144e1
Better handling of allOf in request body ( #16991 )
...
* better handling of allOf in request body, add tests
* additional checks
* fix description
2023-11-05 22:43:45 +08:00
Yohei Kitamura
61629ae8ed
[python] Add back __enter__
and __exit__
methods for non asyncio ( #16979 )
2023-11-04 16:54:17 +08:00
Mark Haley
a4267ee630
fix parameters_to_url_query returns booleans with upper letter ( #16947 )
...
* chore: add test to show python bool url params are not lower case
* fix: python parameters_to_url_query template to properly detect booleans
* fix: typo in test
* fix: typo in test
* chore: update test name to snake case and be more descriptive
2023-11-01 23:30:32 +08:00
ふぁ
8827da8012
[python] fix typing for API responses ( #16802 )
...
* [python] remove _preload_content
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] remove _return_http_data_only
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] remove async_req
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] fix typing for API responses
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update samples
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] fix AttributeError
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] remove _preload_content
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] fix response_type
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] fix typo
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update simplify RESTClientObject
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update split call_api into 4 functions
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update samples
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update improve stream
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] remove kwargs
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update ApiResponse
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] add method for each return value
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update test
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update samples
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update docs
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] add constantParams
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] fix ImportError
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] fix SyntaxError in RESTResponse
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] add ApiResponse model_config
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] fix when isBinary is str
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update type
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update samples
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] add rest with pydantic v1
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update format
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update format and type
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] add test
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update type to pydantic strict type
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] remove leftover files
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] remove descriptions per field
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] add test
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] fix test
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] fix test
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] remove multiprocessing
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update samples
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] add blank line to docstring
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] update docstring
Signed-off-by: ふぁ <yuki@yuki0311.com>
* [python] remove unwanted imports in rest
Signed-off-by: ふぁ <yuki@yuki0311.com>
---------
Signed-off-by: ふぁ <yuki@yuki0311.com>
2023-10-30 12:37:23 +08:00
Robert Schweizer
2b6b3b0883
[python] Do not pydantic-validate function args twice ( #16776 )
...
* refactor: Use newlines in _with_http_info call
This prevents too-long lines and matches the style that
black would enforce.
* fix: Do not pydantic-validate function args twice
Closes #15757
2023-10-11 13:57:52 +08:00
Robert Schweizer
7af459396c
docs: Improve docstring in to_dict() method ( #16777 )
...
It was often confusing to me why this method is even there.
Also using more line breaks and matching how black would format this.
2023-10-11 13:51:37 +08:00
Robert Schweizer
f03cbea971
feat: Add line breaks in Python API methods ( #16770 )
2023-10-10 18:32:52 +08:00
Robert Schweizer
9e07f85eb5
[python] Add tests and fix enum path parameters ( #16769 )
...
* test: Tests for enum params in path, query and header
* fix: Get enum ref values correctly in path parameters
Closes #16688
* fix java tests failure
---------
Co-authored-by: William Cheng <wing328hk@gmail.com>
2023-10-10 17:10:30 +08:00
Jonathan Ballet
cec5b8965a
python: type generated client using Self ( #16693 )
...
* python: type generated client using Self
This doesn't offer a clear win but this helps for:
* Using modern types and making the typing intent clearer
* Decreasing the need for `from __future__ import annotations`, since a
class can now refer to itself without using its name
* Using more `cls` to automatically refer to the class, instead of
respecifying the class name every time
Self is available from Python 3.11 and is provided in typing_extensions
(since 4.0.0) as a fallback for older versions
See: https://peps.python.org/pep-0673/
See: https://github.com/python/typing_extensions/blob/main/CHANGELOG.md#added-in-version-400
* generate code
2023-10-01 23:31:39 +08:00
William Cheng
ce4b2fe7bd
[Python] add float
to reserved word list ( #16689 )
...
* add float as reserved world
* clean up
* update samples
* Update modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java
Co-authored-by: Jonathan Ballet <jon@multani.info>
* update doc
* uncomment test
---------
Co-authored-by: Jonathan Ballet <jon@multani.info>
2023-10-01 20:41:54 +08:00
William Cheng
3fcf5584c6
Add tests for python client with disallowAdditionalPropertiesIfNotPresent set to true ( #16690 )
...
* add tests for python client with different option
* update samples
* update tests
2023-10-01 17:34:52 +08:00