mirror of https://github.com/tiangolo/fastapi.git
Continue patch from #5122 by not limiting response model validation
This commit is contained in:
parent
e4727ed20a
commit
3c29f0f97c
|
|
@ -20,6 +20,9 @@ from typing import (
|
|||
Type,
|
||||
Union,
|
||||
)
|
||||
import anyio
|
||||
from anyio import CapacityLimiter
|
||||
import functools
|
||||
|
||||
from fastapi import params
|
||||
from fastapi._compat import (
|
||||
|
|
@ -163,9 +166,10 @@ async def serialize_response(
|
|||
if is_coroutine:
|
||||
value, errors_ = field.validate(response_content, {}, loc=("response",))
|
||||
else:
|
||||
value, errors_ = await run_in_threadpool(
|
||||
field.validate, response_content, {}, loc=("response",)
|
||||
)
|
||||
# Run without a capacity limit for similar reasons as marked in fastapi/concurrency.py
|
||||
exit_limiter = CapacityLimiter(1)
|
||||
validate_func = functools.partial(field.validate, loc=("response",))
|
||||
value, errors_ = await anyio.to_thread.run_sync(validate_func, response_content, {}, limiter=exit_limiter)
|
||||
if isinstance(errors_, list):
|
||||
errors.extend(errors_)
|
||||
elif errors_:
|
||||
|
|
|
|||
Loading…
Reference in New Issue