Populate xsi:type attribute on toXML(...)#518
Merged
eed3si9n merged 2 commits intoeed3si9n:masterfrom Oct 29, 2019
nezasa:type_attribute
Merged
Populate xsi:type attribute on toXML(...)#518eed3si9n merged 2 commits intoeed3si9n:masterfrom nezasa:type_attribute
eed3si9n merged 2 commits intoeed3si9n:masterfrom
nezasa:type_attribute
Conversation
added 2 commits
October 29, 2019 11:29
eed3si9n
approved these changes
Oct 29, 2019
Owner
eed3si9n
left a comment
There was a problem hiding this comment.
Thanks! This makes more sense.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
I have an example here that reproduces the problem: https://github.com/abestel/scalaxb-failure/tree/bug/type_attribute
Basically, the WSDL defines types as:
So I have
ServiceRequest<-MyRequest<-MySubRequest.The inheritance is expressed as
MyRequestable=MyRequest+MySubRequestServiceRequestable=ServiceRequest+MyRequestableThe generated formats are:
Here is a very simple example to see the issue:
The expected output would be:
The issue is that
xsi:type="MyRequest"is not present in the generated XML with the current version of ScalaXB.Indeed, step by step, we have the following:
DefaultComtestgenerated_ServiceRequestableFormat#writes, we match oncase x: com.test.generated.MyRequestableand call anothertoXMLwithtypeAttribute=trueDefaultComtestgenerated_MyRequestableFormat#writes, we match oncase x: com.test.generated.MyRequestand overridetypeAttributetofalseProposal
Actually use the
typeAttributethat is propagated. Indeedwritestakes it as an argument, so for traits we can just reuse the value for default cases.The generated code would be
In that case, the
typeAttribute=truefrom step (1) would be reused in step (2) and the typeAttribute would actually be written.The behavior of an operation taking a
MyRequestablewould not change (thetypeAttributewould not be written in that case).Note
Should solve #364 and I got inspired by #508