Skip to content

Add Joi.defaults()#1256

Merged
Marsup merged 2 commits intomasterfrom
defaults
Aug 9, 2017
Merged

Add Joi.defaults()#1256
Marsup merged 2 commits intomasterfrom
defaults

Conversation

@Marsup
Copy link
Collaborator

@Marsup Marsup commented Jul 24, 2017

Here's a feature that has been requested previously (sorry can't find the issues) and I've been thinking about how to expose it, so this PR is my proposal. Let me know what you think.

I know accessing the _type is meh, but I doubt it will change and doing schema instanceof Joi.object().constructor is a bit tedious. Maybe type could be exposed through a getter...

@Marsup Marsup added the feature New functionality or improvement label Jul 24, 2017
@Marsup Marsup added this to the 11.0.0 milestone Jul 24, 2017
@Marsup Marsup self-assigned this Jul 24, 2017
@WesTyler
Copy link
Contributor

I like the getter :) Makes me much happier about looking at this code haha

@DavidTPate
Copy link
Contributor

@Marsup I believe #1209 is the issue that you are talking about. I took a stab at it last week and really didn't like my implementation.

@Marsup
Copy link
Collaborator Author

Marsup commented Jul 25, 2017

#1209 is specific to options, there was a broader one.

@Marsup
Copy link
Collaborator Author

Marsup commented Jul 25, 2017

And for the record, I'm not really satisfied with the complexity of this solution, but it's the best I could come up with.

@Marsup
Copy link
Collaborator Author

Marsup commented Aug 9, 2017

@WesTyler @DavidTPate think this one is good to go ?

@WesTyler
Copy link
Contributor

WesTyler commented Aug 9, 2017

I like it

Copy link
Contributor

@DavidTPate DavidTPate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Marsup Marsup merged commit 4fbeeb4 into master Aug 9, 2017
@Marsup Marsup deleted the defaults branch August 9, 2017 21:00
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

feature New functionality or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants