Skip to content

Xml inconsistency #10022

@timotheeguerin

Description

@timotheeguerin

Our guide shows contradicting information, we also not fully sure of the right behavior for our emitters

Example 1.1 shows this

@encodedName("application/xml", "XmlPet")
model Pet {
  @Xml.unwrapped
  tags: string[];
}
<XmlPet>
  <tags>abc</tags>
  <tags>def</tags>
</XmlPet>

here what it means is that unwrapped takes the name of the property as the wrapper for each item

but then in 2.1 we have

@encodedName("application/xml", "XmlPet")
model Pet {
 @Xml.unwrapped
 tags: Tag[];
}
@encodedName("application/xml", "XmlTag")
model Tag {
 name: string;
}
<XmlPet>
  <XmlTag>
    <name>string</name>
  </XmlTag>
</XmlPet>

where now the name of the type stays but the property was ignored

2.2 also just is wrong
2.3 goes back to the same behavior as 1.1 the name of the property is used as the item tag

@encodedName("application/xml", "XmlPet")
model Pet {
 @encodedName("application/xml", "ItemsTag")
 @Xml.unwrapped
 tags: Tag[];
}
@encodedName("application/xml", "XmlTag")
model Tag {
 name: string;
}
<XmlPet>
  <ItemsTag>
    <name>string</name>
  </ItemsTag>
</XmlPet>

I believe one of the thing I was basing our behavior on is how it behaves in c# with the equivalent attribute and from what I can see the case where we use the property name as the item tag is what is correct. Which means unwrapped != means don't wrap in a property tag but a little different, any opinions?

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions