Skip to content

feat: sub-routers and route prefix composition (include_router) #46

Closed

Description

@ZhuchkaTriplesix

Context

  • Today App is a flat registry: every route is registered on one object. Large APIs need namespaced paths (/api/v1/..., /admin/...) without repeating prefixes on every decorator.
  • See Feature gaps.

Direction

  • Add something like APIRouter / include_router(router, prefix=..., **defaults) in Python, merging route tables and OpenAPI paths into the parent App before freeze().
  • Alternatively: a prefix argument on the existing get/post/... decorators only (weaker, but less API surface).
  • OpenAPI: merged paths must remain valid; duplicate path+method should error at register time.

Acceptance criteria

  • At least one example under examples/ with two routers and a shared prefix.
  • Pytest: routes under prefix resolve; OpenAPI lists prefixed paths.
  • Document in docs/routing.md.

Research

  • FastAPI APIRouter; Starlette Router / mounts.

Activity

  1. added this to the v0.3.0 milestone on Apr 26, 2026
  2. added a commit that references this issue on Apr 26, 2026
  3. linked a pull request that will close this issuerelease: v0.2.0 hardening from dev #69on Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions