We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
public class User { @JsonProperty("userId") private Integer id; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } ... }
The field is not renamed in the swagger doc.
In com/wordnik/swagger/converter/ModelPropertyParser.scala
try { val fieldAnnotations = getDeclaredField(this.cls, name).getAnnotations() var propAnnoOutput = processAnnotations(name, fieldAnnotations) var propPosition = propAnnoOutput("position").asInstanceOf[Int]
The propAnnoOutput from the field is not used to update the name.
The text was updated successfully, but these errors were encountered:
The work around:
diff --git a/modules/swagger-core/src/main/scala/com/wordnik/swagger/converter/ModelPropertyParser.scala b/modules/swagger-core/src/main/scala/com/wordnik/swagger/converter/ModelPropertyParser.scala index 30b7bab..9d183ec 100644 --- a/modules/swagger-core/src/main/scala/com/wordnik/swagger/converter/ModelPropertyParser.scala +++ b/modules/swagger-core/src/main/scala/com/wordnik/swagger/converter/ModelPropertyParser.scala @@ -92 +91,0 @@ class ModelPropertyParser(cls: Class[_], t: Map[String, String] = Map.empty) (im - if (name == null) name = originalName @@ -113,2 +112,3 @@ class ModelPropertyParser(cls: Class[_], t: Map[String, String] = Map.empty) (im - val fieldAnnotations = getDeclaredField(this.cls, name).getAnnotations() - var propAnnoOutput = processAnnotations(name, fieldAnnotations) + val fieldAnnotations = getDeclaredField(this.cls, originalName).getAnnotations() + + var propAnnoOutput = processAnnotations(originalName, fieldAnnotations) @@ -116,0 +117,3 @@ class ModelPropertyParser(cls: Class[_], t: Map[String, String] = Map.empty) (im + if (name == null || name.equals(originalName)) { + name = propAnnoOutput("name").asInstanceOf[String] + } @@ -133,0 +137,2 @@ class ModelPropertyParser(cls: Class[_], t: Map[String, String] = Map.empty) (im + if (name == null) name = originalName +
Sorry, something went wrong.
fix for #486, @JsonProperty not honored for property names
a56fd29
No branches or pull requests
The field is not renamed in the swagger doc.
In com/wordnik/swagger/converter/ModelPropertyParser.scala
The propAnnoOutput from the field is not used to update the name.
The text was updated successfully, but these errors were encountered: