-
Notifications
You must be signed in to change notification settings - Fork 65
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
Support union type as expected type for data.xmldata
module.
#6596
Support union type as expected type for data.xmldata
module.
#6596
Comments
In the xml, the content type is always string, but in the In the JSON, string source must be converted to string always. If the expected type is non-string for string literal then it is an error. But we have to allow this for xmldata module hence we have to introduce another option |
While working on this found a blocker #6659. I will continue this once fix the issue. |
This issue is fixed with ballerina-platform/module-ballerina-data.xmldata#26 |
Ballerina types represents the XSD instead of a particular XML. Hence we have to support the complex union type cases which are possible in the XSD. Currently preparing the doc for this. |
According to our offline discussion, we concluded that we should support union types. The reason is that the data.xmldata module takes an XML source and converts it to a Ballerina record type. Our concern should be whether the provided source can be converted to the expected type. Case 1: Union case without namespace Sample 1:
Ballerina types => Option 1:
Option 2:
Given the above sample, both option 1 and option 2 are valid expected types. The module should allow both cases, but for the XSD of the above XML instance, option 2 is the one we have to generate. At the moment, this needs to be considered when Ballerina supports XSD to Ballerina record generation. Case 2: Union case with namespace
Option 1:
Option 2:
If we take option 1, it allows you to add sequences of ns1:port and ns2:port. Option 2 allows only one of each of those elements. However, both are valid expected types for the provided XML sample. As mentioned above, this is a concern when generating Ballerina records from the XSD and is not part of this module. Hence I will resume the union type support. Reference: https://docs.google.com/document/d/1fE6SjAznfFJGMoDzjVTT84qxA5QmiR37C_ulHtKOyv0/edit?usp=sharing |
Description:
$title
Describe your task(s)
Related Issues (optional):
Suggested Labels (optional):
Suggested Assignees (optional):
The text was updated successfully, but these errors were encountered: