rumine-api-wrapper/db/schemas/TabSchema.py

19 lines
624 B
Python
Raw Permalink Normal View History

2024-03-07 14:06:53 +01:00
from pydantic import BaseModel, field_validator
class TabSchema(BaseModel):
property: str = "tagprefix"
value: str = "&b$ &f"
@field_validator("property")
def validate_property(cls, v):
valid_properties = {"tagprefix", "tagsuffix", "tabprefix", "tabsuffix", "abovename", "belowname"}
if v not in valid_properties:
raise ValueError(f"Invalid property: {v}")
return v
@field_validator("value")
def validate_value_length(cls, v):
if len(v) > 30:
raise ValueError("Value length must be less than or equal to 30 characters")
return v