I have to validate value by value instead of passing in a whole schema for multiple values. Based on the docs for single value validation from here
and this sample code
const validator: AnySchema = Joi.string().valid('foo', 'bar').required();
const validationResult: ValidationResult = validator.validate('invalid');
const validationError: ValidationError = validationResult.error;
if (validationError) {
throw validationError;
}
The code will throw an error with the following error message
ValidationError: "value" must be one of [foo, bar]
Is there an easy way I can replace "value" with a specific name? So when I want to validate environment the error message could be
ValidationError: "environment" must be one of [development, production, test]
or is that only possible when validating multiple values at once?