Skip to content

OpenAPI is not enough for you? 😡 Let's try AsyncAPI! 👼

License

Notifications You must be signed in to change notification settings

TaPO4eg3D/fastapi-asyncapi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI-AsyncAPI

Latest Commit
Package version

FastAPI-AsyncAPI is a utility tool to write documentation for your FastAPI endpoints using AsyncAPI.

It provides support for WebSockets, which is currently missing in OpenAPI.

This package is not completed. Help is wanted.

Installation

pip install fastapi-asyncapi

Usage

from fastapi import FastAPI
from pydantic import AnyHttpUrl

from fastapi_asyncapi import get_asyncapi, get_asyncapi_html

app = FastAPI(title="MyAPI", version="1.0.0", docs_url=None)


@app.get("/asyncapi.json")
async def asyncapi_json():
    return get_asyncapi(title=app.title, version=app.version, routes=app.routes)


@app.get("/docs")
async def asyncapi_docs():
    asyncapi_url = AnyHttpUrl("asyncapi.json", scheme="http")
    return get_asyncapi_html(asyncapi_url=asyncapi_url, title=app.title)

License

This project is licensed under the terms of the MIT license.

About

OpenAPI is not enough for you? 😡 Let's try AsyncAPI! 👼

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%