Support source generation for local connectors#436
Support source generation for local connectors#436nipunayf merged 3 commits intoballerina-platform:1.2.xfrom
Conversation
There was a problem hiding this comment.
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.
...-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/Property.java
Show resolved
Hide resolved
...rator-ls-extension/src/test/resources/node_template/source/local_connector/Dependencies.toml
Outdated
Show resolved
Hide resolved
| "imports": { | ||
| "sql": "ballerina/sql" | ||
| }, |
There was a problem hiding this comment.
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'"
}
]
}
There was a problem hiding this comment.
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(","); |
There was a problem hiding this comment.
Won't this be sufficient? Do we have to remove the imports from each property?
There was a problem hiding this comment.
I have done that in setParameterProperties when adding to imports
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Do you suggest to do it here?
|
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. |
Purpose
Addresses wso2/product-ballerina-integrator#1603