我有以下用于FastAPI应用程序的Pydantic模式。
在以下架构中,每当我将ParameterSchema用作params的模式验证器时,它会给我以下错误:
在以下架构中,每当我将ParameterSchema用作params的模式验证器时,它会给我以下错误:
fastapi.exceptions.FastAPIError: Invalid args for response field! Hint: check that <class 'typing._GenericAlias'> is a valid pydantic field type
我完全不知道发生了什么事情!
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
expiryDate: Optional[datetime]
- Arne