Skip to content

Comments

[1.2.x] Support for missing primitive types in data mapper model#425

Merged
nipunayf merged 5 commits intoballerina-platform:1.2.xfrom
KavinduZoysa:support-other-types-dm-1-2-x
Oct 25, 2025
Merged

[1.2.x] Support for missing primitive types in data mapper model#425
nipunayf merged 5 commits intoballerina-platform:1.2.xfrom
KavinduZoysa:support-other-types-dm-1-2-x

Conversation

@KavinduZoysa
Copy link
Contributor

@KavinduZoysa KavinduZoysa commented Oct 24, 2025

Purpose

$title.

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 missing primitive types in the data mapper model, specifically handling specialized integer types (signed/unsigned 8/16/32-bit), byte, string:Char, and regexp types that were previously unsupported.

Key Changes:

  • Refactored primitive type handling to use a centralized mapping function
  • Added support for INT_SIGNED8/16/32, INT_UNSIGNED8/16/32, BYTE, STRING_CHAR, and REGEXP type kinds
  • Added test case to verify int:Signed32 type handling in data mapper

Reviewed Changes

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

File Description
ReferenceType.java Refactored primitive type detection and added support for missing primitive types including specialized integer types, byte, string:Char, and regexp
variable33.bal Added test source file demonstrating PurchaseDetails record with int:Signed32 field type
variable55.json Added test configuration file verifying int:Signed32 type appears correctly in data mapper model
DataMappingModelTest.java Added new test case reference for variable55.json to test suite

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

Comment on lines 343 to 390
case INT -> {
return "int";
}
case INT_SIGNED8 -> {
return "int:Signed8";
}
case INT_SIGNED16 -> {
return "int:Signed16";
}
case INT_SIGNED32 -> {
return "int:Signed32";
}
case INT_UNSIGNED8 -> {
return "int:Unsigned8";
}
case INT_UNSIGNED16 -> {
return "int:Unsigned16";
}
case INT_UNSIGNED32 -> {
return "int:Unsigned32";
}
case STRING -> {
return "string";
}
case FLOAT -> {
return "float";
}
case BOOLEAN -> {
return "boolean";
}
case NIL -> {
return "()";
}
case DECIMAL -> {
return "decimal";
}
case BYTE -> {
return "byte";
}
case STRING_CHAR -> {
return "string:Char";
}
case NEVER -> {
return "never";
}
default -> {
return null;
}
Copy link

Copilot AI Oct 24, 2025

Choose a reason for hiding this comment

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

[nitpick] The switch statement uses block syntax unnecessarily. Consider using simplified arrow syntax (e.g., case INT -> \"int\";) to reduce verbosity and improve readability, as each case only returns a single value.

Suggested change
case INT -> {
return "int";
}
case INT_SIGNED8 -> {
return "int:Signed8";
}
case INT_SIGNED16 -> {
return "int:Signed16";
}
case INT_SIGNED32 -> {
return "int:Signed32";
}
case INT_UNSIGNED8 -> {
return "int:Unsigned8";
}
case INT_UNSIGNED16 -> {
return "int:Unsigned16";
}
case INT_UNSIGNED32 -> {
return "int:Unsigned32";
}
case STRING -> {
return "string";
}
case FLOAT -> {
return "float";
}
case BOOLEAN -> {
return "boolean";
}
case NIL -> {
return "()";
}
case DECIMAL -> {
return "decimal";
}
case BYTE -> {
return "byte";
}
case STRING_CHAR -> {
return "string:Char";
}
case NEVER -> {
return "never";
}
default -> {
return null;
}
case INT -> "int";
case INT_SIGNED8 -> "int:Signed8";
case INT_SIGNED16 -> "int:Signed16";
case INT_SIGNED32 -> "int:Signed32";
case INT_UNSIGNED8 -> "int:Unsigned8";
case INT_UNSIGNED16 -> "int:Unsigned16";
case INT_UNSIGNED32 -> "int:Unsigned32";
case STRING -> "string";
case FLOAT -> "float";
case BOOLEAN -> "boolean";
case NIL -> "()";
case DECIMAL -> "decimal";
case BYTE -> "byte";
case STRING_CHAR -> "string:Char";
case NEVER -> "never";
default -> null;

Copilot uses AI. Check for mistakes.
@KavinduZoysa KavinduZoysa force-pushed the support-other-types-dm-1-2-x branch from 45cc7e8 to 0d32b69 Compare October 24, 2025 14:04
@nipunayf nipunayf merged commit fcb95d8 into ballerina-platform:1.2.x Oct 25, 2025
3 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.

5 participants