[Arch] Inconsistent request validation — 7 Pydantic models vs 13 raw request.json() sites #52
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Medium | Category: Backend
main.py defines only 7
BaseModelclasses vs 13 call sites usingawait request.json()with manual dict extraction (main.py:264,275,291,368,407,446,472,555,1051,1152,1179,1245,1440). Zero endpoints declareresponse_model.Recommendation: Add
BaseModelrequest bodies for remainingrequest.json()sites, starting withPUT /api/shipments/{id}andPUT /api/settings(the latter's open-ended key-value shape is a legitimate exception, document rather than "fix").Full detail:
docs/architecture-review.md§ C, Finding "Inconsistent request validation..."Fixed on branch
architecture-rework, commitd68c7d4: added typed Pydantic models for all 12 remaining rawrequest.json()endpoints (PUT /api/settingsstays a flat dict, as the finding itself noted is legitimate). One intentional behavior change:PUT /auth/menow returns 422 for an over-lengthdisplay_nameinstead of silently truncating it, matching every other length-bounded field in the file. Full suite: 259 passed.