storage-service/storage_service/schemas/description_schema.py

10 lines
359 B
Python

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