Skip to content

Comments

Support submodule types in the data mapper#426

Merged
nipunayf merged 4 commits intoballerina-platform:1.2.xfrom
nipunayf:fix-local-modules
Oct 25, 2025
Merged

Support submodule types in the data mapper#426
nipunayf merged 4 commits intoballerina-platform:1.2.xfrom
nipunayf:fix-local-modules

Conversation

@nipunayf
Copy link
Contributor

Purpose

This PR enhances the handling of project structures that include submodules. Previously, the implementation attempted to pull all imported modules from Ballerina Central, which led to failures when using types defined in local project submodules.

The source builder has been refined to:

  • Filter out local submodules when retrieving imports.
  • Directly query the semantic model of the corresponding submodule for type resolution.

Fixes wso2/product-ballerina-integrator#1600

Remarks

The following implementation is a temporary workaround. We need to explore improvements to the semantic APIs to properly handle submodules.

Copilot AI review requested due to automatic review settings October 24, 2025 15:35
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 handling local submodule types in the data mapper by filtering out submodules when retrieving imports and directly querying their semantic models for type resolution. This prevents the system from attempting to retrieve local submodule types from Ballerina Central.

  • Updated the SourceBuilder.getExpressionBodyText method to identify and handle local submodules separately
  • Added a failover mechanism that queries the semantic model of local submodules when types cannot be resolved through normal imports
  • Includes comprehensive test cases covering various scenarios with local module types (basic usage, parameters, return types, unions, and editing)

Reviewed Changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.

File Description
SourceBuilder.java Core logic changes to detect local submodules, filter them from import pulls, and implement failover type resolution for submodule types
DataMapperDefinitionBuilder.java Minor formatting change to method return statement
data_mapper_definition11-15.json Test configuration files for various local module type scenarios
nested/nested_editing test files Test resources defining local submodule structures and type definitions
Comments suppressed due to low confidence (1)

flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/DataMapperDefinitionBuilder.java:1

  • Corrected spelling of 'T ype' to 'Type' in the description field.
/*

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@nipunayf nipunayf changed the title Support for submodule types in the data mapper Support submodule types in the data mapper Oct 24, 2025
@nipunayf nipunayf merged commit ab94309 into ballerina-platform:1.2.x Oct 25, 2025
4 of 5 checks passed
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.

4 participants