Rename Router.get() param endpoint -> action - #180
Conversation
Consistently rename the second positional parameter across get, post, put, patch, delete, head, options, and _add_route so the public API uses action instead of endpoint for the route handler callable.
tmgbedu
left a comment
There was a problem hiding this comment.
[Code Reviewer verdict: APPROVE — posting as a comment; gh blocks formal --approve since the reviewing account is also the PR author.]
Verified this is a pure, mechanical rename with no behavior change:
- Full diff (16 additions / 16 deletions, single file
router.py) only touches the parameter nameendpoint->actiononget,post,put,patch,delete,head,options, and_add_route, plus every internal reference to that parameter inside each method body. No logic, defaults, types, or call order changed. _add_routestill callsself.router.add_api_route(path, action, methods=..., ...)— passed positionally, so FastAPI's ownendpointparameter name is irrelevant; behavior identical to before.resource()is unaffected: it callsself.get/post/put/delete(...)with the handler positional (e.g.self.get(f"/{name}", fn("index"), name=...)), never viaendpoint=keyword, so the rename doesn't touch it.- Grepped the entire monorepo (not just this package) for
endpoint=keyword call sites against these Router methods — none found. The onlyendpoint=hits in the repo are unrelated S3 storage config (AWS_ENDPOINT) instorage/config/storage.pyand the pingcrm example, not Router calls. - Checked docs (
*.md) for Router usage examples using anendpoint=keyword — none found; existing examples all pass the handler positionally, so no doc drift. - No
.pyistub exists forRouterthat would also need updating. - No docstrings/comments reference
endpointelsewhere in the file — nothing missed.
Test evidence checks out — reran independently on the PR branch (not just trusting the PR description):
uv run pytest tests/fastapi/ -v→ 117 passed, matches engineer's claim exactly.tests/fastapi/test_router.pycalls all renamed methods positionally (e.g.r.get("/items", endpoint)whereendpointis just a local fixture name, not a keyword arg) — confirms no test relies on the old keyword name.- Ran the full suite for good measure:
uv run pytest --ignore=tests/masoniteorm/postgres -q→ 1833 passed, 7 skipped, 4 subtests passed, no regressions anywhere else.
No issues found. Approving — safe to merge.
tmgbedu
left a comment
There was a problem hiding this comment.
[Code Reviewer verdict: APPROVE — posting as a comment; gh blocks formal --approve since the reviewing account is also the PR author.]
Verified this is a pure, mechanical rename with no behavior change:
- Full diff (16 additions / 16 deletions, single file
router.py) only touches the parameter nameendpoint->actiononget,post,put,patch,delete,head,options, and_add_route, plus every internal reference to that parameter inside each method body. No logic, defaults, types, or call order changed. _add_routestill callsself.router.add_api_route(path, action, methods=..., ...)— passed positionally, so FastAPI's ownendpointparameter name is irrelevant; behavior identical to before.resource()is unaffected: it callsself.get/post/put/delete(...)with the handler positional (e.g.self.get(f"/{name}", fn("index"), name=...)), never viaendpoint=keyword, so the rename doesn't touch it.- Grepped the entire monorepo (not just this package) for
endpoint=keyword call sites against these Router methods — none found. The onlyendpoint=hits in the repo are unrelated S3 storage config (AWS_ENDPOINT) instorage/config/storage.pyand the pingcrm example, not Router calls. - Checked docs (
*.md) for Router usage examples using anendpoint=keyword — none found; existing examples all pass the handler positionally, so no doc drift. - No
.pyistub exists forRouterthat would also need updating. - No docstrings/comments reference
endpointelsewhere in the file — nothing missed.
Test evidence checks out — reran independently on the PR branch (not just trusting the PR description):
uv run pytest tests/fastapi/ -v→ 117 passed, matches engineer's claim exactly.tests/fastapi/test_router.pycalls all renamed methods positionally (e.g.r.get("/items", endpoint)whereendpointis just a local fixture name, not a keyword arg) — confirms no test relies on the old keyword name.- Ran the full suite for good measure:
uv run pytest --ignore=tests/masoniteorm/postgres -q→ 1833 passed, 7 skipped, 4 subtests passed, no regressions anywhere else.
No issues found. Approving — safe to merge.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
Router.get,post,put,patch,delete,head,options, and the internal_add_routehelper fromendpointtoactionfor a consistent public API naming.Test plan
uv run pytest fastapi_startkit/tests/fastapi/ -v— 117 passedendpoint=keyword call sites against Router methods — none found; existing callers pass the handler positionally