Skip to content

Feature: AsyncAPI HTTP support #2091

Closed
@Lancetnik

Description

@Lancetnik

Using AsgiFastStream object we can register some HTTP routes our application serve.
We should draw such routes in AsyncAPI specification as well. This feature should be togglable for sure in the basic include_in_schema=True/False way, but I am not sure about default value

@get(include_in_schema=False)
async def liveness_ping(scope):
    return AsgiResponse(b"", status_code=200)

app = FastStream(broker).as_asgi(
    asgi_routes=[
        ("/liveness", liveness_ping),
        ("/readiness", make_ping_asgi(broker, timeout=5.0, include_in_schema=False)),
    ],
)

AsyncAPI HTTP bindings - https://github.com/asyncapi/bindings/blob/master/http/README.md

UPD: codebase is ready to generate AsyncAPI (https://github.com/ag2ai/faststream/blob/main/faststream/asyncapi/generate.py#L32), but we should invesigate, how it should be looks like in schema

References:
AsyncAPI HTTP bindings – asyncapi/bindings@master/http
Example of FastAPI + AsyncAPI usage – Kludex/fastapi-asyncapi
AsyncAPI Studio to validate schema – studio.asyncapi.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions