Include JSON type visualization backend support for data mapper#572
Draft
pasindufernando1 wants to merge 14 commits intoballerina-platform:data-mapper-extended-typesfrom
Draft
Include JSON type visualization backend support for data mapper#572pasindufernando1 wants to merge 14 commits intoballerina-platform:data-mapper-extended-typesfrom
pasindufernando1 wants to merge 14 commits intoballerina-platform:data-mapper-extended-typesfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds JSON type visualization support to the data mapper backend, enabling the flow model generator to infer and represent JSON structures for data mapping operations. The implementation introduces a new RefJsonType class and extends the DataMapManager to handle JSON type inference from mapping constructor expressions and variable assignments.
Key Changes:
- Introduced
RefJsonTypeclass to represent JSON types with field information in the connector model - Added JSON structure inference logic that analyzes mapping constructors to determine field types
- Extended data mapper to track most recent JSON variable assignments for accurate type inference
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
misc/diagram-util/src/main/java/org/ballerinalang/diagramutil/connector/models/connector/reftypes/RefJsonType.java |
New class defining the JSON reference type model with fields and clone support |
flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/DataMapManager.java |
Core logic for JSON type inference, including MappingJsonPort class, JSON structure inference methods, and assignment tracking |
flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/DataMappingModelTest.java |
Registered three new test cases for JSON data mapping scenarios |
flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/data_mapper_model/source/json.bal |
Test source file for JSON-to-record transformation |
flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/data_mapper_model/source/json_input.bal |
Test source file for JSON module variable input inference |
flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/data_mapper_model/source/json_local_input.bal |
Test source file for JSON local variable reassignment inference |
flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/data_mapper_model/config/json_transform.json |
Expected output configuration for record-to-JSON transformation test |
flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/data_mapper_model/config/json_input.json |
Expected output configuration for JSON module variable input test with diagnostics |
flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/data_mapper_model/config/json_local_input.json |
Expected output configuration for JSON local variable test |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/DataMapManager.java
Outdated
Show resolved
Hide resolved
...-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/DataMapManager.java
Show resolved
Hide resolved
...main/java/org/ballerinalang/diagramutil/connector/models/connector/reftypes/RefJsonType.java
Outdated
Show resolved
Hide resolved
...-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/DataMapManager.java
Outdated
Show resolved
Hide resolved
gimantha
reviewed
Dec 12, 2025
...dules/flow-model-generator-ls-extension/src/test/resources/data_mapper_model/source/json.bal
Show resolved
Hide resolved
3b39382 to
eda01aa
Compare
dan-niles
reviewed
Jan 6, 2026
...dules/flow-model-generator-ls-extension/src/test/resources/data_mapper_model/source/json.bal
Outdated
Show resolved
Hide resolved
...-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/DataMapManager.java
Outdated
Show resolved
Hide resolved
8469278 to
bc9eb5e
Compare
# Conflicts: # flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/DataMapManager.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Fixes : wso2/product-ballerina-integrator#2044