Skip to content

Commit

Permalink
Merge pull request #10333 from colorcodecanvas/9845
Browse files Browse the repository at this point in the history
Wrong generation of @JacksonXmlElementWrapper annotation
  • Loading branch information
HugoMario authored Aug 31, 2020
2 parents 4677fea + 5ebcf75 commit 99a4e2e
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.10-SNAPSHOT
2.4.16-SNAPSHOT
10 changes: 10 additions & 0 deletions samples/client/petstore/java/resttemplate-withXml/docs/List.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# List

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_123List** | **String** | | [optional]



Original file line number Diff line number Diff line change
@@ -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 ");
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 99a4e2e

Please sign in to comment.