martini-contrib / binding

Martini handler for mapping and validating a raw request into a structure.
MIT License
140 stars 47 forks source link

Document that implementing the Validator interface allows modifying the bound object in-place #23

Closed attilaolah closed 10 years ago

attilaolah commented 10 years ago

See this discussion for details.

Basically, implementing the Validate method with a pointer receiver allows the validation to be used as a "prepare" function, e.g. trimming whitespace or lower-casing email addresses.

mholt commented 10 years ago

Yes, good idea. It is optional but should be documented. Would you like to submit a PR? I might not get around to it for a bit.

attilaolah commented 10 years ago

Sure. I'll have some time tomorrow.

mholt commented 10 years ago

I'm gonna close this for now; the PR is still welcome if you'd like, but it doesn't matter either way I think.