Skip to content

Commit

Permalink
Make tags optional for import and reimport API endpoints (#9819)
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixHernandez authored Mar 25, 2024
1 parent 44b4941 commit 5d89271
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dojo/api_v2/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ def __init__(self, **kwargs):
self.pretty_print = pretty_print

def to_internal_value(self, data):
if isinstance(data, list) and data == [''] and self.allow_empty:
return []
if isinstance(data, six.string_types):
if not data:
data = []
Expand Down Expand Up @@ -2106,7 +2108,7 @@ class ImportScanSerializer(serializers.Serializer):
allow_null=True, default=None, queryset=User.objects.all()
)
tags = TagListSerializerField(
required=False, help_text="Add tags that help describe this scan."
required=False, allow_empty=True, help_text="Add tags that help describe this scan."
)
close_old_findings = serializers.BooleanField(
required=False,
Expand Down Expand Up @@ -2434,6 +2436,7 @@ class ReImportScanSerializer(TaggitSerializer, serializers.Serializer):
)
tags = TagListSerializerField(
required=False,
allow_empty=True,
help_text="Modify existing tags that help describe this scan. (Existing test tags will be overwritten)",
)

Expand Down

0 comments on commit 5d89271

Please sign in to comment.