validators.uuid
UUID.
@validator
def
uuid(value: Union[str, uuid.UUID], /):
Return whether or not given value is a valid UUID-v4 string.
This validator is based on WTForms UUID validator.
Examples:
>>> uuid('2bc1c94f-0deb-43e9-92a1-4775189ec9f8') True >>> uuid('2bc1c94f 0deb-43e9-92a1-4775189ec9f8') ValidationError(func=uuid, args={'value': '2bc1c94f 0deb-43e9-92a1-4775189ec9f8'})
Arguments:
- value: UUID string or object to validate.
Returns:
(Literal[True]): If
valueis a valid UUID. (ValidationError): Ifvalueis an invalid UUID.