spring-projects / spring-projects/spring-hateoas

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

Open
#1,082 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
476
PR merge metrics
No merged PRs in 30d

Description

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;
    }
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by locating the HAL-FORMS serialization path for application/prs.hal-forms+json and compare it with application/hal+json using the User example; done means @JsonProperty renaming and annotations such as @JsonInclude are respected in the _templates section.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.