'"FastAPIError: Invalid args for response field! Hint: check that <class 'typing._UnionGenericAlias'> is a valid pydantic field type"
I have the following Pydantic schema for a FastAPI app.
In the following schema, whenever I have ParameterSchema as the schema validator for params, it gives me the following error:
fastapi.exceptions.FastAPIError: Invalid args for response field! Hint: check that <class 'typing._GenericAlias'> is a valid pydantic field type
I have no idea what's going on!
class ParameterSchema(BaseModel):
expiryDate = Optional[datetime]
class Config:
arbitrary_types_allowed = True
class RequestProvisioningEventData(BaseModel):
some_attribute: List[str]
other_attribute: Optional[List[str]] = []
bool_attribute: bool
params: ParameterSchema
class Config:
use_enum_values = True
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
