fix: add .json suffix to check-ins route#12392
fix: add .json suffix to check-ins route#12392Jah-yee wants to merge 1 commit intointernetarchive:masterfrom
Conversation
Frontend POSTs to /works/OL{work_id}W/check-ins.json but FastAPI route only defined for /works/OL{work_id}W/check-ins causing 404.
|
Thanks for the PR, @Jah-yee! Welcome to Open Library — this is your first contribution. 🤖 Copilot has been assigned for an initial review. @RayBB is assigned to this PR and currently has:
PR triage checklist (maintainers / Pam)
Note This comment was automatically generated by Pam, Open Library's Project AI Manager, on behalf of @mekarpeles. Pam is designed to provide status visibility, perform basic project management functions and relevant codebase research, and provide actionable feedback so contributors aren't left waiting. |
| @@ -51,7 +51,7 @@ class CheckInResponse(BaseModel): | |||
| id: int | |||
|
|
|||
|
|
|||
There was a problem hiding this comment.
Changing the route from /works/OL{work_id}W/check-ins to only /works/OL{work_id}W/check-ins.json will break existing callers that still POST to the non-suffixed path (e.g. openlibrary/plugins/openlibrary/js/goodreads_import.js posts to ${work.key}/check-ins). To avoid a regression, keep the original route as an alias (e.g. add a second @router.post("/works/OL{work_id}W/check-ins", include_in_schema=False) decorator above this handler, similar to openlibrary/fastapi/books.py:42-44).
| @router.post("/works/OL{work_id}W/check-ins", include_in_schema=False) |
|
Please follow our contributing guidelines and wait to be assigned before working on any issues. Thanks |
Summary
Frontend POSTs to
/works/OL{work_id}W/check-ins.jsonbut FastAPI route only defined for/works/OL{work_id}W/check-inscausing 404.Fix
Added
.jsonsuffix to FastAPI router decorator.Testing
Closes #12391