Skip to content

Commit c9bfe94

Browse files
committed
chore: explain double validation
1 parent 9a55118 commit c9bfe94

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/openedx_tagging/rest_api/v1/serializers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,10 @@ class ObjectTagUpdateBodySerializer(serializers.Serializer): # pylint: disable=
220220

221221
def validate_tag_value(value, context, original_value=None):
222222
"""
223-
Validate this tag value is unique within the current taxonomy context and
224-
does not contain forbidden characters.
223+
Validates the incoming request early:
224+
- This tag is unique, not a duplicate. (The model does not validate this sufficiently.)
225+
- There are no forbidden / reserved characters present. There is an additional model-side validation for this as well,
226+
but we are keeping this so we can validate the incoming request immediately.
225227
"""
226228
taxonomy_id = context.get("taxonomy_id")
227229
original_tag = Tag.objects.filter(taxonomy_id=taxonomy_id, value=original_value).first() if original_value else None

0 commit comments

Comments
 (0)