Skip to content

Commit

Permalink
🚑 [#4068] Skip step data validation when the step is not applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-maertens committed Mar 28, 2024
1 parent 603b27b commit ec1f545
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/openforms/submissions/api/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,16 @@ def validate(self, attrs: dict):
for step in submission.steps:
errors = {}
assert step.form_step
components = step.form_step.form_definition.configuration["components"]

step_data_serializer = build_serializer(
components,
data=data,
context={"submission": submission},
)
if not step_data_serializer.is_valid():
errors = step_data_serializer.errors
if step.is_applicable:
components = step.form_step.form_definition.configuration["components"]
step_data_serializer = build_serializer(
components,
data=data,
context={"submission": submission},
)
if not step_data_serializer.is_valid():
errors = step_data_serializer.errors

if errors:
formio_validation_errors.append({"data": errors})
Expand Down

0 comments on commit ec1f545

Please sign in to comment.