Skip to content

allow enum values to have arbitrary casing in YAML#2719

Merged
rrayst merged 2 commits into
masterfrom
improve-startup-errors
Feb 2, 2026
Merged

allow enum values to have arbitrary casing in YAML#2719
rrayst merged 2 commits into
masterfrom
improve-startup-errors

Conversation

@rrayst
Copy link
Copy Markdown
Member

@rrayst rrayst commented Jan 30, 2026

Summary by CodeRabbit

Release Notes

  • New Features
    • Enhanced enum value handling in configuration schemas across Kubernetes, Spring, and YAML formats, providing intelligent suggestions for predefined values while maintaining flexibility for custom inputs.

✏️ Tip: You can customize this high-level summary in your review settings.

@rrayst
Copy link
Copy Markdown
Member Author

rrayst commented Jan 30, 2026

/ok-to-test

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

This pull request enhances enum handling in Kubernetes JSON schema generation by introducing an anyOf structure that allows both predefined enum values and freeform input. Supporting test classes for Spring and YAML enum parsing are added, along with test utility enhancements to enable validation of enum translation scenarios.

Changes

Cohort / File(s) Summary
Kubernetes Schema Enum Handling
annot/src/main/java/.../kubernetes/model/SchemaObject.java
Introduces createEnumNode() method to wrap enum values in an anyOf structure (restricted enum variant + unrestricted copy), enabling schema suggestions while allowing custom values. Modified createPropertyNode() to delegate enum handling to the new method instead of directly assigning the enum field.
Test Infrastructure Refactoring
annot/src/test/java/.../SpringParsingTest.java
Class renamed from ParsingTest to SpringParsingTest; wrapSpring() method changed from private instance method to public static utility; unused import removed.
Spring & YAML Enum Parsing Tests
annot/src/test/java/.../SpringEnumParsingTest.java, annot/src/test/java/.../YAMLEnumParsingTest.java
New JUnit test classes validating enum parsing and translation in Spring and YAML contexts; test enum values against expected string representations using compiler pipeline and helper utilities.
Test Utilities
annot/src/test/java/.../util/CompilerHelper.java, annot/src/test/java/.../util/StructureAssertionUtil.java
CompilerHelper updated to extract names from class/enum/interface declarations via extended regex pattern; StructureAssertionUtil adds isNull() and convertedToString() helper assertions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

7.x

Suggested reviewers

  • christiangoerdes
  • predic8

Poem

🐰 A schema hops with enums now,
Wrapped in anyOf, we vow,
Tests spring forth both YAML bright,
Values translate just right! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'allow enum values to have arbitrary casing in YAML' directly describes the core change: modifying enum handling to support flexible casing in YAML configurations through the new anyOf-based enum structure.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch improve-startup-errors

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@membrane-ci-server
Copy link
Copy Markdown

This pull request needs "/ok-to-test" from an authorized committer.

@rrayst rrayst merged commit 5add9ea into master Feb 2, 2026
5 checks passed
@rrayst rrayst deleted the improve-startup-errors branch February 2, 2026 17:52
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.

2 participants