from drf_spectacular.openapi import AutoSchema class TaggedAutoSchema(AutoSchema): """ Groups swagger operations by a `schema_tags` list set on the view, instead of drf-spectacular's default (first URL path segment — which is "v1" for every endpoint here, since everything lives under /api/v1/). """ def get_tags(self): tags = getattr(self.view, 'schema_tags', None) if tags: return tags return super().get_tags()