-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong generation of @JacksonXmlElementWrapper annotation #10333
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5d00b34
Wrong generation of @JacksonXmlElementWrapper annotation
sanjeevgiri 358e5a4
Merge remote-tracking branch '9845/master' into 9845
sanjeevgiri 93f4f00
Merge branch 'master' into 9845
sanjeevgiri 588276b
Merge branch 'master' into 9845
sanjeevgiri 5ff87d4
Merge branch 'master' into 9845
sanjeevgiri 60a9ac3
Merge branch '9845' of https://github.com/colorcodecanvas/swagger-cod…
sanjeevgiri 5ebcf75
ran ./bin/java-petstore-resttemplate-withxml.sh to highlight differen…
sanjeevgiri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
samples/client/petstore/java/resttemplate-withXml/.swagger-codegen/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
10
samples/client/petstore/java/resttemplate-withXml/docs/List.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
# List | ||
|
||
## Properties | ||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**_123List** | **String** | | [optional] | ||
|
||
|
||
|
98 changes: 98 additions & 0 deletions
98
...client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/model/List.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "); | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,8 @@ public class Pet { | |
|
||
@JsonProperty("photoUrls") | ||
// items.xmlName= | ||
@JacksonXmlElementWrapper(useWrapping = true, localName = "photoUrls") | ||
@JacksonXmlElementWrapper(useWrapping = true, localName = "photoUrl") | ||
@JacksonXmlProperty(localName = "photoUrls") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
// 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 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JacksonXmlElementWrapper
should use theswaggerArrayProperty.xml.name
as its local name instead ofswaggerArrayProperty.items.xml.name
In order to customize the name for the wrapped xml element,
JacksonXmlProperty
annotation also must be included.