If I have two fields, I'd just like to validate when at least one field is a non empty string, but fail when both fields are empty strings.  Something like this does not validate  var schema = Joi.object().keys({     a: Joi.string(),     b: Joi.s...
This question already has an answer here:...
Simple joi validation snippet in javascript.It will simply return an error object when validation fails.  validate.js         const Joi =require("joi");  function validateObject (input) { const schema = {     key: Joi.string().required(),   }...
I have the following validation on one of my routes:  payload: {     keywordGroups: Joi.array().items(Joi.object().keys({         language: Joi.string().required(),         containsAny: Joi.array().items(Joi.string()).default([]).when('containsAl...
Is it possible to validate that a boolean is true using Joi? I've tried using allow, valid and invalid without any luck....
I have an API which has to validate OpenApi specifications. I get the payload in OpenApi format like below:  {     "swagger": "2.0",     "info": {         "description": "This is a sample server Petstore server. Yo...
I'm using Joi to validate a JavaScript object in the server. The schema is like the following:  var schema = Joi.object().keys({     displayName: Joi.string().required(),     email: Joi.string().email(),     enabled: Joi.boolean().default(false,...
I created a REST api and want to validate the body and the params before calling the controller logic. For the validation I use Joi (https://www.npmjs.com/package/joi).  Let's say I have a route with one url parameter and some body variables. The...
I am working on an api that should allow multiple params but for three of them I would like to allow only one of them. It easier with values for each key but I am wondering if Joi allows it too or I should add extra validation logic in my server.   I...
I am trying to achieve the following validation flow through joi https://www.npmjs.com/package/joi package.  1) Check the field category exists if not display the error category required.  2)Check the category field allows only alphabets if not displ...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.