Skip to content

Enhance error message for multiple key detection#2828

Merged
christiangoerdes merged 3 commits into
masterfrom
tripple-dash-message
Feb 24, 2026
Merged

Enhance error message for multiple key detection#2828
christiangoerdes merged 3 commits into
masterfrom
tripple-dash-message

Conversation

@predic8
Copy link
Copy Markdown
Member

@predic8 predic8 commented Feb 24, 2026

  • Updated ConfigurationParsingException message to provide clearer guidance on separating APIs and configuration using ---.

Summary by CodeRabbit

  • Bug Fixes
    • Updated validation error messages to explicitly advise separating APIs and configuration using ---, making it easier to identify and fix misformatted input.
    • Tightened message formatting for clearer, more consistent diagnostic output.

- Updated `ConfigurationParsingException` message to provide clearer guidance on separating APIs and configuration using `---`.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e732cb0 and dfe0c1d.

📒 Files selected for processing (2)
  • annot/src/main/java/com/predic8/membrane/annot/beanregistry/BeanRegistryImplementation.java
  • annot/src/main/java/com/predic8/membrane/annot/yaml/GenericYamlParser.java
✅ Files skipped from review due to trivial changes (2)
  • annot/src/main/java/com/predic8/membrane/annot/beanregistry/BeanRegistryImplementation.java
  • annot/src/main/java/com/predic8/membrane/annot/yaml/GenericYamlParser.java

📝 Walkthrough

Walkthrough

Updated an error message in YAML validation and made small import/static-import and formatting edits across bean registry and YAML parser files. No public APIs or control flow changes detected.

Changes

Cohort / File(s) Summary
YAML validation message
annot/src/main/java/com/predic8/membrane/annot/yaml/NodeValidationUtils.java
Changed ensureSingleKey error text to append guidance: "Separate APIs and configuration by ---".
Bean registry imports
annot/src/main/java/com/predic8/membrane/annot/beanregistry/BeanRegistryImplementation.java
Added Spring XML and general IO/reflection imports; replaced a specific static import with a wildcard static import. No API signature changes.
YAML parser formatting
annot/src/main/java/com/predic8/membrane/annot/yaml/GenericYamlParser.java
Whitespace, formatting, and minor message/exception formatting adjustments; no behavioral or API changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • christiangoerdes

Poem

I nibble on code with careful paws,
A dash inserted to fix the cause.
"Separate with ---," I softly declare,
Bugs hop away on the open air. 🐰✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.89% 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 directly matches the main change: enhancing the error message for multiple key detection in NodeValidationUtils.java by appending guidance about separating APIs and configuration with ---.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch tripple-dash-message

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
annot/src/main/java/com/predic8/membrane/annot/yaml/NodeValidationUtils.java (1)

30-30: Minor wording nits: quote the --- token and add a trailing period.

The appended sentence is missing a period, and the --- separator is undelimited — users reading the exception message in logs may not immediately recognize it as a literal token to type.

✏️ Suggested wording improvement
-            var e = new ConfigurationParsingException("Expected exactly one key but there are %d. Separate APIs and configuration by ---".formatted(node.size()));
+            var e = new ConfigurationParsingException("Expected exactly one key but there are %d. Separate APIs and configuration using '---'.".formatted(node.size()));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@annot/src/main/java/com/predic8/membrane/annot/yaml/NodeValidationUtils.java`
at line 30, The exception message constructed in the
ConfigurationParsingException instantiation (the var e = new
ConfigurationParsingException(...) line) should quote the separator and end with
a period; update the message string to read something like "Expected exactly one
key but there are %d. Separate APIs and configuration by '---'." so the '---'
token is delimited and the sentence is properly terminated.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@annot/src/main/java/com/predic8/membrane/annot/yaml/NodeValidationUtils.java`:
- Line 30: The exception message constructed in the
ConfigurationParsingException instantiation (the var e = new
ConfigurationParsingException(...) line) should quote the separator and end with
a period; update the message string to read something like "Expected exactly one
key but there are %d. Separate APIs and configuration by '---'." so the '---'
token is delimited and the sentence is properly terminated.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 934c76d and e732cb0.

📒 Files selected for processing (1)
  • annot/src/main/java/com/predic8/membrane/annot/yaml/NodeValidationUtils.java

… messages

- Adjusted spacing and formatting for better consistency across methods.
- Enhanced clarity of exception messages in `ConfigurationParsingException` and improved handling of multi-document YAML scenarios.
- Streamlined error logs for better debugging during configuration parsing.
- Added additional context to `ConfigurationParsingException` to enhance debugging (`$ref` key and its context).
@christiangoerdes christiangoerdes merged commit 0cf711f into master Feb 24, 2026
4 of 5 checks passed
@christiangoerdes christiangoerdes deleted the tripple-dash-message branch February 24, 2026 13:26
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