How to use the any function from joi
Find comprehensive JavaScript joi.any code examples handpicked from public code repositorys.
75 76 77 78 79 80 81 82 83 84 85
// post bus event return newAttachments } createAttachment.schema = { currentUser: Joi.any(), challengeId: Joi.id(), attachments: Joi.array().items(Joi.object().keys({ name: Joi.string().required(), url: Joi.string().uri().required(),
44
17
25
+ 5 other calls in file
2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227
}).unknown(true)).min(1), terms: Joi.array().items(Joi.object().keys({ id: Joi.id(), roleId: Joi.id() }).unknown(true)).optional().allow([]), overview: Joi.any().forbidden() }).unknown(true).required() } /**
44
17
25
+ 9 other calls in file
2105 2106 2107 2108 2109 2110 2111 2112 2113 2114
Joi.object().keys({ id: Joi.id(), roleId: Joi.id(), }) ), overview: Joi.any().forbidden(), }) .unknown(true) .required(), };
44
17
25
+ 31 other calls in file
72 73 74 75 76 77 78 79 80 81
city: Joi.string().trim(), country: Joi.string().trim().allow(""), cityCode: Joi.string().trim().allow(""), region: Joi.string().trim().allow(""), department: Joi.string().trim().allow(""), location: Joi.any(), addressVerified: Joi.boolean(), foreignAddress: Joi.string().trim().allow(""), foreignZip: Joi.string().trim().allow(""), foreignCity: Joi.string().trim().allow(""),
4
8
4
+ 4 other calls in file
GitHub: adobe/aio-tvm
157 158 159 160 161 162 163 164 165 166
* @private */ _validateRequestParams (params) { return joi.object().label('params').keys(this._validationSchema) .required() .pattern(/^$/, joi.any()).pattern(/^__ow_.+$/, joi.any()) // this means allow all unknown parameters that start with __ow_ and '' .validate(params) } /**
11
10
22
GitHub: laino/final-pm
47 48 49 50 51 52 53 54 55
Joi.number().integer() ], send: [ Joi.number().integer(), Joi.any() ], info: [],
1
21
6
71 72 73 74 75 76 77 78 79 80
const filepondFileParam = Joi.object({ id: Joi.string().length(24).optional() }).label('filepondFileParam'); const filepondFilePayload = Joi.object({ filepond: Joi.any().meta({ swaggerType: 'file' }).allow('').optional() }).label('filepondFilePayload'); exports.plugin = { name: 'routes-default',
0
7
4
+ 3 other calls in file
GitHub: arangodb/arangodb
273 274 275 276 277 278 279 280 281 282
res.json(user.extra.queries); }) .pathParam('user', joi.string().required(), 'Username. Ignored if authentication is enabled.') .body(joi.array().items(joi.object({ name: joi.string().required(), parameter: joi.any().optional(), value: joi.any().optional() }).required()).required(), 'User query array to import.') .error('not found', 'User does not exist.') .summary('Upload user queries')
811
0
0
+ 5 other calls in file
31 32 33 34 35 36 37 38 39 40
regex: "pattern", }; function translateWhen(when, validation) { if (validation === void 0) { validation = null; } if (!validation) validation = Joi.any(); var ref = null; if ("reference" in when) { ref = Utils_1.jsonToRef(when.reference); delete when.reference;
3
12
0
+ 3 other calls in file
40 41 42 43 44 45 46 47 48 49 50 51
return value } return value }), results: Joi.any() }); function createModel (currentlyIrrigating, errorList, currentData, plannedData, hasScore) { return {
2
3
0
GitHub: arangodb/arangodb
86 87 88 89 90 91 92 93 94 95
joi.object().optional() .pattern(RE_EMPTY, joi.forbidden()) .pattern(RE_NOT_EMPTY, ( joi.object().required() .keys({ default: joi.any().optional(), type: ( joi.only(Object.keys(configTypes)) .default('string') ),
816
0
338
GitHub: sauramirez/getenv2
68 69 70 71 72 73 74 75 76 77
joiValidation = joiValidation.default(NO_DEFAULT); } } } else { joiValidation = Joi.any().default(NO_DEFAULT); } return getValue(envName, joiValidation, defaults); };
1
0
2
+ 3 other calls in file
99 100 101 102 103 104 105 106 107 108
const questionValSchema = Joi.object().keys({ options: Joi.array().items( Joi.object({ optionLabel: Joi.required(), isTrue: Joi.boolean().required(), placeholder: Joi.any(), lastSelectNumber: Joi.number(), isSelected: Joi.boolean(), }) ),
0
0
1
+ 2 other calls in file
GitHub: flyingluscas/joi
384 385 386 387 388 389 390 391 392 393
Marks a key as forbidden which will not allow any value except `undefined`. Used to explicitly forbid keys. ```js const schema = { a: Joi.any().forbidden() }; ``` #### `any.strip()`
0
0
0
+ 35 other calls in file
GitHub: trinketapp/hapi
139 140 141 142 143 144 145 146 147
Joi.string().required(), Joi.array().includes(Joi.string()).min(1).required() ], path: Joi.string().required(), vhost: [Joi.string(), Joi.array()], handler: Joi.any(), // Validated in route.config config: Joi.object().allow(null) };
0
0
4
194 195 196 197 198 199 200 201 202 203 204 205 206
} return result; }; const joiValidateResponse = (response, joiValidator = Joi.any()) => { if (developmentMode) { const { error } = joiValidator.validate(response); if (error) {
0
0
1
+ 2 other calls in file
22 23 24 25 26 27 28 29 30 31
return result; }; Object.defineProperty(exports, "__esModule", { value: true }); const Joi = __importStar(require("joi")); const AnswerSchema = Joi.object().keys({ answer: Joi.any().required(), isCorrect: Joi.boolean().required() }); const QuestionSchema = Joi.object().keys({ question: Joi.string().required(),
0
0
1
GitHub: cube-js/cube
306 307 308 309 310 311 312 313 314 315 316
); const RollupLambdaSchema = condition( (s) => defined(s.granularity) || defined(s.timeDimension), { type: Joi.any().valid('rollupLambda').required(), granularity: GranularitySchema, timeDimension: Joi.func().required(), rollups: Joi.func().required(), measures: Joi.func(),
0
0
149
+ 139 other calls in file
GitHub: zubairss/node-y4nxca
102 103 104 105 106 107 108 109 110 111
'InputMessage.data.Quote.Risk.vehicles.usage.estimatedAnnualDistance', ), principalOperatorIndex: Joi.number().label( 'InputMessage.data.Quote.Risk.vehicles.usage.principalOperatorIndex', ), principalOperatorName: Joi.any().label( 'InputMessage.data.Quote.Risk.vehicles.usage.principalOperatorName', ), occasionalOperatorIndex: Joi.number().label( 'InputMessage.data.Quote.Risk.vehicles.usage.occasionalOperatorIndex',
0
0
0
+ 3 other calls in file
GitHub: kunalelsner/webproject
76 77 78 79 80 81 82 83 84 85
//I want to validate object using Joi which inovle use of Joi.ref() with multiplication operation. k: Joi.number().integer(), p: Joi.number().integer().min(1).max(Joi.ref('k', { adjust: (value) => value * 2 })).error(new Error('positive number dal mere bhai')), c: Joi.any().allow('a'), d: Joi.any().allow('b', 'B'), //alter any key: Joi.string()
0
0
0
+ 15 other calls in file
joi.string is the most popular function in joi (40578 examples)