Skip to content

Comments

Add default value support#660

Merged
NipunaRanasinghe merged 34 commits intoballerina-platform:1.6.xfrom
samithkavishke:issue-2309
Feb 17, 2026
Merged

Add default value support#660
NipunaRanasinghe merged 34 commits intoballerina-platform:1.6.xfrom
samithkavishke:issue-2309

Conversation

@samithkavishke
Copy link
Contributor

@samithkavishke samithkavishke commented Jan 27, 2026

Purpose

Fixes: wso2/product-ballerina-integrator#2345, wso2/product-ballerina-integrator#1821, wso2/product-ballerina-integrator#827, wso2/product-ballerina-integrator#2012

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

image image

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

@LakshanWeerasinghe
Copy link
Contributor

@samithkavishke Your fix should fix this issue as well.

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 extracting and preserving default values for enum types in FTP service configurations. The changes implement a mechanism to parse enum member values from source code and correctly propagate them through the type system.

Changes:

  • Added enum member value extraction logic that parses syntax trees to retrieve actual enum values (e.g., FTP = "ftp" returns "ftp")
  • Created a public API in CommonUtils for extracting default values from symbols
  • Updated the Type model to handle enum default values in record fields
  • Updated FTP package version from 2.14.1 to 2.16.0
  • Updated test resource files with new package version icons

Reviewed changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
model-generator-commons/src/main/java/io/ballerina/modelgenerator/commons/FunctionDataBuilder.java Added extractEnumMemberValue method and enhanced getDefaultValue to resolve enum values from source
model-generator-commons/src/main/java/io/ballerina/modelgenerator/commons/CommonUtils.java Added public extractDefaultValue API that delegates to FunctionDataBuilder
misc/diagram-util/src/main/java/org/ballerinalang/diagramutil/connector/models/connector/Type.java Enhanced type system to extract and mark enum default values in record fields
misc/diagram-util/src/main/java/module-info.java Added dependency on model-generator-commons module
misc/diagram-util/build.gradle Added implementation dependency on model-generator-commons project
flow-model-generator/modules/flow-model-index-generator/src/main/resources/packages.json Updated FTP package version to 2.16.0
flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/TypesManagerService.java Updated API call to pass packageName parameter
service-model-generator/modules/service-model-generator-ls-extension/src/main/resources/service-index.sqlite Updated SQLite database with new service configurations
architecture-model-generator test resources Updated icon URLs for tcp, rabbitmq, kafka packages to reflect new versions

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

@samithkavishke samithkavishke changed the title Add default value support for FTP Add default value support Jan 29, 2026
@samithkavishke samithkavishke force-pushed the issue-2309 branch 2 times, most recently from 3ed6e7b to a58554f Compare January 30, 2026 02:15
Copy link
Contributor

@pasindufernando1 pasindufernando1 left a comment

Choose a reason for hiding this comment

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

LGTM

@samithkavishke samithkavishke changed the base branch from 1.5.x to main February 2, 2026 07:29
@samithkavishke samithkavishke dismissed pasindufernando1’s stale review February 2, 2026 07:29

The base branch was changed.

@samithkavishke samithkavishke marked this pull request as draft February 2, 2026 07:55
@samithkavishke samithkavishke marked this pull request as ready for review February 2, 2026 08:02
@samithkavishke samithkavishke force-pushed the issue-2309 branch 3 times, most recently from e68edb9 to 8e7484a Compare February 2, 2026 08:43
Copy link
Contributor

@pasindufernando1 pasindufernando1 left a comment

Choose a reason for hiding this comment

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

LGTM

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

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


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

@samithkavishke samithkavishke marked this pull request as ready for review February 17, 2026 02:35
@samithkavishke samithkavishke marked this pull request as draft February 17, 2026 09:15
@samithkavishke
Copy link
Contributor Author

Currently, this implementation partially fixes the issue. However, it still needs to handle the default value resolution for cached BIR package resolutions. This issue occurs when the user navigates to a client that is already added to the code and tries to configure it, the default values shown are still incorrect.

@samithkavishke samithkavishke marked this pull request as ready for review February 17, 2026 16:13
Copy link
Contributor

@NipunaRanasinghe NipunaRanasinghe left a comment

Choose a reason for hiding this comment

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

As discussed offline with @samithkavishke, there is still an issue with resolving default values from cached modules. At the moment, the current BIR does not provide enough information to reliably extract default values from the semantic model.

That said, the implementation works for the majority of cases (e.g., new connection creation), and we already have proper fallbacks in place for scenarios where this fails (which matches the current behavior).

So we are merging these changes now, and we’ll address the remaining edge cases in a follow-up PR.

@NipunaRanasinghe NipunaRanasinghe merged commit dfc82a8 into ballerina-platform:1.6.x Feb 17, 2026
4 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.

Ambiguous optional value selection for FTP in record Configuration

6 participants