Skip to content
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

Fix for @JsonProperty annotation #441

Closed
wants to merge 1 commit into from
Closed

Fix for @JsonProperty annotation #441

wants to merge 1 commit into from

Conversation

kendzi
Copy link

@kendzi kendzi commented Jan 23, 2014

The same change as described in #440 but to develop branch:

  1. Annotation from field are not read when @JsonProperty annotation is on getter, because it take name from annotation on getter and search for wrong field name.

Current model of parsing annotation on Model class is as follow:

  • Read annotations from getter, if there is @JsonProperty replace getter name with value of annotation
  • Read annotation from field. Field name is resolved from getter name or wrongly taken from value of @JsonProperty if it existed on getter,

Example:

@JsonProperty("access_token")
public String getAccessToken() {
 return accessToken;
}

It is try to find property with name access_token not accessToken.

  1. It is not possible to use annotation @JsonProperty on field, only on method, because name from getter is resolved in first place:
@JsonProperty("access_token")
@ApiModelProperty(value = "The access token.", required = true)
private String accessToken;

I add patch which solve both problems.

@fehguy
Copy link
Contributor

fehguy commented Mar 20, 2014

I believe this was merged manually.

@fehguy fehguy closed this Mar 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants