Skip to content

Conversation

@pasindufernando1
Copy link
Contributor

@pasindufernando1 pasindufernando1 commented Jan 5, 2026

Purpose

Addresses : wso2/product-ballerina-integrator#2127

Summary by CodeRabbit

  • New Features
    • Improved JSON data type processing in the data mapper so nested fields within JSON-structured inputs are now extracted and mapped as record-like fields, enabling more accurate handling of complex JSON payloads.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings January 5, 2026 09:59
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

Note

Other AI code review bot(s) detected

CodeRabbit 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.

Walkthrough

The 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

Cohort / File(s) Summary
JSON Type Handling
workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts
Add detection for TypeKind.Json with fields; call processTypeFields for those fields and return an object with fields and kind: TypeKind.Record so JSON-structured types follow record processing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇 I nibble through JSON, tidy and neat,
Fields turned to records, a crunchy treat,
Hops of logic, tidy and quick,
Mapping the data with a playful flick,
Joyful code—one hop, one trick!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete and only partially filled. While it identifies the purpose and linked issue, it lacks Goals, Approach, UI Component Development, and other required template sections. Expand the description to include Goals explaining what the solution achieves, Approach describing the implementation details, and other relevant template sections like UI/UX considerations and test information.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding JSON type visualization support in the DataMapper UI, which aligns with the actual code changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 3b3b192 and fff3497.

📒 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)

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 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.Json in 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.

@pasindufernando1 pasindufernando1 marked this pull request as draft January 5, 2026 10:31
@pasindufernando1 pasindufernando1 marked this pull request as ready for review January 6, 2026 03:51
KCSAbeywickrama
KCSAbeywickrama previously approved these changes Jan 6, 2026
@kanushka kanushka changed the base branch from main to bi-1.6.x January 7, 2026 18:07
@kanushka kanushka changed the base branch from bi-1.6.x to main January 7, 2026 18:07
@kanushka kanushka dismissed KCSAbeywickrama’s stale review January 7, 2026 18:07

The base branch was changed.

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