Skip to content

Missing validate fields #21

Open
Open
@jaumard

Description

@jaumard

@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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions