ballerina-platform / ballerina-library

The Ballerina Library
https://ballerina.io/learn/api-docs/ballerina/
Apache License 2.0
136 stars 64 forks source link

ParserAsType gives error when we disable the data projection for map types #7329

Closed lnash94 closed 1 week ago

lnash94 commented 2 weeks ago

Description

No response

Steps to Reproduce

The issue can be reproduced by executing(bal run) the below ballerina code, note: this error occurs for every data type with map, ex: map\, map\, map<byte[]>, etc.

[1] Ballerina code

import ballerina/data.jsondata;
public function main() returns error? {
    json a = {id: "chamil", values: {a: 2, b: 45, c: {x: "mnb", y: "uio"}}};
    map<json> _ = check jsondata:parseAsType(a, options = {allowDataProjection: false});
}

[2] Error

error: undefined field 'id'

Version

0.3.0-20241028-143400-903c253

Environment Details (with versions)

No response

github-actions[bot] commented 1 week ago

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.