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

Server side validators not working correctly with array form binding #3099

Open
aspan opened this issue Dec 30, 2024 · 0 comments
Open

Server side validators not working correctly with array form binding #3099

aspan opened this issue Dec 30, 2024 · 0 comments
Labels
bug Something isn't working hilla Issues related to Hilla Impact: Low Severity: Major

Comments

@aspan
Copy link
Contributor

aspan commented Dec 30, 2024

Describe the bug

The error messages are not displayed on the field for server side validators when using the array data binding.

The parameterName is generated with bracket notation from the server side and it looks like this:

"parameterName":"pets[0].description"

The frontend code expects the parameterName to look like this:

"parameterName":"pets.0.description"

Expected-behavior

The server side validation message should be shown.

Reproduction

I modified the pet clinic project to demonstrate the issue available here: https://github.com/aspan/spring-petclinic-hilla/tree/develop

The Owner edit form has been modified to add a server side validator to the description of a pet in the list of pets requiring between 3 and 100 characters.

I added a small servlet filter to replace the server side response body with the correct parameterName in org.springframework.samples.petclinic.FixValidationResponseWithBrackets

The project currently works because of the servlet filter but as soon as it is removed the validation error message is not shown any more.

System Info

Hilla 24.6.0

@aspan aspan added bug Something isn't working hilla Issues related to Hilla labels Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hilla Issues related to Hilla Impact: Low Severity: Major
Projects
None yet
Development

No branches or pull requests

2 participants