fastapi-asyncapi icon indicating copy to clipboard operation
fastapi-asyncapi copied to clipboard

Create a custom `WebSocketRoute`

Open Kludex opened this issue 2 years ago • 3 comments

Unfortunately, the APIWebSocketRoute decorator from FastAPI doesn't give us much information. We need information to enrich our asyncapi.json.

Hence, the proposal here is to create a custom WebSocketRoute class that allows some extra fields that can be used by AsyncAPI.

Kludex avatar May 26 '22 14:05 Kludex

I can help.

Show me what's not missing in class WebSockerRoute

DjaPy avatar May 27 '22 19:05 DjaPy

We need to populate the asyncapi.json... I'm not sure which fields we want, but we'll use them to populate it.

Kludex avatar May 27 '22 19:05 Kludex

FastAPI doesn't support custom WebSocketRoute classes... We need to create a custom APIRouter as well.

Kludex avatar May 27 '22 21:05 Kludex