Skip to content

Comments

Escape special characters for fieldNames in jsonToType mapper#727

Open
pasindufernando1 wants to merge 4 commits intoballerina-platform:1.7.xfrom
pasindufernando1:979Fix
Open

Escape special characters for fieldNames in jsonToType mapper#727
pasindufernando1 wants to merge 4 commits intoballerina-platform:1.7.xfrom
pasindufernando1:979Fix

Conversation

@pasindufernando1
Copy link
Contributor

Purpose

$subject
Fixes : wso2/product-ballerina-integrator#979

This PR will address the issue of the fieldNames which contain special characters not being properly escaped that leads to invalid types.

Copilot AI review requested due to automatic review settings February 23, 2026 06:29
@coderabbitai
Copy link

coderabbitai bot commented Feb 23, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to fix generation of invalid Ballerina types when JSON-derived record field names contain special characters by ensuring identifiers are escaped during source generation.

Changes:

  • Updated SourceCodeGenerator to escape record field identifiers using escapeIdentifier(...) instead of only escaping reserved keywords.
  • Added a new types-manager create/update test config covering field names with + and -.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/utils/SourceCodeGenerator.java Escapes generated record field names to support special characters in identifiers.
flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/types_manager/create_and_update/config/create_record_type4.json Adds regression coverage for record fields named +1 and -1 expecting escaped identifiers in generated output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant