Skip to content

Commit ae6c71b

Browse files
author
vmmeneses
committed
In the language Spring have one problem in the name generated in the type Array, because in this moment ignore the annotation Wrapped, for this reason generated this Fixed.
1 parent 6f7f156 commit ae6c71b

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)