Replies: 2 comments
|
Checked all of these against master, they're all real. Line references so you can point at them in the PR. Pagination, def read_users(session: SessionDep, skip: int = 0, limit: int = 100) -> Any:
def read_items(session: SessionDep, current_user: CurrentUser, skip: int = 0, limit: int = 100)Bare
class PrivateUserCreate(BaseModel):
email: str
password: str
full_name: str
is_verified: bool = FalseYour read is right, and the email case is worse than a 500 on the next request. On And The header, content=email_data.html_content, headers={"subject:": email_data.subject}Trailing colon in the key. One character. Something worth putting in the PR description: I'd split it into two PRs. Pagination on its own is clean and uncontroversial and should merge quickly. The private-router changes are more opinionated (422 vs 400 on the duplicate, whether |
|
Thanks, useful pass. The permanent-breakage angle is the one that matters: that bad email row can't be serialized by UserPublic, so GET /users/ stays broken until someone deletes it by hand - not a one-off 500. And is_verified is only ever set on that model, nothing reads it back. I've actually already put these up as one PR, #2455, with tests. Your split point is fair though. Pagination is the clean, always-mounted one and could stand on its own; the /private changes are more of a judgment call - that router only mounts in development, and there's a real question of whether is_verified should be dropped or implemented. If a maintainer would rather review those separately, I'm happy to break #2455 into a pagination PR plus a /private one and keep the opinionated part in this thread. |
Uh oh!
There was an error while loading. Please reload this page.
First Check
Example Code
Description
While exercising a fresh copy of the template I hit several endpoints that return 500 (or crash) on input that should be a 4xx:
Pagination (GET /items/, GET /users/): skip/limit are unbounded, so negative values reach Postgres OFFSET/LIMIT and 500. Expected: 422.
POST /private/users/ (dev-only router): email is a bare str, so an invalid address is committed and every later read 500s on UserPublic (EmailStr); no password bounds; is_verified is accepted but has no column; a duplicate email 500s on UniqueViolation. Expected: 422 for bad input, 400 for duplicate.
POST /password-recovery-html-content/{email}: the response header name is "subject:" — an invalid HTTP header name that raises RuntimeError.
Minor: password recovery sends SMTP synchronously, so the HTTP response waits on mail.
I have a fix ready (shared SkipQuery/LimitQuery, EmailStr + bounds + duplicate→400 via crud.create_user, "subject" header, BackgroundTasks for the email) with tests for each case, and all changes pass ruff. Would you be open to a PR?
Operating System
Windows
Operating System Details
No response
Project Version
main @ commit 68adb40
Python Version
3.14
Additional Context
No response
All reactions