-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
supportQuestions, discussions, and general supportQuestions, discussions, and general support
Description
Context
- node version: 6 LTS
- joi version: 12.0.x
- environment node
- used with standalone
- any other relevant information: N/A
What are you trying to achieve or the steps to reproduce ?
I'd like to populate a user interface with only valid values. I'm using Joi for validation, but is there an interface for getting the valid values out of Joi once it's configured?
https://github.com/hapijs/joi/blob/master/API.md#anyvalidvalue---aliases-only-equal
There's a backdoor way:
const Joi = require('joi');
const constraint = Joi.any().valid([ 'foo', 'bar' ]);
console.log(constraint._valids._set);which produces
[ 'foo', 'bar' ]
However, that's accessing the internals and I'd rather not depend on that in case the structure changes.
Any suggestions?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
supportQuestions, discussions, and general supportQuestions, discussions, and general support