I have the following field which should accept a YouTube Video ID, I am trying to prevent full URI from being used but cannot seem to find the appropriate use case in Joi Documentation.
youtubeVideoId: Joi.string()
.label('YouTube Video ID')
.allow(null)
.allow('')
.invalid('http', 'www'),
I thought the above would work however invalid looks at the string as a whole not contains.
I also tried using but this does not work.
youtubeVideoId: Joi.string()
.label('YouTube Video ID')
.allow(null)
.allow('')
.invalid(Joi.string().uri()),
Can anyone provide a Joi validation to prevent a URI from being accepted?