Enhance error message for multiple key detection#2828
Conversation
- Updated `ConfigurationParsingException` message to provide clearer guidance on separating APIs and configuration using `---`.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthroughUpdated 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 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.
… 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).
ConfigurationParsingExceptionmessage to provide clearer guidance on separating APIs and configuration using---.Summary by CodeRabbit
---, making it easier to identify and fix misformatted input.