NilCoalescing / djangochannelsrestframework

A Rest-framework for websockets using Django channels-v4

Home Page:https://djangochannelsrestframework.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generate AsyncAPI Schema

johnthagen opened this issue · comments

Is your feature request related to a problem? Please describe.
Automatically providing a schema for an API makes it much easier for others to programmatically access it. drf-spectacular does this very well for DRF and OpenAPI 3. Doing this for websockets using AsyncAPI would allow this concept to move into the websocket portions of DRF applications.

Describe the solution you'd like
Like drf-spectacular, traverse the websocket URL endpoints and associated Serializers to dynamically build up an AsyncAPI schema for a DCRF application.

With this schema, users can then use the provided AsyncAPI generators to generate client code automatically that maps to the endpoints and types used in the websocket API.

I was not aware of https://www.asyncapi.com thank you for brining this to my attention. I agree this would be a very useful feature to be able to generate AsyncAPI endpoint I think hand in hand with this would be having a debug ui (like the one DRF provides) so you can navigate and play with the API directly from your browser and discover move about AsycnAPI.

I think hand in hand with this would be having a debug ui (like the one DRF provides) so you can navigate and play with the API directly from your browser and discover move about AsycnAPI.

It looks like the AsyncAPI folks provide a Swagger UI-like web component for this:

So if the generated AsyncAPI schema is hosted, it should be possible to bundle their web component and point it at the schema. drf-spectacular does this by generating an OpenAPI schema dynamically, and then also hosting the static Swagger UI pages and pointing them at the generated schema. drf-spectacular-sidecar is the page bundle Swagger UI for offline hosting.

It looks like the AsyncAPI project also has a generator that can be used to generate documentation and clients from the schema.