Constraints restrict which values a field can hold. They are validated against the payload at runtime.
The enum keyword restricts a field to a fixed set of allowed values. Any payload value not in the list fails validation. Values can be strings, numbers, booleans, or null.
| Value | Status | Note |
|---|---|---|
"active" | valid | |
"inactive" | valid | |
"pending" | valid | |
"deleted" | invalid | not in the enum list |
null | invalid | null is not listed |
An enum array can hold values of different types.
| Value | Status | Note |
|---|---|---|
"active" | valid | |
"inactive" | valid | |
null | valid | |
42 | invalid | not in the list |
"pending" | invalid | not in the list |