Say I want to model this:
<?xml version="1.0" encoding="UTF-8"?>
<something>
<list>
<entry value="bob" />
<entry value="foo" />
</list>
</something>
With this kind of modeling (getters and what-not are generated with Lombok, but I left these details out for the purpose of conciseness):
@XmlRootElement(name = "something")
public class Something {
@ArraySchema(
arraySchema = @Schema(name = "list"),
schema = @Schema(implementation = Entry.class, name = "entry")) // this obviously doesn't work
List<Entry> entries = new ArrayList<>();
}
public class Entry {
@XmlAttribute
String value;
}
My usage of @ArraySchema
is clearly wrong because this is what Swagger generates for me when I press Try it out
:
<?xml version="1.0" encoding="UTF-8"?>
<something>
<entry value="string">
</entry>
</something>
The documentation mentions xml/wrapped
, and so does this SO answer, but nowhere can I find the information about how to inject that kind of information using the annotations.