diff --git a/invenio_communities/communities/schema.py b/invenio_communities/communities/schema.py index 1db36a74a..5240042cb 100644 --- a/invenio_communities/communities/schema.py +++ b/invenio_communities/communities/schema.py @@ -76,6 +76,13 @@ def is_not_uuid(value): pass +def is_not_reserved(value): + """Make sure value is not a reserved keyword.""" + return validate.NoneOf( + iterable=["new"], error=("The ID cannot be a reserved keyword.") + ) + + class CommunityAccessSchema(Schema): """Community Access Schema.""" @@ -233,6 +240,7 @@ class Meta: ), ), is_not_uuid, + is_not_reserved, ], ) metadata = NestedAttribute(CommunityMetadataSchema, required=True)