fatima

Built-in models

The validation models supported by Fatima.

Models are declared in fatima.json under model and keyed by environment variable name.

{
  "model": {
    "PORT": "integer",
    "DATABASE_URL": "url",
    "NODE_ENV": { "type": "string", "args": { "values": ["development", "production"] } }
  }
}

Models

ModelAccepted value
stringAny present string.
nonemptyA string with non-whitespace content.
emailA basic email-like value.
urlA value with http:// or https://.
uuidA five-part hexadecimal UUID.
numberA value parseable as a number.
integerA numeric value without a fractional part.
booleantrue, 1, yes, on, y, enabled, false, 0, no, off, n, or disabled.
jsonValid JSON text.
pemA value containing PEM begin and end markers.
skA value starting with sk- or sk_.
bearerA value starting with Bearer .

Allowed values

Use args.values to restrict a parsed value:

{
  "model": {
    "NODE_ENV": {
      "type": "string",
      "args": { "values": ["development", "staging", "production"] }
    }
  }
}

The allowed-value check runs after the model parses the value.