[BUG] isGetters of generated Java POJOs get skipped by Jackson when Optional booleans are used #375
Labels
acknowledged
Has been viewed by one of the maintainers and is ready for further work, discussion or other steps.
Describe the bug
If an Aspect model contains optional booleans, the Java POJO generator builds an accessor like for regular booleans using the isGetter naming scheme:
During visibility detection Jackson however does two checks:
boolean
(not the case)This results in the field becoming omitted from the payload.
Where
java-pojo-getter-lib.vm
Possible fixes
Multiple solutions exist to solve this issue:
getHidden
)@JsonProperty
annotation (simply with the same name applied) if theboolean
is wrapped inside anOptional
Most likely the first option is not what most people would expect. The second option might be confusing to see when someone looks at the generated code, because at first glance it does not make sense to apply a name "override" that does not change anything in terms of property naming.
Immediate fix
As of now, the problem is most easily fixed using a Jackson mixin with a custom Jackson Module:
The text was updated successfully, but these errors were encountered: