Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed validation of server's Joi options #3520

wants to merge 1 commit into from

Fixed validation of server's Joi options #3520

wants to merge 1 commit into from


Copy link

@jgburet jgburet commented Jun 9, 2017

I encountered an error when trying to pass this to my server:

// ...
  modify: true,
  options: {
    stripUnknown: {
      objects: true,
      arrays: false

...telling me stripUnknown didn't meet requirement of having peer modify set to true.

It happened the validation made in Hapi was asserting stripUnknown was matching the validation of modify: a boolean. However, the documentation specifies stripUnknwon can also take an object.

Just to make a remark about my commit; I'm kind of disappointed to provide the validations for the inner values of the object here because I feel like this is not the job it is intended to. Especially since I'm not doing it there as it is resolved later by Joi itself.
I would prefer to stick with a simple:

// ...
otherwise: Joi.boolean().only(false)

Any preference?

stripUnknown & modify coupling, when stripUnknown is having an object
@hueniverse hueniverse added this to the 16.4.4 milestone Jul 17, 2017
@hueniverse hueniverse self-assigned this Jul 17, 2017
@hueniverse hueniverse added the bug Bug or defect label Jul 17, 2017
Copy link

This was too complicated. I kept it simple.

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.
bug Bug or defect
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants