Skip to content

Comments

Change the variable name of DATA_MAPPER_CREATION node#682

Merged
KavinduZoysa merged 2 commits intoballerina-platform:mainfrom
KavinduZoysa:fix-issue-2397
Feb 20, 2026
Merged

Change the variable name of DATA_MAPPER_CREATION node#682
KavinduZoysa merged 2 commits intoballerina-platform:mainfrom
KavinduZoysa:fix-issue-2397

Conversation

@KavinduZoysa
Copy link
Contributor

@KavinduZoysa KavinduZoysa commented Feb 9, 2026

Purpose

Addresses wso2/product-ballerina-integrator#2397

  • Purpose: Fixes issue #2397 by renaming and standardizing the variable used for DATA_MAPPER_CREATION nodes to improve naming clarity and consistency.

  • Key code changes:

    • Updated DataMapperCreationBuilder:
      • setConcreteTemplateData now passes TemplateContext into setMandatoryProperties.
      • setMandatoryProperties signature changed to accept TemplateContext first: (TemplateContext context, NodeBuilder nodeBuilder, String returnType).
      • Implementation refactored to source variable names from TemplateContext (dataVariable(..., context.getAllVisibleSymbolNames())) and simplified metadata/property handling.
    • Test/config updates:
      • Updated node template configs (data_mapper-creation.json and function-creation.json) to rename the variable label from "Result" to "Variable Name", adjust descriptions to "Name of the variable", and change the default value from "outputResult" to "var2".
  • Intent / outcome:

    • Refactor for clarity and consistency in variable naming and template data handling.
    • Improve integration with TemplateContext so available symbol names are used when constructing variable metadata.
  • Impact:

    • Public method signature changed (setMandatoryProperties) — callers must be updated to pass TemplateContext.
    • Tests/configs updated to reflect new label and default variable name.

@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Method signature of setMandatoryProperties was changed to accept a TemplateContext; the implementation now sources variable names via context (dataVariable) instead of hard-coded metadata chains. Two JSON test/config files updated to rename the variable label and change the default value.

Changes

Cohort / File(s) Summary
Core Method Refactor
flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/DataMapperCreationBuilder.java
Changed setMandatoryProperties signature to setMandatoryProperties(TemplateContext context, NodeBuilder nodeBuilder, String returnType). Replaced explicit hard-coded property construction with nodeBuilder.properties().dataVariable(null, context.getAllVisibleSymbolNames()) and adjusted metadata usage (OUTPUT_LABEL, getOutputDoc(), returnType/type handling).
Template/config updates
flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/data_mapper-creation.json, flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/function-creation.json
Updated variable metadata label from "Result" to "Variable Name", description from "Name of the result variable" to "Name of the variable", and default value changed from "outputResult" to "var2".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped through code, found context anew,
Replaced the hard chains with names that grew,
Labels now clearer, defaults set true,
A tiny refactor, tidy and few,
Happy rabbit, hopping through review.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete, providing only the Purpose section while omitting most required sections like Goals, Approach, User stories, Release note, and others specified in the template. Complete the PR description by filling in the remaining sections from the template: Goals, Approach, User stories, Release note, Documentation, and other relevant sections to provide comprehensive context.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating the variable name of the DATA_MAPPER_CREATION node, which is reflected across the modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

@KavinduZoysa Although the test case seems to be working fine, when I test with the custom jar of this PR branch, the fix seems to be not working. Can you double check this?

Image

@KavinduZoysa
Copy link
Contributor Author

@KavinduZoysa Although the test case seems to be working fine, when I test with the custom jar of this PR branch, the fix seems to be not working. Can you double check this?

Image

There should be an FE change along with this, but it has not released.

@KavinduZoysa KavinduZoysa merged commit 97d182a into ballerina-platform:main Feb 20, 2026
5 of 6 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.

2 participants