Describe the bug
Using @extend_schema on an view class with an operation_id results in an error being displayed on almost every manage.py command, yet the deploy check does not show any error, neither does a request on a SchemaView. This makes the issue undetectable in a CI job.
To Reproduce
Create an APIView class that uses @extend_schema with an operation_id, and make sure that it is imported somewhere that gets loaded early on, such as a urls.py:
# views.py
@extend_schema(operation_id='OhSnap')
class InfuriatingAPIView(RetrieveAPIView):
...
# urls.py
from leproject.leapp import views
You can then run manage.py check --deploy:
λ ./manage.py check --deploy
Error #0: using @extend_schema on viewset class InfuriatingAPIView with parameters operation_id or operation will most likely result in a broken schema.
System check identified no issues (0 silenced).
Some inspection using a traceback.print_stack() in GeneratorStats.emit shows that the error occurs while Django runs other system checks related to the ROOT_URLCONF; the views are imported too early for the check to work. Maybe the views need to be somehow reimported?
Expected behavior
The deploy check should show an actual warning:
λ ./manage.py check --deploy
System check identified some issues:
WARNINGS:
?: (drf_spectacular.W002) using @extend_schema on viewset class InfuriatingAPIView with parameters operation_id or operation will most likely result in a broken schema.
System check identified 1 issue (0 silenced).
Describe the bug
Using
@extend_schemaon an view class with anoperation_idresults in an error being displayed on almost everymanage.pycommand, yet the deploy check does not show any error, neither does a request on a SchemaView. This makes the issue undetectable in a CI job.To Reproduce
Create an APIView class that uses
@extend_schemawith anoperation_id, and make sure that it is imported somewhere that gets loaded early on, such as aurls.py:You can then run
manage.py check --deploy:Some inspection using a
traceback.print_stack()inGeneratorStats.emitshows that the error occurs while Django runs other system checks related to theROOT_URLCONF; the views are imported too early for the check to work. Maybe the views need to be somehow reimported?Expected behavior
The deploy check should show an actual warning: