Skip to content

Commit bc4d9f9

Browse files
authored
Merge pull request #9597 from vmmp159/master
[Spring] [9596] XmlWrapped ignored in the type Array
2 parents 57cf5d0 + 40fa134 commit bc4d9f9

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

modules/swagger-codegen/src/main/resources/JavaSpring/model.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import javax.validation.constraints.*;
1515
{{#withXml}}
1616
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
1717
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
18+
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
1819
{{/withXml}}
1920
{{/jackson}}
2021
{{#withXml}}

modules/swagger-codegen/src/main/resources/JavaSpring/pojo.mustache

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,16 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
2424
{{/items.isEnum}}
2525
{{#jackson}}
2626
@JsonProperty("{{baseName}}"){{#withXml}}
27-
@JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"){{/withXml}}
28-
{{/jackson}}
27+
{{^isXmlWrapped}}
28+
@JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
29+
{{/isXmlWrapped}}
30+
{{#isXmlWrapped}}
31+
// Is a container wrapped={{isXmlWrapped}}
32+
// items.xmlName={{items.xmlName}}
33+
@JacksonXmlProperty({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#items.xmlName}}{{items.xmlName}}{{/items.xmlName}}{{^items.xmlName}}{{items.baseName}}{{/items.xmlName}}")
34+
@JacksonXmlElementWrapper(useWrapping = {{isXmlWrapped}}, {{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
35+
{{/isXmlWrapped}}
36+
{{/withXml}}{{/jackson}}
2937
{{#gson}}
3038
@SerializedName("{{baseName}}")
3139
{{/gson}}

0 commit comments

Comments
 (0)