Skip to content

Latest commit

 

History

History
66 lines (44 loc) · 1.13 KB

API.md

File metadata and controls

66 lines (44 loc) · 1.13 KB

Joi Extensions

any

any.sizeof(limit)

Requires the size to be less than or equal to limit.

const schema = Joi.any().sizeof(20)

string

string.objectId()

Requires the string to be valid ObjectId.

const schema = Joi.string().objectId()

string.colorHexCode()

Requires the string to be valid color hex code.

const schema = Joi.string().colorHexCode()

string.colorHexCode()

Requires the string to contain only ASCII characters.

const schema = Joi.string().ASCII()

array

array.even()

Requires the array length to be even.

const schema = Joi.array().even()

array.odd()

Requires the array length to be odd.

const schema = Joi.array().odd()