Schemas
Literal

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
local password = calid:literal("verystrongpassword", {
    required_error = "Password is required",
    literal_error = "Invalid password"
})

Options

  • :default(value) – Specifies a fallback value when the input is nil. Useful for optional fields with defaults.
  • :optional() – Allows nil as a valid value without causing a validation error.