diff --git a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache index 645a331c704..ec08ee907bd 100644 --- a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache @@ -33,7 +33,8 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela {{#isContainer}} {{#isXmlWrapped}} // items.xmlName={{items.xmlName}} - @JacksonXmlElementWrapper(useWrapping = {{isXmlWrapped}}, {{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#items.xmlName}}{{items.xmlName}}{{/items.xmlName}}{{^items.xmlName}}{{items.baseName}}{{/items.xmlName}}") + @JacksonXmlElementWrapper(useWrapping = {{isXmlWrapped}}, {{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + @JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#items.xmlName}}{{items.xmlName}}{{/items.xmlName}}{{^items.xmlName}}{{baseName}}{{/items.xmlName}}") {{/isXmlWrapped}} {{/isContainer}} {{/withXml}} diff --git a/samples/client/petstore/java/resttemplate-withXml/.swagger-codegen/VERSION b/samples/client/petstore/java/resttemplate-withXml/.swagger-codegen/VERSION index 52f864c9d49..0443c4ad098 100644 --- a/samples/client/petstore/java/resttemplate-withXml/.swagger-codegen/VERSION +++ b/samples/client/petstore/java/resttemplate-withXml/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.10-SNAPSHOT \ No newline at end of file +2.4.16-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/List.md b/samples/client/petstore/java/resttemplate-withXml/docs/List.md new file mode 100644 index 00000000000..a96936fbf3f --- /dev/null +++ b/samples/client/petstore/java/resttemplate-withXml/docs/List.md @@ -0,0 +1,10 @@ + +# List + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_123List** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/model/List.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/model/List.java new file mode 100644 index 00000000000..b97eb45decf --- /dev/null +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/model/List.java @@ -0,0 +1,98 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.*; +import javax.xml.bind.annotation.*; + +/** + * List + */ + +@XmlRootElement(name = "List") +@XmlAccessorType(XmlAccessType.FIELD) +@JacksonXmlRootElement(localName = "List") +public class List { + @JsonProperty("123-list") + @JacksonXmlProperty(localName = "123-list") + @XmlElement(name = "123-list") + private String _123List = null; + + public List _123List(String _123List) { + this._123List = _123List; + return this; + } + + /** + * Get _123List + * @return _123List + **/ + @ApiModelProperty(value = "") + public String get123List() { + return _123List; + } + + public void set123List(String _123List) { + this._123List = _123List; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + List list = (List) o; + return Objects.equals(this._123List, list._123List); + } + + @Override + public int hashCode() { + return Objects.hash(_123List); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class List {\n"); + + sb.append(" _123List: ").append(toIndentedString(_123List)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/model/Pet.java index c6a818a8b35..be7d158a9eb 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/model/Pet.java @@ -52,7 +52,8 @@ public class Pet { @JsonProperty("photoUrls") // items.xmlName= - @JacksonXmlElementWrapper(useWrapping = true, localName = "photoUrls") + @JacksonXmlElementWrapper(useWrapping = true, localName = "photoUrl") + @JacksonXmlProperty(localName = "photoUrls") // Is a container wrapped=true // items.name=photoUrls items.baseName=photoUrls items.xmlName= items.xmlNamespace= // items.example= items.type=String @@ -62,7 +63,8 @@ public class Pet { @JsonProperty("tags") // items.xmlName= - @JacksonXmlElementWrapper(useWrapping = true, localName = "tags") + @JacksonXmlElementWrapper(useWrapping = true, localName = "tag") + @JacksonXmlProperty(localName = "tags") // Is a container wrapped=true // items.name=tags items.baseName=tags items.xmlName= items.xmlNamespace= // items.example= items.type=Tag