Forum Discussion

Anouk's avatar
Anouk
Occasional Visitor
5 months ago

Representing Xml array of strings (or primatives)

It's clear from the documentation that if you have an Array with objects you can represent it in the right way (e.g. <Addresses><Address></Address></Addresses>) by adding: xml: wrapped : true and providing a name to the item scheme. However, what if the array is of primitive type or string?

I'm trying to create a SchemaFilter to easily provide the right examples in Swagger when selecting the xml type. I am getting the information for the formatting from xml attributes. For arrays that have objects this is doable as I can easily set the schema name of the object. However, there is no schema for a string so I cannot set the name. The closest I can get is <Addresses><Addresses> </Addresses></Addresses>. Is there a way to work around the setting of the name but still have the same effect of having a different wrapped name?

No RepliesBe the first to reply