Skip to content

Fix YAML anchor alias resolution#13875

Open
manodyaSenevirathne wants to merge 1 commit into
wso2:masterfrom
manodyaSenevirathne:yaml-ref
Open

Fix YAML anchor alias resolution#13875
manodyaSenevirathne wants to merge 1 commit into
wso2:masterfrom
manodyaSenevirathne:yaml-ref

Conversation

@manodyaSenevirathne

Copy link
Copy Markdown
Contributor

@wso2-engineering wso2-engineering Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI Agent Log Improvement Checklist

⚠️ Warning: AI-Generated Review Comments

  • The log-related comments and suggestions in this review were generated by an AI tool to assist with identifying potential improvements. Purpose of reviewing the code for log improvements is to improve the troubleshooting capabilities of our products.
  • Please make sure to manually review and validate all suggestions before applying any changes. Not every code suggestion would make sense or add value to our purpose. Therefore, you have the freedom to decide which of the suggestions are helpful.

✅ Before merging this pull request:

  • Review all AI-generated comments for accuracy and relevance.
  • Complete and verify the table below. We need your feedback to measure the accuracy of these suggestions and the value they add. If you are rejecting a certain code suggestion, please mention the reason briefly in the suggestion for us to capture it.
Comment Accepted (Y/N) Reason
#### Log Improvement Suggestion No: 1
#### Log Improvement Suggestion No: 2
#### Log Improvement Suggestion No: 3

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6c13ea51-d9da-476c-9a95-af805ac35b01

📥 Commits

Reviewing files that changed from the base of the PR and between 56a4da8 and 6147ddf.

📒 Files selected for processing (2)
  • components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/importexport/utils/CommonUtil.java
  • components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/OASParserUtil.java

📝 Walkthrough

Walkthrough

Two YAML parsing methods — CommonUtil.yamlToJson and OASParserUtil.parseYamlWithLimit — are updated to use SnakeYAML's SafeConstructor with LoaderOptions for YAML loading, replacing the prior Jackson YAMLFactory-based approach. Downstream serialization to JSON via Jackson ObjectMapper remains unchanged.

Changes

YAML SafeConstructor Migration

Layer / File(s) Summary
Replace YAMLFactory with SafeConstructor in both parsers
...apimgt.impl/.../importexport/utils/CommonUtil.java, ...apimgt.spec.parser/.../definitions/OASParserUtil.java
Adds Yaml, SafeConstructor, and LoaderOptions imports; yamlToJson now parses via new Yaml(new SafeConstructor(new LoaderOptions())).load(yaml) and parseYamlWithLimit constructs LoaderOptions with an optional codePointLimit, loads with SafeConstructor, then converts to JsonNode via ObjectMapper.valueToTree.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix YAML anchor alias resolution' directly describes the main change: switching from Jackson's YAMLFactory to SnakeYAML's SafeConstructor to properly handle YAML anchor alias resolution.
Description check ✅ Passed The description references the upstream PR and internal issue that this change addresses, providing context that the changes are a port of an existing fix.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@manodyaSenevirathne

Copy link
Copy Markdown
Contributor Author
Comment Accepted (Y/N) Reason
#### Log Improvement Suggestion No: 1 N Nitpick
#### Log Improvement Suggestion No: 2 N one log is enough , no need here
#### Log Improvement Suggestion No: 3 N Nitpick

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