Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Incorrect handling of reserved keyword in Ballerina data mapping generation. #43620

Open
VellummyilumVinoth opened this issue Nov 20, 2024 · 0 comments
Labels
needTriage The issue has to be inspected and labeled manually Type/Bug userCategory/Compilation

Comments

@VellummyilumVinoth
Copy link

Description

When generating data mappings in Ballerina, the version field is incorrectly treated as a reserved keyword. Instead of generating the mapping as version: patient.version, the system produces an incorrect mapping like 'version: patient.'version, which is syntactically invalid. This causes the code to fail during execution or compilation.

Steps to Reproduce

1. Define Ballerina code

public function mapPatientToUsCore(Patient patient) returns Patient => {
   
};

public type Patient record {
    string patientType;
    string patientId;
    string version;
};

2. Generate data mappings using the defined structure.

3. Observe that the generated mapping incorrectly escapes the version field as 'version: patient.'version instead of the correct format version: patient.version.

public function mapPatientToUsCore(Patient patient) returns Patient => {
    patientType: patient.patientType,
    patientId: patient.patientId,
    'version: patient.'version
};

Affected Version(s)

No response

OS, DB, other environment details and versions

No response

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@ballerina-bot ballerina-bot added needTriage The issue has to be inspected and labeled manually userCategory/Compilation labels Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needTriage The issue has to be inspected and labeled manually Type/Bug userCategory/Compilation
Projects
None yet
Development

No branches or pull requests

2 participants