Skip to content

Conversation

@lukad
Copy link
Collaborator

@lukad lukad commented Jun 4, 2025

This adds an option that allow passing values to false schemas. This would normally result in a validation error but in v0 we explicitly clear values provided to a false schema:

function clearValuesIfNotVisible(fields, formValues) {
fields.forEach(({ isVisible = true, name, inputType, fields: nestedFields }) => {
if (!isVisible) {
// TODO I (Sandrina) think this doesn't work. I didn't find any test covering this scenario. Revisit later.
formValues[name] = null;
}
if (inputType === supportedTypes.FIELDSET && nestedFields && formValues[name]) {
clearValuesIfNotVisible(nestedFields, formValues[name]);
}
});
}

This option will achieve the same goal, but in a more straight forward way. It will also be disabled by default.

@lukad lukad requested review from antoniocapelo and sandrina-p June 4, 2025 16:55
@lukad lukad changed the title add allowForbiddenValues validation option feat(next): add allowForbiddenValues validation option Jun 4, 2025
antoniocapelo
antoniocapelo previously approved these changes Jun 5, 2025
@lukad lukad merged commit bb59dac into main Jun 5, 2025
2 checks passed
@lukad lukad deleted the add-allow-forbidden-values-option branch June 5, 2025 09:16
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

Successfully merging this pull request may close these issues.

4 participants