You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
since DRF does not support async views, we are writing some async views using native Django views: from django.views import View. However it seems like these views does not get recognized by drf-spectacular when generating the schema, even when using the @extend_schema on them. This gets me to the question - is it even possible to generate an OpenAPI schema for the native django views, or does it support only DRF views? Is there any workaround I could use?
Thanks!
The text was updated successfully, but these errors were encountered:
microHoffman
changed the title
Is it possible to use this with native django views?
Is it possible to use drf-spectacular for generating OpenAPI schema for native django (non-DRF) views?
Feb 6, 2023
Hi, yeah that does not work. All the concepts that spectacular relies on do come from DRF. There is no workaround currently and there will most likely never be one.
Django has no concept of renderer, parser, permission,authentication, serializer or viewset classes. All of our parsing is based on that. Even if we would allow @extend_schema on plain django views, there would still be a lot of necessary information missing. And to make it even worse, all of our mechanics are based on subclassing AutoSchema, which is solely a DRF feature.
tl;dr: DRF and drf-spectacular are so interwoven that drf-spectacular would simply make very little to no sense without DRF.
Hello,
since DRF does not support async views, we are writing some async views using native Django views:
from django.views import View
. However it seems like these views does not get recognized bydrf-spectacular
when generating the schema, even when using the@extend_schema
on them. This gets me to the question - is it even possible to generate an OpenAPI schema for the native django views, or does it support only DRF views? Is there any workaround I could use?Thanks!
The text was updated successfully, but these errors were encountered: