FasterXML / jackson-annotations

Core annotations (annotations that only depend on jackson-core) for Jackson data processor
https://github.com/FasterXML/jackson
Apache License 2.0
1.03k stars 330 forks source link

Make it possible to use @JsonView on method parameters #48

Closed sdeleuze closed 9 years ago

sdeleuze commented 9 years ago

In order to continue the recent improvements we have done in Spring's Jackson integration, we would like to add support for @JsonView deserialization on request bodies as described in this issue.

The issue we have is that @JsonView only targets ElementType.METHOD and ElementType.FIELD. Would you consider adding ElementType.PARAMETER in order to allow us to support this kind of use case?

@RequestMapping(value = "/persons", consumes = APPLICATION_JSON_VALUE, method = RequestMethod.POST)
public ResponseEntity<Person> savePerson(@JsonView(View.Summary.class) @RequestBody Person p)
{
    return new ResponseEntity<>(personRepository.save(p), HttpStatus.OK);
}
cowtowncoder commented 9 years ago

That sounds reasonable to me, yes, I can make the change.

sdeleuze commented 9 years ago

Awesome, thanks!