Skip to content

Comments

Support source generation for local connectors#436

Merged
nipunayf merged 3 commits intoballerina-platform:1.2.xfrom
KavinduZoysa:local-connector-source
Oct 26, 2025
Merged

Support source generation for local connectors#436
nipunayf merged 3 commits intoballerina-platform:1.2.xfrom
KavinduZoysa:local-connector-source

Conversation

@KavinduZoysa
Copy link
Contributor

Copy link
Contributor

@madushajg madushajg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@madushajg madushajg requested a review from Copilot October 26, 2025 05:16
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 pull request adds support for source generation for local connectors in the flow model generator. The changes enable the system to handle connectors that are defined locally within a project rather than being imported from external packages.

Key Changes

  • Introduced new test resources for local connector scenarios with comprehensive Ballerina code examples
  • Fixed import delimiter parsing from semicolon to comma in Property class
  • Added parameter properties handling in NewConnectionBuilder for local connectors
  • Cleaned up test configurations by removing redundant import fields

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
NewConnectionBuilder.java Added setParameterProperties method to handle parameter properties for local connectors
Property.java Fixed import statement delimiter from semicolon to comma
new_connection11.json New test configuration for connection source generation
config1.json Removed redundant imports field
new_local_connection.json New test configuration for local connector template
local_connector/* New test resources with sample Ballerina code for local connector scenarios
new_connection-*.json Cleaned up redundant imports fields in multiple connector configurations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines -259 to -261
"imports": {
"sql": "ballerina/sql"
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the new connection form, and we are getting the following diagnostics when this is removed:

[Trace - 11:12:45 AM] Received response 'expressionEditor/diagnostics - (1599)' in 538ms.
Result: {
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 24,
                    "character": 0
                },
                "end": {
                    "line": 24,
                    "character": 18
                }
            },
            "severity": 1,
            "code": "BCE2000",
            "message": "undefined module 'sql'"
        },
        {
            "range": {
                "start": {
                    "line": 24,
                    "character": 0
                },
                "end": {
                    "line": 24,
                    "character": 18
                }
            },
            "severity": 1,
            "code": "BCE2069",
            "message": "unknown type 'ConnectionPool'"
        }
    ]
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you getting this when adding the connectionPool argument to the connection initializer?

import ballerinax/mysql;
import ballerinax/mysql.driver as _;

final mysql:Client mysqlClient = check new (connectionPool = {
    maxOpenConnections: 0,
    maxConnectionLifeTime: 0.0d,
    minIdleConnections: 0
});

this.imports = new HashMap<>();
}
String[] importList = importStatements.split(";");
String[] importList = importStatements.split(",");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this be sufficient? Do we have to remove the imports from each property?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done that in setParameterProperties when adding to imports

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t understand why we’re sacrificing reusability to special-case the new connection builder. Why aren’t these changes applicable to action calls?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nipunayf
Copy link
Contributor

The changes affect the expression editor services, but several other classes follow the same pattern. We need to review all related classes and implement a proper solution. Merging for now.

@nipunayf nipunayf merged commit dc66b8d into ballerina-platform:1.2.x Oct 26, 2025
3 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.

3 participants