我正在尝试确定是否可以在架构的键中放置空格。
我的回答似乎出现错误,并且似乎与此空间有关。没有空格,我得到200,并且得到验证错误。
下面使用foo_bar
的方式是它是pydantic.BaseModel
的属性,其实例将返回到装饰有FastAPI().post
的协程。
foo_bar = Schema(
...,
alias='foo bar'
)
foo_bar = Schema(...)
跟踪
File python3.6/site-packages/starlette/routing.py\", line 585, in __call__
await route(scope, receive, send)
File \"python3.6/site-packages/starlette/routing.py\", line 207, in __call__
await self.app(scope, receive, send)
File \"python3.6/site-packages/starlette/routing.py\", line 40, in app
response = await func(request)
File \"python3.6/site-packages/fastapi/routing.py\", line 122, in app
skip_defaults=response_model_skip_defaults
File \"python3.6/site-packages/fastapi/routing.py\", line 54, in serialize_response
raise ValidationError(errors)
pydantic.error_wrappers.ValidationError: 1 validation error
response
value is not a valid dict (type=type_error.dict)"