Commit 5d1ea11d authored by davelopez's avatar davelopez
Browse files

Add validation regex to tags

parent f899e000
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@ from pydantic import (
    AnyHttpUrl,
    AnyUrl,
    BaseModel,
    constr,
    ConstrainedStr,
    Extra,
    Field,
    FilePath,
@@ -241,9 +243,12 @@ class HistoryContentSource(str, Enum):
    new_collection = "new_collection"


TagItem: ConstrainedStr = constr(regex=r"^([^\s.:])+(.[^\s.:]+)*(:[^\s.:]+)?$")


class TagCollection(Model):
    """Represents the collection of tags associated with an item."""
    __root__: List[str] = Field(
    __root__: List[TagItem] = Field(
        default=...,
        title="Tags",
        description="The collection of tags associated with an item.",