* Add `ca_cert_data` parameter to Python client.
This lets a client validate a server's CA certificate chain using a
variable/constant containing PEM (`str`) or DER (`bytes`) data, rather than
needing to reference a file on disk.
* python: Fix `ca_cert_data` on Python 3.8
* 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).
* Adding decimal to template for Python generator
* Rerunning the build steps
* Add tests for decimal serialization and deserialization.
* Move test to python not legacy pydantic sample
* readd old imports
---------
Co-authored-by: Adam <abolfik@pollyex.com>
* avoid setting debug property if not needed
* update samples
* fix compatibility with python 3.7
* always set Configuration.__debug
* update samples
* check `Configuration` behavior when debug parameter is / is not set
* address PR requests
* fix-for-bug-16086
* add to_dict alternative
* fix assertEqual
* remove extra blank line + test_model Argument SecretStr set
* update samples / remove extra blank line
* restore sanitize test for serialization with different data types
* remove empty line in api_client.mustache
* remove 2nd empty line in api_client.mustache
* 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
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
This was removed in #16802, but using a higher value than 1,
or at least making this configurable makes complete sense.
Without this, we get a lot of these log messages:
[ WARNING] Connection pool is full, discarding connection:
* 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
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`.
* 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
* 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