diff --git a/storage_service/schemas/__init__.py b/storage_service/schemas/__init__.py index e5a0d9b..c331d44 100644 --- a/storage_service/schemas/__init__.py +++ b/storage_service/schemas/__init__.py @@ -1 +1,2 @@ #!/usr/bin/env python3 +from .description_schema import DescriptionSchema diff --git a/storage_service/schemas/description_schema.py b/storage_service/schemas/description_schema.py new file mode 100644 index 0000000..8e2a580 --- /dev/null +++ b/storage_service/schemas/description_schema.py @@ -0,0 +1,9 @@ +from marshmallow import Schema, fields, RAISE +from marshmallow.validate import Regexp, Length + + +class DescriptionSchema(Schema): + tag = fields.Str(required=True, validate=[Regexp("^[a-zA-Z]+[0-9a-zA-Z_]*$"), Length(min=2, max=32)]) + + class Meta: + unknown = RAISE # Later this could be changed to EXCLUDE to maintain compatibility among versions