Escape special characters for fieldNames in jsonToType mapper#727
Escape special characters for fieldNames in jsonToType mapper#727pasindufernando1 wants to merge 4 commits intoballerina-platform:1.7.xfrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
SourceCodeGeneratorto escape record field identifiers usingescapeIdentifier(...)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.
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.