MCPcopy Create free account
hub / github.com/aboutcode-org/vulnerablecode / CodeFixViewSet

Class CodeFixViewSet

vulnerabilities/api_v2.py:657–676  ·  view source on GitHub ↗

API endpoint that allows viewing CodeFix entries.

Source from the content-addressed store, hash-verified

655
656
657class CodeFixViewSet(viewsets.ReadOnlyModelViewSet):
658 """
659 API endpoint that allows viewing CodeFix entries.
660 """
661
662 queryset = CodeFix.objects.all()
663 serializer_class = CodeFixSerializer
664 throttle_classes = [AnonRateThrottle, PermissionBasedUserRateThrottle]
665
666 def get_queryset(self):
667 """
668 Optionally filter by vulnerability ID.
669 """
670 queryset = super().get_queryset()
671 vulnerability_id = self.request.query_params.get("vulnerability_id")
672 if vulnerability_id:
673 queryset = queryset.filter(
674 affected_package_vulnerability__vulnerability__vulnerability_id=vulnerability_id
675 )
676 return queryset
677
678
679class CodeFixV2ViewSet(viewsets.ReadOnlyModelViewSet):

Callers

nothing calls this directly

Calls 1

allMethod · 0.45

Tested by

no test coverage detected