Skip to content

Commit a024724

Browse files
authored
disable swagger docs for CustomObjectViewSet (#200)
1 parent 0bb6043 commit a024724

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

netbox_custom_objects/api/views.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.http import Http404
2+
from drf_spectacular.utils import extend_schema_view, extend_schema
23
from rest_framework.routers import APIRootView
34
from rest_framework.viewsets import ModelViewSet
45

@@ -17,6 +18,18 @@ class CustomObjectTypeViewSet(ModelViewSet):
1718
serializer_class = serializers.CustomObjectTypeSerializer
1819

1920

21+
# TODO: Need to remove this for now, check if work-around in the future.
22+
# There is a catch-22 spectacular get the queryset and serializer class without
23+
# params at startup. The suggested workaround is to return the model empty
24+
# queryset, but we can't get the model without params at startup.
25+
@extend_schema_view(
26+
list=extend_schema(exclude=True),
27+
retrieve=extend_schema(exclude=True),
28+
create=extend_schema(exclude=True),
29+
update=extend_schema(exclude=True),
30+
partial_update=extend_schema(exclude=True),
31+
destroy=extend_schema(exclude=True)
32+
)
2033
class CustomObjectViewSet(ModelViewSet):
2134
serializer_class = serializers.CustomObjectSerializer
2235
model = None

0 commit comments

Comments
 (0)