Field Rules

  • Field rules are ignored if the value is undefined, null, or an empty string (except required and type)
  • type is only ignored if the value is undefined
  • required is never ignored
Rule Rule argument
enum array of strings (for the ‘string’ type only)
isAfter see validator.isAfter
isBefore see validator.isBefore
isCreditCard see validator.isCreditCard
isEmail see validator.isEmail
isHexColor see validator.isHexColor
isIn see validator.isIn
isIP see validator.isIP
isNotIn see validator.isIn
isURL see validator.isURL
isUUID see validator.isUUID
min number
max number
minLength number
maxLength number
regex see validator.matches
required boolean
type string - ‘string’, ‘boolean’, ‘number’, ‘integer’, ‘date’, ‘id’, ‘any’, ‘image

See validator for their validator logic

Dates are unix timestamps in seconds, you change this to milliseconds via the manager configurations. We hope to support other string based timestamp variations soon..

Image type

type: 'image' will be converted to type: 'any' upon initialisation without any image plugins. This type allows plugins to hook into field type. See the corresponding plugins for more details or monastery’s default image plugin.