Validate

Validate payload example

Validate payload Examples

  • a single mandatory field
validate {
    mobile
}
  • a mandatory field with regex validator
validate {
     mobile { regex ~/[0-9]{5}/ }
}
  • a mandatory field matching Date with default ISO pattern 'yyyy-MM-dd'
validate {
     birthDate { date() }
}
  • a mandatory field matching Date with custom pattern
validate {
     expirationDate { date('yyyy/MM/dd') }
}
  • a mandatory field with value validator
validate {
     product { oneOf "product1", "product2", "product3"}
}
  • mandatory nested fields
validate {
    firstname
    lastname
    address {
        street
        city
        state
        zip
    }
}