Assume that I have want to capture a bunch of request parameters as one object like this:
@GetMapping("/")
public List<Item> filterItems(@Valid Filter filter){}
and the Filter class looks like this:
class Filter {
public String status;
public String start;
public String end;
}
Now in the API the request parameter name is state instead of status like this ?state=A&start=1&end=2. How do I make these request parameters to map to my Filter object without having to rename status? I know if I have @RequestParam("state") String status it would work but I want it to be part of the request object.
I tried adding @JsonProperty('state') on the field but it didn't work.