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

Accept application/prs.hal-forms+json output is ignoring @JsonProperty renaming #1082

Open
marcuslange opened this issue Sep 19, 2019 · 0 comments

Comments

@marcuslange
Copy link

marcuslange commented Sep 19, 2019

1.0.0.RC2

When configured for HAL or HAL-FORMS

When request is sent using Accept application/hal+json

firstName is being converted to first_name as expected.

When request is send using Accept application/prs.hal-forms+json

HAL-FORMS _templates section is present, but properties are not converted (ex firstName is displayed). In this case other Jackson annotations are being ignored, @JsonInclude(Include.NON_EMPTY) is one example.

Example class

@Getter
public class User extends RepresentationModel<User> {
    @JsonProperty("first_name")
    private final String firstName;
    @JsonProperty("last_name")
    private final String lastName;
    @JsonProperty("email")
    private final String email;
    @JsonProperty("home_phone")
    private final String homePhone;
    @JsonProperty("cell_phone")
    private final String cellPhone;

   @JsonCreator
    public CreateUser(@JsonProperty("first_name") String firstName,
                      @JsonProperty("last_name") String lastName,
                      @JsonProperty("email") String email,
                      @JsonProperty("home_phone")  String homePhone,
                      @JsonProperty("cell_phone") String cellPhone) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.email = email;
        this.homePhone = homePhone;
        this.cellPhone = cellPhone;
    }
}
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

No branches or pull requests

1 participant