Closed JeromeDeLeon closed 4 years ago
Hey @JeromeDeLeon, sorry about the delay. I'm a little busy at the moment, so I'm not sure when I'll have chance to look at this, but feel free to submit a PR and I'll take a look :)
If I undestand this correctly the values passed to .valid(...values)
should be passed to the enum
property.
The problem I see there is that Joi implements .valid(...values)
for any
type, while mongoose only accept this property for keys of type
String
.
Assumed it is ok that it will only works for strings, I will maybe try to submit a PR soon.
Closing this, but I'll reopen if necessary.
Like in mongoose that allows developers to provide enum validator like this:
var personSchema = new Schema({ .... gender: { type: String, enum: ['F', 'M'] } });