28 Commits

Author SHA1 Message Date
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
ふぁ
c6e9a4e1ae
[python] change Private attr to Class vars (#16687)
* [python] fix TypeError

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update Private model attributes to Class vars

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] rename the List of test cases to ListClass

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] rename the List of v1 test cases to ListClass

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] rename the List of v1-aiohttp test cases to ListClass

Signed-off-by: ふぁ <yuki@yuki0311.com>

* update samples

---------

Signed-off-by: ふぁ <yuki@yuki0311.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
2023-10-01 16:52:23 +08:00
ふぁ
e2f249ba35
[PYTHON] generate code based on pydantic v2 (#16685)
* [python] replace validator with field_validator

* [python] replace parse_obj with model_validate

* [python] replace dict with model_dump

* [python] replace construct with model_construct

* [python] replace __fields_set__ with model_fields_set

* [python] replace __fields_set__ in the test cases with model_fields_set

* [python] replace validate_arguments with validate_call

* [python] replace max_items, min_items with max_length, min_length

* [python] replace Config class with model_config

* [python] replace allow_population_by_field_name with populate_by_name

* [python] remove {{{classname}}}_ONE_OF_SCHEMAS

* [python] update test cases

* [python] update samples

* [python] fix typos in test cases
2023-09-29 16:45:46 +08:00
Jonathan Ballet
04fa53b692
python: generate Pydantic v2 + typing complete code (#16624)
* python: improve type generation with more specific typing

* Annotate function parameters

* Remove unused imports

* remove unused files

* remove temporary hack

* remove lock file

* fix Annotated import

* support Python 3.7

* Regenerate code with typing-extensions

* Fix setup.py

* More Pydantic v2 compatibility

* depend on pydantic v2

* fix client_echo tests

* fix JSON serialization

* Fix references

* Skip circular dependency tests for now

* Temporarily hide the "float" property

The "float" property aliases the "float" type and completely breaks the
model: all the properties that were "float" now become the type of the
"float" property instead.

* Fix errors

* Import Literal from typing_extensions

* Fix GitHub Action workflows

* Fix Python 3.7 failure

* Fix quotes

* Apply suggestions from code review

* Fix tests

* split model imports from other modules imports

* fix workflow

* Comment the array unique items convertion, remove set translation

* Replace alias usage
2023-09-28 19:13:14 +08:00
William Cheng
16c6cff28f
fix required parameter check (#16628) 2023-09-20 17:05:55 +08:00
Jonathan Ballet
a2f6b8eae5
python: remove non-async code path from the aiohttp generator (#16601)
* python: remove non-async code path from the aiohttp generator

This removes all the non-async code from the aiohttp generator:

* all the methods that should be asynchronous are marked as `async`
* the `async_req` parameter is gone; calls are directly awaitables now
* the async calls into a thread pool are gone and the thread pool is
  gone too (now useless)

Closes: #15824
Closes: #5539
Related: #763
Related: #3696

* Fix empty line

* remove more
2023-09-20 10:48:31 +08:00
William Cheng
5e8e2d7f6d
Prepare v7.1.0 in master (#16608)
* prepare v7.1.0 in master

* update
2023-09-18 17:37:36 +08:00
William Cheng
a5f79a7bdc
[python] Update github workflow, use debug instead of warning (#16565)
* update github workflow, use debug instead of warning

* use debug instead of warn
2023-09-12 16:55:53 +08:00
William Cheng
dee536f7f7
import Annotated if needed (#16521) 2023-09-07 14:36:45 +08:00
jessemyers-lettuce
b34a10aee7
python: ignore long lines for model descriptions (#16518)
Descriptions can easily exceed line-length limits because they are often
extracted from doc/comments strings, which may use unexpected formatting.

Python doc strings, in particular, are likely to use newlines, which mustache
does not preserve, causing descriptions to be condensed to a single line.
2023-09-06 10:48:43 +08:00
jessemyers-lettuce
1b32088c2d
python: use isinstance instead of type() (#16516)
Use of `isinstance` is preferred (and validated by common linters).
2023-09-05 23:45:18 +08:00
William Cheng
47a85e880b
Add tests for http basic authentication in python client (#16488)
* add tests for http basic auth in python client

* add new files
2023-09-03 19:11:53 +08:00
William Cheng
ebc9bcda44
[java][native] Add tests for oneOf form parameters (#16487)
* add tests for oneOf form parameters

* update samples
2023-09-03 16:15:54 +08:00
jessemyers-lettuce
40731ed52d
python: several typing and style improvements (#16378)
* python: several typing and style improvements

The generated (python) code fails with several standard validation tools,
including `flake8`, `mypy`, and `autoflake`. While fixing every possible
violation -- especially wrto typing -- woudl be a project, some of the
changes are fairly easy.

 - The `autoflake` tool picks up on unused imports. These can just be removed.

 - The `mypy` tool picks up on numerious typing violations, especially if set
   to its strictest mode. As a starting point, all functions ought to annotate
   a return type, including constructors, even if the return type is `None`
   because otherwise the functions are omitted from type checking and it's
   impossible to make incremental progress towards adding types.

 - The `flake8` tool mostly finds whitespace and line-length issues; while
   line-length standards very, the source already includes several flake8
   ignores, so it seems safe to add a few more.

* Add generated files

* Restore imports used by `AbstractPythonCodegen.java`

* Update generated files
2023-09-02 01:03:02 +08:00
Davy Durham
4a1c70f2f1
fix: python client generator didn't respect range response specification (#16451)
* bug: python client generator didn't respect range response specification (e.g. "1XX", "2XX", etx.).  Return values tended to become None as a result

* update samples

---------

Co-authored-by: William Cheng <wing328hk@gmail.com>
2023-08-31 10:15:30 +08:00
William Cheng
80121aa88f
Prepare v7.0.1 (#16409)
* prepare 7.0.1 in master

* update doc
2023-08-25 16:11:29 +08:00
ふぁ
f3b930c48c
[python-nextgen] Fix noqa: E501 position (#16280)
* Fix `noqa: E501` position

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python-nextgen] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

---------

Signed-off-by: ふぁ <yuki@yuki0311.com>
2023-08-08 20:42:12 +08:00
ふぁ
48ff57b4f6
[python-nextgen] fix #16010 circular refs lead to no imports (#16199)
* [python-nextgen] fix #16010 circular refs lead to no imports

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python-nextgen] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python-nextgen] remove unnecessary Postponed annotations

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python-nextgen] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python-nextgen] remove unnecessary Postponed annotations

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python-nextgen] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python-nextgen] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

---------

Signed-off-by: ふぁ <yuki@yuki0311.com>
2023-07-30 00:42:46 +08:00
ふぁ
d9fc039dcf
[python-nextgen] fix #16151 Disallow additional properties if not present - missing Any and Dict import (#16208)
* [python-nextgen] fix #16151 Disallow additional properties if not present - missing Any and Dict import

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python-nextgen] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python-nextgen] remove unwanted imports

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python-nextgen] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python-nextgen] remove unwanted imports

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python-nextgen] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

---------

Signed-off-by: ふぁ <yuki@yuki0311.com>
2023-07-29 10:51:28 +08:00
Luca
584f8448ee
[Java][Native] Fix multipart builder files array (#16055) (#16094)
* [Java] Fixed bug in native client generation when API accepts array of files (#16055)

* Adding test for java native client

* Updated samples
2023-07-24 15:57:21 +08:00
William Cheng
7b3681af47
fix isMap (#16043) 2023-07-11 17:14:44 +08:00
William Cheng
d2e10a7229
install urllib3 < 2.1.0 (#15810) 2023-06-12 15:58:51 +08:00
William Cheng
6788f43af0
Better handling of Inline schema (#15682)
* skip allOf inline subschema created as $ref

* add option for fallback

* add back atleastonemodel

* add log

* update java, kotlin, js samples

* update tests

* fix native client test

* fix java client errors by regenerating test files

* clean up python

* clean up powershell

* clean up php

* clean up ruby

* update erlang, elixir

* update dart samples

* update ts samples

* update r, go samples

* update perl

* update swift

* add back files

* add back files

* remove outdated test files

* fix test
2023-06-11 15:35:58 +08:00
William Cheng
21748e024a
add py.typed (#15804) 2023-06-10 21:48:54 +08:00
gyoganathan
fc474eab5f
Added BadRequestException as a subclass in python (#15722)
Co-authored-by: Gomathi Yoganathan <gyoganathan@C02G45FPMD6R.corp.proofpoint.com>
2023-06-10 15:27:18 +08:00
William Cheng
10c270fda6
fix date isinstance check (#15675) 2023-05-31 00:03:14 +08:00
William Cheng
01ed5975e1
rename python-nextgen to python (#15504) 2023-05-16 13:54:07 +08:00