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 want to validate my Express routes before calling the controller logic. I use joi and created a validator which is able to validate the Request object against the schema object  import { Request, Response, NextFunction } from 'express'; imp...
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'm looking for a way to validate that an array contains a required value using joi. Found these issues online - #1, #2, but none of them has a definitive answer. I tried several stuff but they doesn't seem to work, like: joi.array().items(jo...
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 am trying to validate optional parameters from a querystring that are depending on each other. In other words, when parameter A is added, parameter B is also needed. Both parameters are optional, so when neither of them are provided validation shou...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.