Open johnthagen opened 2 years ago
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.
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 associatedSerializer
s 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.