Skip to content

Use .single() option for directory settings schema#14

Merged
hueniverse merged 1 commit intohapijs:masterfrom
kanongil:joi-usage
Dec 4, 2014
Merged

Use .single() option for directory settings schema#14
hueniverse merged 1 commit intohapijs:masterfrom
kanongil:joi-usage

Conversation

@kanongil
Copy link
Copy Markdown
Contributor

@kanongil kanongil commented Dec 4, 2014

No description provided.

@kanongil
Copy link
Copy Markdown
Contributor Author

kanongil commented Dec 4, 2014

Note that doing actual validation means that the boolean values will be handled slightly different for string input. Previously, "false" would pass the assertion check but actual usage evaluates it to true.

@hueniverse
Copy link
Copy Markdown
Contributor

Is this a bug fix then? or breaking change?

@hueniverse hueniverse added dependency Update module dependency feature New functionality or improvement and removed dependency Update module dependency labels Dec 4, 2014
@kanongil
Copy link
Copy Markdown
Contributor Author

kanongil commented Dec 4, 2014

Good question. I did this as a refactor, and only realized the slightly changed behavior afterwards.

The issue is actually a bit trickier than it would seem. I'm inclined towards labelling the non-assertion for Joi.assert("false", Joi.boolean()) as a bug in joi, as it will likely produces weird results without conversion as well. I'm not sure how you would fix it though. Maybe @Marsup can provide some insight?

@hueniverse
Copy link
Copy Markdown
Contributor

'false' is a valid boolean value in joi with the default settings. The problem here is that the value is allowed but the casting is not preserved leading to invalid settings. I think the change is more about Joi.assert(). Either we change the defaults to strict mode, or change how we use it by keeping the validated result.

Either way, I would call this a bug fix for inert.

@hueniverse hueniverse added the bug Bug or defect label Dec 4, 2014
@hueniverse hueniverse self-assigned this Dec 4, 2014
@hueniverse hueniverse added this to the 2.0.0 milestone Dec 4, 2014
hueniverse pushed a commit that referenced this pull request Dec 4, 2014
Use .single() option for directory settings schema
@hueniverse hueniverse merged commit e5afc5c into hapijs:master Dec 4, 2014
@kanongil kanongil deleted the joi-usage branch December 10, 2014 13:47
@lock
Copy link
Copy Markdown

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

bug Bug or defect feature New functionality or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants