Skip to content

Introduce mapping with transformation function API #275

Merged
KavinduZoysa merged 12 commits intoballerina-platform:1.2.xfrom
pasindufernando1:transformationFunction
Sep 4, 2025
Merged

Introduce mapping with transformation function API #275
KavinduZoysa merged 12 commits intoballerina-platform:1.2.xfrom
pasindufernando1:transformationFunction

Conversation

@pasindufernando1
Copy link
Contributor

@pasindufernando1 pasindufernando1 commented Sep 2, 2025

Copilot AI review requested due to automatic review settings September 2, 2025 11:21
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

Adds support for transformation functions in the data mapping functionality, which generates functions with expression bodies as opposed to custom functions with block bodies.

  • Introduces a new API endpoint transformationFunction that creates functions with expression bodies (e.g., => 0 for int, => "" for string)
  • Extends existing DataMapManager.genMappingFunction to support both custom functions and transformation functions based on a boolean flag
  • Adds comprehensive test coverage for different data types including records, arrays, and primitives

Reviewed Changes

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

Show a summary per file
File Description
testng.xml Registers new test class for transformation function testing
DataMappingTransformationFunctionTest.java Main test class with test cases for various data type mappings
DataMapperTransformFunctionRequest.java Request model for transformation function API
DataMapperService.java Adds new transformationFunction endpoint
DataMapManager.java Refactors function generation to support both custom and transformation functions
Test resources (*.json, *.bal) Test configurations and source files for various mapping scenarios

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@pasindufernando1 pasindufernando1 changed the title Transformation function Introduce new API for mapping with a transformation function Sep 2, 2025
@pasindufernando1 pasindufernando1 changed the base branch from main to 1.2.x September 3, 2025 09:26
@pasindufernando1 pasindufernando1 changed the title Introduce new API for mapping with a transformation function Introduce new API for mapping with a transformation function and refactor function name generation logic for custom/transformation functions Sep 3, 2025
@KavinduZoysa
Copy link
Contributor

@pasindufernando1 added a minor suggestion

@pasindufernando1 pasindufernando1 changed the title Introduce new API for mapping with a transformation function and refactor function name generation logic for custom/transformation functions Introduce new API for mapping with a transformation function Sep 3, 2025
@pasindufernando1 pasindufernando1 changed the title Introduce new API for mapping with a transformation function Introduce mapping with transformation function API Sep 3, 2025
@pasindufernando1 pasindufernando1 changed the title Introduce mapping with transformation function API Introduce mapping with transformation function API and refactor function name generation logic Sep 3, 2025
@pasindufernando1 pasindufernando1 changed the title Introduce mapping with transformation function API and refactor function name generation logic Introduce mapping with transformation function API Sep 3, 2025
@KavinduZoysa KavinduZoysa merged commit 25cb80d into ballerina-platform:1.2.x Sep 4, 2025
3 checks passed
@pasindufernando1 pasindufernando1 deleted the transformationFunction branch September 8, 2025 08:11
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.

5 participants