File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,23 +136,22 @@ class ProjectViewSet(
136136 mixins .ListModelMixin ,
137137 viewsets .GenericViewSet ,
138138):
139- @action (detail = True , methods = ["get" ])
139+ from rest_framework .response import Response
140+ from rest_framework import status
141+
142+ @action (detail = True , methods = ["get" ])
140143def sbom (self , request , * args , ** kwargs ):
141- """
142- Return SBOM for a given PURL.
143- """
144144 project = self .get_object ()
145145 purl = request .query_params .get ("purl" )
146146
147147 if not purl :
148- return ErrorResponse ( " purl is required" )
148+ return Response ({ "error" : " purl is required"}, status = status . HTTP_400_BAD_REQUEST )
149149
150- # TODO: integrate actual SBOM generation logic
151150 return Response ({
152151 "project" : project .name ,
153152 "purl" : purl ,
154153 "sbom" : "CycloneDX SBOM will be generated here"
155- }, status = 200 )
154+ })
156155 """
157156 A viewset that provides the ability to list, get, create, and destroy projects.
158157 Multiple actions are available to manage project instances.
You can’t perform that action at this time.
0 commit comments