MCPcopy Create free account
hub / github.com/tortoise/tortoise-orm / MinLengthValidator

Class MinLengthValidator

tortoise/validators.py:51–63  ·  view source on GitHub ↗

A validator to validate the length of given value whether less than min_length or not.

Source from the content-addressed store, hash-verified

49
50
51class MinLengthValidator(Validator):
52 """
53 A validator to validate the length of given value whether less than min_length or not.
54 """
55
56 def __init__(self, min_length: int) -> None:
57 self.min_length = min_length
58
59 def __call__(self, value: str) -> None:
60 if value is None:
61 raise ValidationError("Value must not be None")
62 if len(value) < self.min_length:
63 raise ValidationError(f"Length of '{value}' {len(value)} < {self.min_length}")
64
65
66class NumericValidator(Validator):

Callers 1

ValidatorModelClass · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…