-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
featureNew functionality or improvementNew functionality or improvement
Milestone
Description
I've got a pretty massive and nested Joi structure. I'm wondering if there's an easy way to have it spit out a default object. Something like:
Joi.compile(
{
baz:
{foo: Joi.string().default('bar')},
beef: Joi.string().default('hi')
}
).validate({});
{ error: null, value: { beef: 'hi' } }
But instead of just returning { beef: 'hi' }, have it return { baz: { foo: 'bar' }, beef: 'hi' }.
Is this currently possible?
I could create baz using Joi.object().default(...), but then I'd have to specify the entire substructure as the default. This would be more difficult to maintain.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew functionality or improvementNew functionality or improvement