Skip to content

get_asgi_routes

faststream.asyncapi.generate.get_asgi_routes #

get_asgi_routes(app)

Get the ASGI routes for an application.

Source code in faststream/asyncapi/generate.py
def get_asgi_routes(
    app: "AsyncAPIApplication",
) -> Any:
    """Get the ASGI routes for an application."""
    # We should import this here due
    # ASGI > Application > asynciapi.proto
    # so it looks like a circular import
    from faststream.asgi import AsgiFastStream
    from faststream.asgi.handlers import HttpHandler

    if not isinstance(app, AsgiFastStream):
        return None

    for route in app.routes:
        path, asgi_app = route

        if isinstance(asgi_app, HttpHandler) and asgi_app.include_in_schema:
            # TODO: generate HTTP channel for handler
            pass

    return