Skip to content

Commit 243563b

Browse files
committed
docs: add context7.json for Context7 indexing
1 parent f018f5f commit 243563b

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

context7.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "https://context7.com/schema/context7.json",
3+
"projectTitle": "fastapi-typed-errors",
4+
"description": "Typed HTTP errors for FastAPI: exact Literal error codes and discriminated oneOf unions on the code field in OpenAPI, from a single source of truth — the error class.",
5+
"folders": ["docs/en"],
6+
"excludeFolders": ["docs/en/assets", "docs/en/reference"],
7+
"rules": [
8+
"Requires Python >= 3.12 and fastapi >=0.115,!=0.137.*,!=0.138.*, pydantic >= 2.9.",
9+
"Define an error by subclassing BaseError parametrized with a StrEnum member or a bare Literal code, e.g. `class NotFoundError(BaseError[Literal[Code.NOT_FOUND]]): http_status = HTTPStatus.NOT_FOUND`.",
10+
"Wire the handler explicitly the FastAPI way: `app.add_exception_handler(BaseError, handle_base_error)`. There is no install() helper.",
11+
"Declare an endpoint's errors with Raises[...] inside the return annotation — `-> Annotated[Item, Raises[NotFoundError]]` — after wrapping the router: `router = with_errors(router)`.",
12+
"Use `with_errors(router, auto=True)` to auto-fill responses from raise statements across the endpoint and its full dependency tree.",
13+
"Verify declared vs actually-raised errors in CI with `check_raises(app)` or the `fastapi-typed-errors` CLI."
14+
]
15+
}

0 commit comments

Comments
 (0)