Skip to content

Fix security policy editor validation error rendering

Dominic Bauer requested to merge 404777-fix-policy-editor-validations into master

What does this MR do and why?

Fixes validation error message rendering in the security policy editor:

I had a look as well and it's indeed regression from Update alert for not enough approvers (!123757 - merged). The MR added validationErrors for the GraphQL query and it uncovered an inconsistent behavior in backend where we don't always return field and we default to nil here, even though the field is marked as not-nullable.

As discussed on Slack, we agreed a proper fix would be to make sure in backend that we always return field for the validationErrors. For cases where we don't have a specific field in the form such as Invalid policy type, we'd propose to use base, which aligns with Rails validations.

#404777 (comment 1437673026)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Navigate to Secure > Policies, attempt to create an invalid security policy of either type, and verify error messages are rendered as expected.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #404777 (closed)

Edited by Dominic Bauer

Merge request reports

Loading