* python-pydantic-v1: Keep trailing commas for tuples when enum has just single member
* Update samples
* Add test for single member enums
* Refactor test name
* fix: object serialization for multipart requests
This PR is essentially
<https://github.com/OpenAPITools/openapi-generator/pull/18140> but for
the asyncio client.
* fix: int serialization for multipart requests
urllib3 handles serializing ints in post params (ref 1), while asyncio
explicitly does not (ref 2).
ref 1: <9316764e90/src/urllib3/filepost.py (L75-L76)>
ref 2: <https://github.com/aio-libs/aiohttp/issues/920>
* test: new fake multipart endpoint with files and body
* test: regression test for stringified body params
* fix: mypy tweak
* fix: FILES regeneration
* feat: object, int serialization for multipart reqs
Extends previous commits (and #18140) to cover the python-pydantic-v1
client as well.
* fix: use async with in test
* test: regression test for pydantic-v1-aiohttp
* test: add regression test to pydantic-v1
Also brings the second test in line with the first, patching
`urllib3.PoolManager.urlopen`
* Add enum support when building default values for model properties
* Update enum handling for Python for enum references
* Remove unused method
* Update mustaches for FastAPI, Pydantic, and Python for default values
* Address PR feedback and rebase main
* Remove old 2_0 samples
* Update Python mustache templates to fix _form_ typo and correct casing for class name when calling from_dict()
* Results of 'build the project' checklist step
* fix issue 18271
* the same update for python-pydantic-v1
* add test
* update samples
* update samples
* put properties under allOf for python client tests
* update samples
* add a test in test model
* Update model_generic.mustache, tuple notation breaks when there is only one element in the tuple
In this excerpt of the mustache template, the matching behaviour is bugged when there is only one element in the tuple notation. A single string with the tuple notation, e.g., `("string")`, will result in a string, and when values are compared with the string, it will do a `contains` match instead of an exact match, which is unintended behaviour.
* Update with samples, step 3
* Add test spec and regenerate samples
* Update samples
* Update spec and samples
* update samples
---------
Co-authored-by: Edmund Loo <edmundloo@users.noreply.github.com>
Co-authored-by: Edmund Loo <github.yn0u9@simplelogin.com>
* python: adjust basic typing information
This is an initial pass to fix and adjust the typing information for the
generated client. This is enough to have mypy runnning without complains
on all the (modern) generated clients (Pydantic v1 code is not checked
for instance)
mypy is also now run directly in the CI, so further changes will also be
checked and thus, will need to be compliant with good typing
information.
Note that this doesn't *fully* type all the code: mypy is not run in
"strict" mode and there are still many functions/methods/attributes
which are still not fully typed, but it's a first good step in that
direction.
* ApiResponse's raw_data can't be None
* Fix indentation
* Revert test changes
* run mypy on tests/ directory
* don't forcefully convert the client response headers to dict
* override petstore ApiResponse model
* adjust type of 'any/one_of_schemas' fields
* fix #16797 and #15796 spring child constructor missing parent params
* root cause and update the DefaultCodegen.java to add missing property when with multi inheritance
* rollback SpringCodegen.java
* update samples
* rollback with master cause #16992 fixed this issue too
* still using orignal design
* catchup master
* catchup master
* catchup master
* fix
* add tests
---------
Co-authored-by: dabdirb <dabdirb@gmail.com>
In #16624, I introduced a new mechanism to record imports to other
modules, instead of having specialized datetime/typing/pydantic objects
to manage imports for these modules.
This change reuses the mechanism from #16624 and replace the specialized
import managers by the generic one. Unused imports from various
.mustache templates are also cleaned up.
* Delete sample folders of discontinued clients
* Remove duplicate python-flask server sample
The python-flask sample actually lives in samples/server/petstore/python-flask.
* Move hand-written test to "tests" folder
Now, "test" only contains generated stubs and all hand-written tests are in "tests".
* Delete left-over files in Python samples
These are not created by the generators (anymore) and not hand-written
for testing.
* Regenerate test file to fix import error
* refactor: Clean up _response_types_map formatting
It matches black's behavior of having trailing commas now.
* test: Add test to reproduce #16967
* fix: deserialize responses even if no returnType
Closes#16967
* refactor: Simplify ApiException subclasses
* refactor: Move exception subtype choice to ApiException
* feat: Deserialize error responses and add to exceptions
* test: Add for error responses with model
* 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>
* [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>
* 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