Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate AsyncAPI Schema #116

Open
johnthagen opened this issue Feb 26, 2022 · 3 comments
Open

Generate AsyncAPI Schema #116

johnthagen opened this issue Feb 26, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@johnthagen
Copy link
Contributor

johnthagen commented Feb 26, 2022

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.

@hishnash
Copy link
Member

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.

@johnthagen
Copy link
Contributor Author

johnthagen commented Feb 28, 2022

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.

@hishnash hishnash added the enhancement New feature or request label Jul 10, 2022
@johnthagen
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants