Skip to content

Possible to generate AsyncAPI docs when running FastStream manually, as a regular async function? #1823

Answered by strock-dev
strock-dev asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks so much for your input! I didn't test your solution as I came up with a somewhat 'hacky' workaround for my problem. I imported get_app_schema and called to_yaml() on that schema. After that I just wrote that yaml into a file.

from faststream.asyncapi import get_app_schema

schema_yaml = get_app_schema(app).to_yaml()

file = Path("output.yaml)
with file.open("w", encoding="utf-8") as f:
    f.write(schema_yaml)

Serving that yaml via FastStream worked for me. Another option is of course to use the AsyncAPI CLI to generate HTML from that file.

I'm unsure if I should mark your answer as correct, as I didn't test it by myself.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@strock-dev
Comment options

Answer selected by strock-dev
@Lancetnik
Comment options

@strock-dev
Comment options

@Lancetnik
Comment options

@strock-dev
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants