ballerina-platform / ballerina-library

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

Invalid error message in Union types for `data.jsondata` module #6928

Open SasinduDilshara opened 2 months ago

SasinduDilshara commented 2 months ago

code

import ballerina/data.jsondata;
import ballerina/io;

type A43 record {|record{|int[]|int \#content; string...;|} B;|}|record {|int[]|record{|string \#content; string...;|} B;|};

public function main() {
    A43|error a = jsondata:parseAsType({B: [1,2,3]});
    io:println(a);
}

Output

error Error ("incompatible expected type 'xml_data_prod:A43' for value '{"B":[1,2,3]}'")

But this should be mapped with record {|int[]|record{|string \#content; string...;|} B;|}