The string type corresponds to the Joi.string() schema.
{
name: 'string:min=1,max=100,required'
card: 'string:creditCard',
computer: 'string:hostname'
}{
name: {
'@type': 'string',
min: 1,
max: 100,
required: true
},
card: {
'@type': 'string',
creditCard: true
},
computer: {
'@type': 'string',
hostname: true
}
}Most operations for string processing are available including:
minmaxrequiredinsensitivecreditCardregexalphanumhexhostnamelowercaseuppercasetoken
Strings are automatically trimmed. To disable this functionality, add the trim=false property to your schema as in the following example:
{
name: 'string: min=1, max=100, trim=false, required'
}For more information on this type, see the Joi documentation.