Skip to content

[Ballerina][MI] Extract Default Values from Init Method Parameters #4558

@iamvirul

Description

@iamvirul

Description

Description

Default values specified for init method parameters (such as string serviceUrl = "https://api.openai.com/v1") should be extracted from the Ballerina source code and included in the generated UI schema. This allows users to see and use the default values in the Micro Integrator connector configuration UI.

Current Behavior

When an init method has parameters with default values, these default values are not captured in the generated UI schema. The UI shows empty default values and marks all parameters as required, even when they have default values in the source code.

Example:

public isolated function init(ConnectionConfig config, string serviceUrl = "https://api.openai.com/v1") returns error? {
    // ...
}

In this case, serviceUrl has a default value "https://api.openai.com/v1", but the generated UI schema shows:

  • defaultValue: ""
  • required: "true"

Expected Behavior

Default values from init method parameters should be extracted and included in the generated UI schema with the correct values.

Example Output:

{
  "name": "serviceUrl",
  "displayName": "serviceUrl",
  "inputType": "stringOrExpression",
  "defaultValue": "https://api.openai.com/v1",
  "required": "false",
  "helpTip": "",
  "validateType": ""
}

Version

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions