Skip to content

Deserialize JSON with path param #940

Open
@nykolaslima

Description

@nykolaslima

If we have a resource class like this:

public class UserResource {
 private long id;
 private long accountId;
 private String name;
}

If we want to populate id and name fields from JSON and accountId from request param, this doesn't work:

@Post("/accounts/{user.accountId}
@Consumes("application/json")
public void addUser(User user) {
//user.getAccountId() will be null
}

I believe that we should deserialize the class from the JSON and if there is any path param, we should override the value in the deserialized resource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions