cmd icon indicating copy to clipboard operation
cmd copied to clipboard

Validation Key Index Line Number Mismatch

Open dandare100 opened this issue 2 years ago • 0 comments

Hello

The field level error messages are not working when the "validation checks" span multiple lines in the validate code. This is because the run.go (which holds the revel.DefaultValidationKeys) is generated using the "end" line number of the Check function but the validation.go revel file is expecting it to be keyed on the first/starting line number. It suspect it affects the booking example too.

The template extract that does not work Screenshot from 2022-05-17 20-12-42

The user model validation for Name, starts on 40 and ends on 43 Screenshot from 2022-05-17 17-53-58

The generated run.go file has a map that keys the field on 43 Screenshot from 2022-05-17 17-55-19

The revel validate.go file extract that expects the key to be on the start line. Screenshot from 2022-05-17 17-57-55

If I move the validation to be on 1 line, it works lol. This is expected because the first and last lines are the same number. Screenshot from 2022-05-17 20-14-51

dandare100 avatar May 17 '22 18:05 dandare100