Skip to content

ERA-13745: V1 cleared enum/dropdown field fails "must be equal to one of the allowed values" validation on re-save#1660

Merged
AlanCalvillo merged 2 commits into
release-2.144.1from
ERA-13745
Jul 17, 2026
Merged

ERA-13745: V1 cleared enum/dropdown field fails "must be equal to one of the allowed values" validation on re-save#1660
AlanCalvillo merged 2 commits into
release-2.144.1from
ERA-13745

Conversation

@luixlive

@luixlive luixlive commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Implement error filtering for cleared fields in event details

  • Added a new utility function, filterOutEnumErrorsForClearedFields, to handle enum validation errors for fields that have been cleared (set to empty or undefined).
  • Updated the transformErrors function in DetailsSection to utilize the new error filtering logic.
  • Enhanced tests in event-schemas.test.js to cover various scenarios for cleared fields, ensuring proper handling of enum errors based on schema requirements.
  • Adjusted the ReportDetailView tests to validate saving behavior when dealing with cleared dropdowns and their associated enum validations.

Relevant link(s)

- Added a new utility function, `filterOutEnumErrorsForClearedFields`, to handle enum validation errors for fields that have been cleared (set to empty or undefined).
- Updated the `transformErrors` function in `DetailsSection` to utilize the new error filtering logic.
- Enhanced tests in `event-schemas.test.js` to cover various scenarios for cleared fields, ensuring proper handling of enum errors based on schema requirements.
- Adjusted the `ReportDetailView` tests to validate saving behavior when dealing with cleared dropdowns and their associated enum validations.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a legacy (v1) event-details form issue where clearing an enum/dropdown field can produce a spurious AJV enum validation error (“must be equal to one of the allowed values”) and prevent re-saving an event. It adds an error-filtering utility and wires it into the legacy form error transformation, with accompanying unit and integration-style tests.

Changes:

  • Added filterOutEnumErrorsForClearedFields to remove enum validation errors when the corresponding field is cleared (unless the schema marks it as required).
  • Updated DetailsSection legacy transformErrors to apply the new filtering before hidden-property filtering.
  • Expanded Jest coverage in event-schemas.test.js and ReportDetailView tests for cleared dropdown save/reopen scenarios and required-field behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/utils/event-schemas.js Adds cleared-enum error filtering + required-field detection helper.
src/utils/event-schemas.test.js Adds unit tests covering cleared enum filtering for flat/nested/array paths and required schema behavior.
src/ReportManager/DetailsSection/index.js Integrates the new filter into legacy form transformErrors.
src/ReportManager/ReportDetailView/index.test.js Adds regression tests ensuring cleared legacy dropdowns can be saved/reopened, and required dropdowns still block saving.

Comment thread src/utils/event-schemas.js
…r malformed schemas

- Updated the `isFieldRequired` function to ensure it correctly checks if the `required` property is an array before validating keys.
- Added a new test case in `event-schemas.test.js` to verify that the function handles malformed `required` properties gracefully, ensuring no errors are thrown and enum errors are filtered correctly.
@AlanCalvillo
AlanCalvillo merged commit 1aef78d into release-2.144.1 Jul 17, 2026
7 checks passed
@AlanCalvillo
AlanCalvillo deleted the ERA-13745 branch July 17, 2026 15:29
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