Get the ASGI routes for an application.
Source code in faststream/specification/asyncapi/v2_6_0/generate.py
| def get_asgi_routes(
http_handlers: list[tuple[str, "HttpHandler"]],
) -> dict[str, Channel]:
"""Get the ASGI routes for an application."""
channels: dict[str, Channel] = {}
for path, asgi_app in http_handlers:
if asgi_app.include_in_schema:
channel = Channel(
description=asgi_app.description,
subscribe=Operation(
tags=asgi_app.tags,
operationId=asgi_app.unique_id,
bindings=OperationBinding(
http=http_bindings.OperationBinding(
method=", ".join(asgi_app.methods),
),
),
message=None,
),
)
channels[path] = channel
return channels
|