Improve release post schema validation error messages
Note: Generated by Duo
Summary
This MR improves the error messages in the release post schema validation to make them much more human-readable and actionable.
Problem
The current schema validation produces cryptic error messages like:
"features.secondary/0 is missing required keys: gitlab_com, self_managed"
These messages don't provide context about what these fields are for or how to fix the issue, making it difficult for contributors to understand what's wrong with their release post files.
Solution
Enhanced the lib/lint/schema.rb file to provide contextual, helpful error messages by:
1. Contextual Error Messages for Missing Fields
Instead of the cryptic error above, it now shows:
features.secondary/0 is missing required availability fields: gitlab_com, self_managed
→ These boolean fields specify where the feature is available:
- gitlab_com: true/false (available on GitLab.com)
- self_managed: true/false (available for self-managed instances)
2. Specific Handling for Common Error Patterns
-
Availability fields (
gitlab_com,self_managed,gitlab_dedicated): Explains what these boolean fields are for -
Basic fields (
name,description): Clarifies that every feature needs these fundamental properties -
Tier availability (
available_in): Explains this array specifies which tiers the feature is available in
3. Helpful Guidance
Each error message now includes:
- Clear explanation of what the missing fields are for
- Examples of valid values where appropriate
- Contextual help that guides users toward the correct solution
4. Fallback Behavior
For any error patterns not specifically handled, it falls back to the original error message format, ensuring no regressions.
Benefits
- Better Developer Experience: Contributors get clear, actionable error messages
- Faster Issue Resolution: Less time spent figuring out what fields are missing and why
- Self-Documenting: Error messages now serve as inline documentation for the schema requirements
- Backward Compatible: Maintains existing functionality while improving the user experience
Testing
The changes are backward-compatible and maintain all existing validation logic while enhancing the error message presentation.