spring-bot icon indicating copy to clipboard operation
spring-bot copied to clipboard

Template Generation Should Follow Jackson Conventions

Open robmoffat opened this issue 4 years ago • 2 comments

Template generation currently inspects the fields on an object. It would make more sense if it used Jackson's approach of inspecting getters / setters.

Also ideally, if the user provides the annotations to inspect fields instead / ignore fields / whatever, then we should match this on the template too.

Reason is, then we can do a better job of mapping the form response to the JSON object.

robmoffat avatar Sep 30 '21 10:09 robmoffat

So, the reason for doing this is that our templates would then match up with the JSON - at the moment, by adding Jackson annotations to fields, it would be possible for the JSON to be different to the template. Also, JSON is based on getters, whereas the template is based on the bean fields.

To make this change, we would need to modify AbstractComplexTypeConverter.getFields method, so that it called off to Jackson to get a list of the fields we needed.

robmoffat avatar Feb 01 '22 09:02 robmoffat

This is a good first issue if you are quite familiar with how Jackson works

robmoffat avatar Mar 30 '22 08:03 robmoffat