Skip to content

Commit ad2395a

Browse files
committed
Add AsyncAPI router and update dependencies
This commit integrates a new AsyncAPI router in the app's routes and updates the `pyproject.toml` and `uv.lock` with new dependency versions and requirements. Minimum Python version is updated to 3.10, and the `pydantic-asyncapi` library is now included to facilitate AsyncAPI integration.
1 parent 438d8e9 commit ad2395a

File tree

4 files changed

+124
-349
lines changed

4 files changed

+124
-349
lines changed

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
authors = [
33
{name = "Federico Busetti", email = "[email protected]"},
44
]
5-
requires-python = "<3.14,>=3.9"
5+
requires-python = "<3.14,>=3.10"
66
name = "bootstrap-fastapi-service"
77
version = "0.1.0"
88
description = ""
@@ -14,7 +14,7 @@ dependencies = [
1414
"cloudevents-pydantic<1.0.0,>=0.0.3",
1515
"dependency-injector[pydantic]<5.0.0,>=4.41.0",
1616
"dramatiq[redis,watch]<2.0.0,>=1.17.1",
17-
"hiredis<4.0.0,>=3.1.0", # Recommended by dramatiq
17+
"hiredis<4.0.0,>=3.1.0", # Recommended by dramatiq
1818
"httpx>=0.23.0",
1919
"opentelemetry-distro[otlp]",
2020
"opentelemetry-instrumentation",
@@ -28,6 +28,7 @@ dependencies = [
2828
"SQLAlchemy[asyncio,mypy]<3.0.0,>=2.0.0",
2929
"sqlalchemy-bind-manager",
3030
"structlog<25.1.1,>=25.1.0",
31+
"pydantic-asyncapi>=0.2.1",
3132
]
3233

3334
[dependency-groups]

src/http_app/routes/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from fastapi import FastAPI
22

3-
from http_app.routes import api, events, graphql, hello, ping, user_registered_hook
3+
from http_app.routes import api, events, graphql, hello, ping, user_registered_hook, asyncapi_docs
44

55

66
def init_routes(app: FastAPI) -> None:
77
app.include_router(api.router)
8+
app.include_router(asyncapi_docs.router)
89
app.include_router(ping.router)
910
app.include_router(hello.router)
1011
app.include_router(events.router)

src/http_app/routes/asyncapi_docs.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import pydantic_asyncapi as pa
2+
from fastapi import APIRouter
3+
4+
schema = pa.AsyncAPIV3(
5+
id="http://aa.aa.aa",
6+
info=pa.v3.Info(
7+
title="Bookstore API",
8+
version="1.0.0",
9+
description="test",
10+
),
11+
)
12+
13+
router = APIRouter(prefix="/asyncapi")
14+
15+
@router.get("/asyncapi.json", response_model_exclude_unset=True)
16+
def asyncapi_raw() -> pa.AsyncAPIV3:
17+
return schema
18+
19+
@router.get("/docs", response_model_exclude_unset=True)
20+
def asyncapi_docs() -> pa.AsyncAPIV3:
21+
return schema
22+

0 commit comments

Comments
 (0)