UNPKG

api-schema-builder

Version:

build schema with validators for each endpoint

16 lines (13 loc) 404 B
module.exports = { allowedValuesError }; function allowedValuesError(discriminator, allowedValues) { const error = new Error('should be equal to one of the allowed values'); error.dataPath = '.' + discriminator; error.keyword = 'enum'; error.params = { allowedValues: allowedValues }; error.schemaPath = '#/properties/' + discriminator; this.errors = [error]; }