How to use the compile function from joi
Find comprehensive JavaScript joi.compile code examples handpicked from public code repositorys.
74 75 76 77 78 79 80 81 82 83
// use casted values ctx.set(result.value); } if (this.spec.body) { result = Joi.compile(this.spec.body).validate(ctx.body); if (result.error) return result.error; // use casted values ctx.body = result.value; }
96
451
49
+ 15 other calls in file
85 86 87 88 89 90 91 92 93
if (params == null || typeof params !== 'object') { return null; } var description = Joi.compile(params).describe(); return internals.getParamsData(description); };
2
11
4
GitHub: gmsewell6/drivers
51 52 53 54 55 56 57 58 59 60
if (arguments.length === 3 && !_.isPlainObject(options)) { missing = options; options = undefined; } joiSchema = joi.compile(joiSchema || {}); if (!(joiSchema.describe().children.hasOwnProperty('id'))) { joiSchema = joiSchema.concat(joi.object().keys({ id: joi.string().required() })); } // generate overlay template for funcs that are defaulted or required based on joiSchema
2
0
2
GitHub: kunalelsner/webproject
174 175 176 177 178 179 180 181 182 183
//assert // console.log(Joi.assert('1', Joi.number())); //compile // const definition = ['key', 5, { a: true, b: [/^a/, 'boom'] }]; // const compileschema = Joi.compile(definition); // console.log('dschema',compileschema); //default(modifier) // const custom = Joi.defaults((dschema) => {
0
0
0
GitHub: hapijs/joi
186 187 188 189 190 191 192 193 194 195
the schema is always compiled using the current version and if older schema components are found, an error is thrown. ```js const definition = ['key', 5, { a: true, b: [/^a/, 'boom'] }]; const schema = Joi.compile(definition); // Same as: const schema = Joi.alternatives().try(
0
0
176
+ 3 other calls in file
GitHub: totherik/joi
228 229 230 231 232 233 234 235 236 237
Converts literal schema definition to **joi** schema object (or returns the same back if already a **joi** schema object) where: - `schema` - the schema definition to compile. ```javascript var definition = ['key', 5, { a: true, b: [/^a/, 'boom'] }]; var schema = Joi.compile(definition); // Same as: var schema = Joi.alternatives().try([
0
0
2
joi.string is the most popular function in joi (40578 examples)