Type validators generally don’t use transforms since they check data types rather than string content. See Validators Overview for transform documentation.
not_null!
Checks that a value exists and is not null/None.| Parameter | Type | Description |
|---|---|---|
| value | boolean | true to require non-null, false to require null |
Examples
Examples
type!
Checks that a value is of a specific type.| Parameter | Type | Description |
|---|---|---|
| value | string | Type name |
Supported Types
| Type | Matches |
|---|---|
string | Strings |
int | Integers |
float | Floating-point numbers |
number | Any numeric type |
bool | Boolean values |
array | Lists/arrays |
object | Dictionaries/objects |
null | None/null values |
Examples
Examples
not_type!
Checks that a value is NOT of a specific type. This is the negated form oftype!.
| Parameter | Type | Description |
|---|---|---|
| value | string | Type name that must NOT match |
Examples
Examples
json!
Checks that a string value is valid JSON.| Parameter | Type | Description |
|---|---|---|
| value | boolean | true to require valid JSON |
Examples
Examples
The
json! validator only checks that the string is valid JSON. It does not validate the JSON structure. Use contains! or pattern! for content checks.email!
Checks that a string value is a valid email format.| Parameter | Type | Description |
|---|---|---|
| value | boolean | true to require valid email format |
Examples
Examples