diff --git a/openedx_tagging/core/tagging/rest_api/v1/views.py b/openedx_tagging/core/tagging/rest_api/v1/views.py index dd73f433..97761286 100644 --- a/openedx_tagging/core/tagging/rest_api/v1/views.py +++ b/openedx_tagging/core/tagging/rest_api/v1/views.py @@ -799,6 +799,9 @@ def get_serializer_context(self): context['request'] = self.request serializer = self.serializer_class(self, context=context) + if getattr(self, 'swagger_fake_view', False): + # queryset just for schema generation metadata + return context # Instead of checking permissions for each TagData instance, we just check them once for the whole taxonomy # (since that's currently how our rules work). This might change if Tag-specific permissions are needed. taxonomy = self.get_taxonomy() @@ -814,6 +817,9 @@ def get_queryset(self) -> TagDataQuerySet: """ Builds and returns the queryset to be paginated. """ + if getattr(self, 'swagger_fake_view', False): + # queryset just for schema generation metadata + return Taxonomy.objects.none() # type: ignore[return-value] taxonomy = self.get_taxonomy() parent_tag_value = self.request.query_params.get("parent_tag", None) include_counts = "include_counts" in self.request.query_params