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

Websocket/AsyncAPI Support #667

Open
johnthagen opened this issue Feb 27, 2022 · 5 comments
Open

Websocket/AsyncAPI Support #667

johnthagen opened this issue Feb 27, 2022 · 5 comments
Labels
low priority issues that would be nice to fix but have low impact

Comments

@johnthagen
Copy link
Contributor

drf-spectacular is excellent at generating OpenAPI schemas for REST APIs. Having something similar for use with websocket portions of DRF applications (via Django Channels) would be a big win for backends that also support web sockets.

AsyncAPI is the OpenAPI-equivalent solution for web sockets.

djangochannelsrestframework (DCRF) is a DRF-like interface for building APIs over websockets using Django Channels. It uses a very similar approach to DRF, so perhaps some of drf-spectactular's infrastructure could be reused.

Cross reference to feature request on DCRF repo:

@johnthagen
Copy link
Contributor Author

The canonical issue about OpenAPI itself and websockets:

@johnthagen
Copy link
Contributor Author

@tfranzel
Copy link
Owner

tfranzel commented Mar 8, 2022

As a channels user myself, this has been cumbersome for me too.I was not aware of DCRF, so thanks for that.

so perhaps some of drf-spectactular's infrastructure could be reused.

probably, however I presume that DCRF/AsyncAPI will break quite a few assumptions we made concerning the OpenAPI structure itself.

Not sure how much effort this is. I certainly find this interesting but lack the time to further look into it at the moment.

@tfranzel tfranzel added the low priority issues that would be nice to fix but have low impact label Mar 16, 2022
@ford-carta
Copy link

As a workaround, is there any way to add components to the schema manually without using a view?

@tfranzel
Copy link
Owner

@ford-carta not entirely sure what you intend to do, given that AsyncAPI is structured differently, but you are always free to write postprocessing hooks to mutate the schema at the end of parsing.

https://drf-spectacular.readthedocs.io/en/latest/customization.html#step-6-postprocessing-hooks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
low priority issues that would be nice to fix but have low impact
Projects
None yet
Development

No branches or pull requests

3 participants