Add documentation of Bulk Search API#400
Add documentation of Bulk Search API#400AmitGupta7580 wants to merge 7 commits intoaboutcode-org:mainfrom
Conversation
There was a problem hiding this comment.
@AmitGupta7580 This is much much better. However could you not nest the response inside results ?
And you need to fix the DCO. Write decent commit messages, Update abcd is not very helpful.
@sbs2001 I have tried lots of things. But unable to remove that nesting. Actually some name has to be given here. class PackageBulkResponseSerializer(serializers.Serializer): Is there any problem with this representation ?
Actually I am just want to pass all these checks thats why I forget to name commits properly. This will not happen in future. |
Signed-off-by: AmitGupta7580 <[email protected]>
- Update debian importer's schema validation - Add tests for msr2019 importer. Signed-off-by: Shivam Sandbhor <[email protected]> Signed-off-by: AmitGupta7580 <[email protected]>
Signed-off-by: AmitGupta7580 <[email protected]>
Signed-off-by: AmitGupta7580 <[email protected]>
Signed-off-by: AmitGupta7580 <[email protected]>
5651468 to
79ee35a
Compare
|
This is still nesting the results. |
sbs2001
left a comment
There was a problem hiding this comment.
we don't want to nest the results
| response.append(purl_response) | ||
|
|
||
| return Response(response) | ||
| res = {"result": response} |
There was a problem hiding this comment.
This is still nesting the results.
As mentioned here https://drf-spectacular.readthedocs.io/en/latest/drf_spectacular.html#drf_spectacular.utils.extend_schema
to listing object we can use Serializer(many=True)
@extend_schema(request=PackageBulkRequestSerializer, responses=PackageSerializer(many=True))
When I am trying to return a list of Packages then it automatically convert it into paginator view.
Output :
And I also tried to remove pagination from setting.py file and add a custom paginator in other API's but then it adds unwanted parameters in bulk_api as it fetches directly from the Package Model.
Preview :
Still trying some other options..
|
@AmitGupta7580 gentle ping... do you think you can finish this? |
|
Hello @pombredanne, I have tried lots of things on this but unable to remove that nesting and also suggested some other possible alternatives to it. I think I will not be able to do this task in the current version of code. |
|
In the end this is more of an API structure change than a documentation issue..... this is still valid and need to be visited in light of what we want as API principles... See also #454 as DRF spectacular should be retired IMHO. So I am closing this now. See #511 for a follow up. @AmitGupta7580 Thank you ++ for all your efforts here even if this is not merged... this ends up being a very valuable conversation. |
|
@pombredanne i tried to explain to you that you are not forced to use a CDN if you are concerned about security (comment) . You are free to host any dist package of SwaggerUI on your side and then point to that with the @AmitGupta7580 the fix for your problem is pretty easy actually. the @extend_schema(request=PackageBulkRequestSerializer, responses=PackageBulkResponseSerializer)
@action(detail=False, methods=["post"], pagination_class=None)
def bulk_search(self, request): |
|
Thank You @tfranzel It workes for me. But I am facing a problem regarding Parameters, Can you guide me how can I remove the default parameters of a Serializer. |
|
@AmitGupta7580 the same mechanics apply also to @action(detail=False, methods=["post"], pagination_class=None, filter_backends=[])
... |
|
Thank you very much for your help @tfranzel. @pombredanne, @sbs2001 take a look on it. should I make a new PR? |







Response :
{ "result": [ { "url": "string", "unresolved_vulnerabilities": [ { "url": "string", "vulnerability_id": "string", "references": [ { "source": "string", "reference_id": "string", "url": "string", "scores": [ { "value": "string", "scoring_system": "cvssv2" } ] } ] } ], "resolved_vulnerabilities": [ { "url": "string", "vulnerability_id": "string", "references": [ { "source": "string", "reference_id": "string", "url": "string", "scores": [ { "value": "string", "scoring_system": "cvssv2" } ] } ] } ], "purl": "string", "type": "string", "namespace": "string", "name": "string", "version": "string", "subpath": "string", "qualifiers": {} } ] }POSTMAN