-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
featureNew functionality or improvementNew functionality or improvement
Milestone
Description
In extension of #938, I'm looking into adding support for the symbol type to Joi to allow something like this:
const enums = {
first: Symbol('first'),
second: Symbol('second')
};
const schema = Joi.symbol().map(enums);
schema.validate('first'); // value = Symbol(first)This will enable eg. an options schema to declare enums using symbols instead of strings.
I could probably create it as an extension, but given that it is a native type (typeof Symbol() === 'symbol'), I'd say that it needs to be a part of the standard package.
How does this sound?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew functionality or improvementNew functionality or improvement