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

Missing validate fields #21

Open
jaumard opened this issue May 21, 2016 · 2 comments
Open

Missing validate fields #21

jaumard opened this issue May 21, 2016 · 2 comments

Comments

@jaumard
Copy link
Contributor

jaumard commented May 21, 2016

@mib4fun we miss some useful options with the validate feature :

errorFields - an optional object with error fields copied into every validation error response.

failAction - determines how to handle invalid requests. Allowed values are:

  • 'error' - return a Bad Request (400) error response. This is the default value.
  • 'log' - log the error but continue processing the request.
  • 'ignore' - take no action.
  • a custom error handler function with the signature function(request, reply, source, error) where:
    • request - the request object.
    • reply - the continuation reply interface.
    • source - the source of the invalid field (e.g. 'headers', 'params', 'query', 'payload').
    • error - the error object prepared for the client response (including the validation function error under error.data).

options - options to pass to Joi. Useful to set global options such as stripUnknown or abortEarly (the complete list is available here). Defaults to no options.

http://hapijs.com/api#route-options
If you don't have time to do it this is not a problem I just want to let you know ^^

Also need unit tests about these new fields.

@jvkassi
Copy link
Contributor

jvkassi commented May 30, 2016

@jaumard, hey dude! Didn't know about that.
I'll try to implement it ! Don't have much time now though 😞

@jaumard
Copy link
Contributor Author

jaumard commented May 30, 2016

@mib4fun no problem at all :) it's not urgent, just nice to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants