* test: fix broken python test
* fix: handle multiple file parameters
Previously an array of files was not handled correctly, despite the type
annotation implying it was.
* feat: handle filename,filedata tuples in file param
This allows for users to pass filenames with their data in file params,
which is useful for multipart formdata requests. Without this, the list
of files added in the previous commit would have the same filename for
all files (the parameter name).
* 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
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.
* updating test to use the Java RESTEasy echo api client (#17367)
* regenerated samples
* set source and target to 1.8 to fix workflow failure, adapted parser
* 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
* 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
* In samples/openapi3/client/petstore/python, this reduces the mypy errors from 435 to 178 errors
* In samples/openapi3/client/petstore/python-aiohttp, this reduces the mypy errors from 381 to 124 errors
* In samples/client/echo_api/python, this reduces the mypy errors from 131 to 25 errors
* 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
* 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