hapi icon indicating copy to clipboard operation
hapi copied to clipboard

Validation of parameters, meaning of "true"

Open rgov opened this issue 5 years ago • 2 comments

Context

  • node version: n/a
  • module version: n/a (latest)

What are you trying to achieve or the steps to reproduce ?

The validate option has a default value of:

{ 
   headers: true, 
   params: true, 
   query: true, 
   payload: true, 
   state: true, 
   failAction: 'error'
}

If a key has a value of true, there will be no validation.

Is this accurate? It is surprising that validate: { headers: true } means "don't validate headers."

rgov avatar Feb 02 '21 22:02 rgov

Maybe it is trying to say that true means that the headers are always considered valid, which makes a lot more sense. Rather than validation is disabled or skipped.

rgov avatar Feb 02 '21 22:02 rgov

It is explained in this section of the Documentation.

devinstewart avatar Feb 02 '21 22:02 devinstewart