Clean up
This commit is contained in:
parent
3930982bd8
commit
ad7968dadd
53 changed files with 564 additions and 1013 deletions
|
|
@ -1,8 +1,5 @@
|
|||
"""ASGI app, lifespan, static files mount, route registration."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
from contextlib import asynccontextmanager
|
||||
from html import escape
|
||||
|
|
@ -37,7 +34,6 @@ STATUS_CODE_MAP: dict[int, str] = {
|
|||
413: "payload_too_large",
|
||||
422: "bad_request",
|
||||
429: "rate_limited",
|
||||
507: "quota_exceeded",
|
||||
500: "server_error",
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +90,12 @@ def create_app() -> FastAPI:
|
|||
request: Request, exc: RequestValidationError
|
||||
) -> JSONResponse:
|
||||
fields = sorted(
|
||||
{".".join(str(loc) for loc in e.get("loc", ()) if loc != "body") for e in exc.errors()}
|
||||
field
|
||||
for field in {
|
||||
".".join(str(loc) for loc in e.get("loc", ()) if loc != "body")
|
||||
for e in exc.errors()
|
||||
}
|
||||
if field
|
||||
)
|
||||
if fields:
|
||||
detail_str = "Validation failed for: " + ", ".join(f for f in fields if f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue