19 lines
624 B
Python
19 lines
624 B
Python
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 |