martini-contrib / binding

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

When generating an error, the name is taken first from "json" tag and then from the "form" tag #51

Closed ghostiam closed 7 years ago

ghostiam commented 8 years ago

Fix: If the field is hidden for output generation json ( json:"-"), but is available for bindings, if this field is required ( binding:"required") and it is empty then the name will be specified in error "-" taken from tag "json", but not "form" tag.

mholt commented 8 years ago

Hey Vladislav, thanks for your PR! Can you add a test to ensure this works?

ghostiam commented 8 years ago

@mholt OK, I'll write tests

ghostiam commented 8 years ago

@mholt I made a mistake in the description of the fix. Read the new description.

mholt commented 8 years ago

Thanks, it looks like some tests are failing though.

ghostiam commented 8 years ago

I do not know how to write a test to check the output generated by the error in the field with the real name of the field in the tag