-
Notifications
You must be signed in to change notification settings - Fork 69
Add json type visualization support in DataMapper UI #1194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughThe change updates processTypeKind to recognize TypeKind.Json with fields; such JSON types now have their fields processed via processTypeFields and are returned with kind set to TypeKind.Record, routing JSON-structured types through the record handling path. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Fix all issues with AI Agents 🤖
In
@workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts:
- Around line 541-548: The JSON branch in the type switch (TypeKind.Json) only
handles inline fields via processTypeFields on RecordType but ignores a
potential type.ref the same way the Record branch does; update the TypeKind.Json
case to check for type.ref and call processTypeReference(type.ref, parentId,
model, visitedRefs) before handling inline fields (or vice-versa depending on
precedence) so JSON types that reference external type defs are processed the
same as Record types; use the existing symbols TypeKind.Json,
processTypeReference, processTypeFields, and RecordType to locate and implement
this change.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-16T05:44:13.291Z
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 1116
File: workspaces/ballerina/data-mapper/src/components/Diagram/utils/common-utils.ts:124-131
Timestamp: 2025-12-16T05:44:13.291Z
Learning: In the data mapper getMappingType function in common-utils.ts, StringChar and int:X (integer subtype) types are intentionally not supported for auto-conversion. The code uses direct equality check `targetField.kind === TypeKind.String` rather than `getGenericTypeKind(targetField.kind) === TypeKind.String` to skip StringChar types and let them fall through to Incompatible.
Applied to files:
workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
🧬 Code graph analysis (1)
workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts (1)
workspaces/ballerina/ballerina-core/src/interfaces/data-mapper.ts (1)
RecordType(159-163)
workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
Show resolved
Hide resolved
There was a problem hiding this 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 adds support for visualizing JSON types in the DataMapper UI by handling them in the type processing logic. The change enables JSON types with inline fields to be displayed as record-like structures in the data mapper interface.
- Adds a new case to handle
TypeKind.Jsonin the type processing switch statement - Processes JSON types with inline fields similarly to record types
- Converts JSON type kind to Record kind for UI visualization purposes
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
Show resolved
Hide resolved
The base branch was changed.
Purpose
Addresses : wso2/product-ballerina-integrator#2127
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.