You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When attempting to generate the client for an endpoint containing a route with a default value represented by a Pydantic model, the client generation fails. Specifically, the issue arises when the default value is set as a Pydantic model, such as the example below:
The generated client results in the following error message:
Warning(s) encountered while generating. Client was generated, but some pieces may be missing
WARNING parsing POST /graph_study/{customer_name}/distinct_identities/distinct_to_base/eat_cake within default. Endpoint will not be generated.
Value {'slices': 20} is not valid, only None is allowed
This issue is caused by a condition not being met in the union.py file.
To Reproduce
Define a FastAPI app with a route containing a Pydantic model with a default value.
Attempt to generate the client using openapi-python-client version 0.17.2.
The default keyword specifies a default value. This value is not used to fill in missing values during the validation process. Non-validation tools such as documentation generators or form generators may use this value to give hints to users about how to use a value. However, default is typically used to express that if a value is missing, then the value is semantically the same as if the value was present with the default value. The value of default should validate against the schema in which it resides, but that isn't required.
I think this would suggest a behavior of ignoring values that do not validate against the schema (treating it as missing instead).
Describe the bug
When attempting to generate the client for an endpoint containing a route with a default value represented by a Pydantic model, the client generation fails. Specifically, the issue arises when the default value is set as a Pydantic model, such as the example below:
The generated client results in the following error message:
This issue is caused by a condition not being met in the union.py file.
To Reproduce
OpenAPI Spec File
Desktop (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: