mirror of https://github.com/tiangolo/fastapi.git
Fixed responses model return format to also work use serialization mode
This commit is contained in:
parent
1bf5e7a10e
commit
5dcb06f3b4
|
|
@ -478,7 +478,11 @@ class APIRoute(routing.Route):
|
|||
additional_status_code
|
||||
), f"Status code {additional_status_code} must not have a response body"
|
||||
response_name = f"Response_{additional_status_code}_{self.unique_id}"
|
||||
response_field = create_response_field(name=response_name, type_=model)
|
||||
response_field = create_response_field(
|
||||
name=response_name,
|
||||
type_=model,
|
||||
mode="serialization",
|
||||
)
|
||||
response_fields[additional_status_code] = response_field
|
||||
if response_fields:
|
||||
self.response_fields: Dict[Union[int, str], ModelField] = response_fields
|
||||
|
|
|
|||
Loading…
Reference in New Issue