mholt / binding

Reflectionless data binding for Go's net/http (not actively maintained)
http://mholt.github.io/binding
MIT License
795 stars 84 forks source link

Errors object passed to Validate does not contain errors accumulated during Binding #46

Closed mmurray closed 7 years ago

mmurray commented 8 years ago

Validator.Validate methods are passed an error object but that error object was created at the beginning of Validate (https://github.com/mholt/binding/blob/master/binding.go#L135) and does not include any errors created during Binding.

The reason I need this is because I'm trying to add a "Required" error during Validate if a field's value is zero, but there are cases where it is zero because of a parsing error that occurred during binding. In those cases I don't want to print both "X is not valid" and "X is not required", but right now it seems that there is no way to see the errors that occurred during binding.