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

throw when invalid options are provided #511

Closed
stephen-bartell opened this issue Dec 9, 2014 · 5 comments
Closed

throw when invalid options are provided #511

stephen-bartell opened this issue Dec 9, 2014 · 5 comments
Assignees
Labels
bug Bug or defect
Milestone

Comments

@stephen-bartell
Copy link
Contributor

just a thought. if i enter abortearly instead of abortEarly in options, joi should throw that 'abortearly' is an invalid option.

this behavior has saved me time in hapi/hapijs, lack of this behavior - plus my fat fingers and impatient eyes - have cost me time in joi.

@Marsup Marsup added the bug Bug or defect label Dec 9, 2014
@Marsup Marsup self-assigned this Dec 9, 2014
@Marsup
Copy link
Collaborator

Marsup commented Dec 9, 2014

Agreed, this should not happen, do you feel confident submitting a patch ?

@stephen-bartell
Copy link
Contributor Author

Yep, I've got a patch. Need a test for it. I'm thinking of putting it in tests/index.js with the other options tests. Does that sound like the right place?

@stephen-bartell
Copy link
Contributor Author

a couple more questions,

re: language, when language is present, is setting label the only valid thing to do? it looks like it in the code.

what do you think about creating a schema of these options and using joi itself to validate?

@Marsup
Copy link
Collaborator

Marsup commented Dec 10, 2014

  1. I think both in any#options and in index for validate with options.
  2. Nope, see https://github.com/hapijs/joi/blob/master/test/errors.js, it can override any part of the language.
  3. Yes my thoughts exactly.

@Marsup Marsup closed this as completed in fa59fdf Jan 21, 2015
@Marsup Marsup added this to the 5.1.1 milestone Jan 21, 2015
@Marsup
Copy link
Collaborator

Marsup commented Jan 21, 2015

Sorry, I was cleaning out bugs, thought I'd take a stab at this one to include it in next release. Next time :)

@Marsup Marsup modified the milestones: 6.0, 5.1.1 Jan 22, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Jan 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

No branches or pull requests

2 participants