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

Incorrect null value for xml attributes when the expected field type is an array #6926

Closed
SasinduDilshara opened this issue Aug 27, 2024 · 3 comments · Fixed by ballerina-platform/module-ballerina-data.xmldata#44
Assignees
Labels
module/data.xmldata Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Type/Bug

Comments

@SasinduDilshara
Copy link
Contributor

Code

import ballerina/data.xmldata;
import ballerina/io;

public function main() {
    xml a = xml `<a id="2">1</a>`;
    record {int[] id;}|error rec = xmldata:parseAsType(a);
    io:println(rec);
}

The output for the above code is {"id":null,"#content":1}.
It should be an error message like incompatible types

@SasinduDilshara
Copy link
Contributor Author

May be related to #6924

@SasinduDilshara
Copy link
Contributor Author

SasinduDilshara commented Aug 27, 2024

Similar issue is happen for following code as well.

A41|error a41 = xmldata:parseAsType(x4);
test:assertEquals(a41, {"B":{"#content":"Nested Content","b1":99,"b2":"45.67"}});

Copy link

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.

@gimantha gimantha added the Reason/EngineeringMistake The issue occurred due to a mistake made in the past. label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/data.xmldata Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Type/Bug
Projects
Archived in project
2 participants