Literal
Ensure a value matches a specific literal.
Parameters
- literal:
any- The value that must be provided for the validation to succeed.
- options?:
table- required_error?:
string- Custom required message
- literal_error?:
string- Custom literal message
- required_error?:
local password = calid:literal("verystrongpassword", {
required_error = "Password is required",
literal_error = "Invalid password"
})Options
:default(value)– Specifies a fallback value when the input isnil. Useful for optional fields with defaults.:optional()– Allowsnilas a valid value without causing a validation error.