ViewSet: class MyModelView(ModelViewSet): queryset = MyModel.objects.all() serializer_class = MyModelSerializer filterset_class = MyModelFilter
@action(detail=False) def count(self): queryset = self.filter_queryset(self.get_queryset()) return Response({'count': queryset.count()}) Generated schema: Generpaths: /mymodel/: get: operationId: mymodel_list parameters: - in: query name: int_filter schema: description: '' title: '' type: number - in: query name: str_filter schema: description: '' title: '' type: string tags: - mymodel /mymodel/count/: get: operationId: mymodel_count tags: - mymodel /mymodel/{id}/: get: operationId: mymodel_read parameters: - in: path name: id required: true schema: description: A unique integer value identifying this mymodel. title: ID type: integer - in: query name: int_filter schema: description: '' title: '' type: number - in: query name: str_filter schema: description: '' title: '' type: string tags: - mymodel What's wrong with count? Filtering works as expected but schema is not generated. -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.