Show correct error message when modifying policy with invalid type
What does this MR do and why?
When editing policy in YAML mode, right now if a user specifies an invalid policy type, it shows error related to policy name being blank which is bit confusing.
This MR improves that by ignoring the typos in policy root key property, this is because the root key property is used for presentation purpose and not meant to be edited by user. If edited, it will be ignored and the correct policy type will be used.
References
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
Monosnap_screencast_2025-08-28_7_PM-32-10 |
How to set up and validate locally
- Create a project
- Navigate to
Secure => Policies - Open policy editor for a new policy or edit an existing policy
- Switch to YAML mode
- Edit the policy type with an invalid name
- Click on "Update via merge request"
- Verify the updated error message is displayed
- Fix the policy type and click on
Update via merge request, it should behave as expected
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #538577 (closed)
Edited by Imam Hossain
