mirror of
https://github.com/bugsink/bugsink.git
synced 2025-12-19 19:49:44 -06:00
Add Swagger using drf-spectacular
See #146 DRF 3.16 and Django 5.2 are not in drf-spectacular's published list of supported but here's some sources that give reason to believe they are supported _in practice_: * https://github.com/tfranzel/drf-spectacular/issues/1417 * https://github.com/tfranzel/drf-spectacular/issues/1414
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from django.shortcuts import get_object_or_404
|
||||
from rest_framework import viewsets
|
||||
from drf_spectacular.utils import extend_schema, OpenApiParameter, OpenApiTypes
|
||||
|
||||
from bugsink.api_pagination import AscDescCursorPagination
|
||||
from bugsink.api_mixins import ExpandViewSetMixin, AtomicRequestMixin
|
||||
@@ -33,6 +34,20 @@ class ProjectViewSet(AtomicRequestMixin, ExpandViewSetMixin, viewsets.ModelViewS
|
||||
http_method_names = ["get", "post", "patch", "head", "options"]
|
||||
pagination_class = ProjectPagination
|
||||
|
||||
@extend_schema(
|
||||
parameters=[
|
||||
OpenApiParameter(
|
||||
name="team",
|
||||
type=OpenApiTypes.UUID,
|
||||
location=OpenApiParameter.QUERY,
|
||||
required=False,
|
||||
description="Optional filter by team UUID.",
|
||||
),
|
||||
]
|
||||
)
|
||||
def list(self, request, *args, **kwargs):
|
||||
return super().list(request, *args, **kwargs)
|
||||
|
||||
def filter_queryset(self, queryset):
|
||||
if self.action != "list":
|
||||
return queryset
|
||||
|
||||
Reference in New Issue
Block a user