poppinss / indicative

Indicative is a simple yet powerful data validator for Node.js and browsers. It makes it so simple to write async validations on nested set of data.
https://indicative.adonisjs.com/
MIT License
417 stars 52 forks source link

required_when with false #145

Closed mohamed-hendawy closed 6 years ago

mohamed-hendawy commented 7 years ago

when use required_when with field it's value false it does not work

{
  field2: 'required_when:field1,false'
}

field 2 is not required if field1 value is false

thetutlage commented 7 years ago

Will add it

mohamed-hendawy commented 6 years ago

@thetutlage thanks and i wait it :D

thetutlage commented 6 years ago

Ohh the required_when rule already exists. Docs here http://indicative.adonisjs.com/#indicative-schema-rules

Just search for required_when

mohamed-hendawy commented 6 years ago

i know that required_when rule already exists but there a bug in it try to use it with true or false like this

{
  field2: 'required_when:field1,false'
}

when field1 is false field2 does not requierd

thetutlage commented 6 years ago

Fixed in 4.0