Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

joi custom validation read data for all fields

const schema = Joi.object({
  bar: Joi.string(),
  foo: Joi.string()
}).custom((obj, helpers) => {
  // you have access to the full object above.
  const { foo, bar } = obj;

  if (foo === "myfoo") {

  }
});
 
PREVIOUS NEXT
Tagged: #joi #custom #validation #read #data #fields
ADD COMMENT
Topic
Name
5+8 =