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

Fix validation of conditionally visible components inside repeating groups #4126

Closed
sergei-maertens opened this issue Apr 5, 2024 · 0 comments · Fixed by #4125
Closed

Fix validation of conditionally visible components inside repeating groups #4126

sergei-maertens opened this issue Apr 5, 2024 · 0 comments · Fixed by #4125
Assignees
Labels
bug Something isn't working needs-backport Fix must be backported to stable release branch owner: den-haag
Milestone

Comments

@sergei-maertens
Copy link
Member

Taiga DH 674

Too complicated (and edge case) for 2.6.2, but needs to be in 2.6.3.

If you have a component inside a repeating group that is {validate: {required: true}} and conditionally visible, the frontend skips the validation but the backend is not able to see that the validation should be skipped.

This is complicated because every row in the list behaves independent from its siblings.

@sergei-maertens sergei-maertens added the needs-backport Fix must be backported to stable release branch label Apr 5, 2024
@sergei-maertens sergei-maertens added this to the Release 2.6.3 milestone Apr 5, 2024
@sergei-maertens sergei-maertens self-assigned this Apr 5, 2024
sergei-maertens added a commit that referenced this issue Apr 5, 2024
We cannot simply use ListField, as that applies the same
child serializer for every item inside the array of values,
but the field configuration of the child actually changes
depending on the values passed in (some fields may be
hidden, and that disables their validations entirely).

Note the disclaimer about rest_framework.fields.Field.__repr__,
this method behaves unexpectedly because it doesn't report
the current values of args/kwargs, but the values at the
time of instance creation.
@sergei-maertens sergei-maertens added bug Something isn't working owner: den-haag labels Apr 5, 2024
sergei-maertens added a commit that referenced this issue Apr 8, 2024
We cannot simply use ListField, as that applies the same
child serializer for every item inside the array of values,
but the field configuration of the child actually changes
depending on the values passed in (some fields may be
hidden, and that disables their validations entirely).

Note the disclaimer about rest_framework.fields.Field.__repr__,
this method behaves unexpectedly because it doesn't report
the current values of args/kwargs, but the values at the
time of instance creation.
sergei-maertens added a commit that referenced this issue Apr 8, 2024
We cannot simply use ListField, as that applies the same
child serializer for every item inside the array of values,
but the field configuration of the child actually changes
depending on the values passed in (some fields may be
hidden, and that disables their validations entirely).

Note the disclaimer about rest_framework.fields.Field.__repr__,
this method behaves unexpectedly because it doesn't report
the current values of args/kwargs, but the values at the
time of instance creation.
sergei-maertens added a commit that referenced this issue Apr 8, 2024
We cannot simply use ListField, as that applies the same
child serializer for every item inside the array of values,
but the field configuration of the child actually changes
depending on the values passed in (some fields may be
hidden, and that disables their validations entirely).

Note the disclaimer about rest_framework.fields.Field.__repr__,
this method behaves unexpectedly because it doesn't report
the current values of args/kwargs, but the values at the
time of instance creation.

Backport-of: #4125
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-backport Fix must be backported to stable release branch owner: den-haag
Projects
Archived in project
1 participant