Open johnthagen opened 2 years ago
The canonical issue about OpenAPI itself and websockets:
AsyncAPI can host a static Swagger UI-like browseable frontend:
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.
As a workaround, is there any way to add components to the schema manually without using a view?
@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
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 ofdrf-spectactular
's infrastructure could be reused.Cross reference to feature request on DCRF repo: