Skip to content

docs(planning): record decision to keep version as a function decorator#19

Merged
lesnik512 merged 1 commit into
mainfrom
docs/decision-version-route-mechanism
Jul 4, 2026
Merged

docs(planning): record decision to keep version as a function decorator#19
lesnik512 merged 1 commit into
mainfrom
docs/decision-version-route-mechanism

Conversation

@lesnik512

Copy link
Copy Markdown
Member

What

Records the first entry in planning/decisions/ — the outcome of architecture-review candidate 2 (fold set_api_version into a version= route kwarg).

Decision: rejected. Per-route version stays on the endpoint function (set_api_version / the version attribute).

Why

Verified against FastAPI 0.139.0 / Starlette 1.3.1: the APIRouter verb methods (.get, .post, …) forward a closed, explicit parameter list to api_route with no **kwargs, and api_route's signature is likewise closed. So @router.get("/x", version=(2,0)) raises TypeError unless the verb methods are overridden — which would collapse their explicit response_model=/status_code=/… signatures into **kwargs, costing library users their autocomplete to delete a 3-line pass-through. That fails the deletion test. The alternative (a separate versioned() idiom) fragments the routing API for marginal gain.

The decision file captures the constraint, the rejected options, and concrete revisit triggers (FastAPI adding **kwargs/a metadata slot, or dropping eager route registration) so a future architecture review doesn't re-suggest the same thing.

No code changes. just check-planningplanning: OK; the decision appears under ## Decisions in just index.

Architecture-review candidate 2 proposed folding set_api_version into a
version= kwarg on the router verb methods. Rejected: FastAPI 0.139's verb
methods forward a closed, explicit parameter list to api_route (no **kwargs),
so version= is impossible without overriding the verb methods and collapsing
their explicit signatures into **kwargs. Records the constraint and revisit
triggers so future reviews don't re-suggest it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lesnik512 lesnik512 merged commit 18cf5f3 into main Jul 4, 2026
6 checks passed
@lesnik512 lesnik512 deleted the docs/decision-version-route-mechanism branch July 4, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant