Coverage for src / lexigram / contracts / web / controller.py: 100%
7 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-19 05:41 +0800
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-19 05:41 +0800
1"""Web framework controller protocol."""
3from __future__ import annotations
5from typing import Any, Protocol, runtime_checkable
8@runtime_checkable
9class ControllerProtocol(Protocol):
10 """Structural protocol for controller objects.
12 Defines the minimum surface expected of any controller: the ability
13 to enumerate its declared routes. Type-check against this protocol
14 instead of the concrete ``Controller`` base class where possible.
15 """
17 @classmethod
18 def collect_routes(cls) -> list[dict[str, Any]]:
19 """Return route-definition dictionaries declared on this controller."""
20 ...
23__all__ = ["ControllerProtocol"]