Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation Key Index Line Number Mismatch #219

Open
dandare100 opened this issue May 17, 2022 · 0 comments
Open

Validation Key Index Line Number Mismatch #219

dandare100 opened this issue May 17, 2022 · 0 comments

Comments

@dandare100
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant