feat: add raise_validation_errors
parameter to setup()
To control how pydantic.ValidationError will be handled, own handler (return json) or raise exception to allow intercept in aiohttp middleware
This commit is contained in:
parent
cdcd526fb4
commit
53357214a8
@ -13,10 +13,13 @@ def setup(
|
||||
apps_to_expose: Iterable[web.Application] = (),
|
||||
url_prefix: str = "/oas",
|
||||
enable: bool = True,
|
||||
raise_validation_errors: bool = False,
|
||||
):
|
||||
if enable:
|
||||
oas_app = web.Application()
|
||||
oas_app["apps to expose"] = tuple(apps_to_expose) or (app,)
|
||||
for a in oas_app["apps to expose"]:
|
||||
a['raise_validation_errors'] = raise_validation_errors
|
||||
oas_app["index template"] = jinja2.Template(
|
||||
resources.read_text("aiohttp_pydantic.oas", "index.j2")
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user