busypeoples / spected

Validation library
MIT License
702 stars 32 forks source link

validations of missing field are skipped? #91

Closed iwinux closed 7 years ago

iwinux commented 7 years ago

Hi,

As specified in the unit test, validations of missing field are simply skipped - how should I ensure that every required fields are filled?

Thanks :)

busypeoples commented 7 years ago

Would be possible to define a default data object containing null for every key and then merging it with the provided data?

const default = {id: null, name: null}
const providedData = {id: 1}
const data = merge(default, providedData)
iwinux commented 7 years ago

That looks good. Thanks!