[1.2.x] Support for missing primitive types in data mapper model#425
Merged
nipunayf merged 5 commits intoballerina-platform:1.2.xfrom Oct 25, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
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; | ||
| } |
There was a problem hiding this comment.
[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; |
45cc7e8 to
0d32b69
Compare
LakshanWeerasinghe
approved these changes
Oct 24, 2025
madushajg
approved these changes
Oct 24, 2025
…na-language-server into support-other-types-dm-1-2-x
NipunaRanasinghe
approved these changes
Oct 24, 2025
This was referenced Oct 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
$title.