FasterXML / jackson-databind

General data-binding package for Jackson (2.x): works on streaming API (core) implementation(s)
Apache License 2.0
3.53k stars 1.38k forks source link

JsonBackReference should respect JsonSerialize #1475

Closed coladict closed 7 years ago

coladict commented 7 years ago

When @JsonSerialize specifies a custom serializer in conjunction with @JsonBackReference, it should not be ignored, as the reference is obviously meant for use during deserialization with such an explicit definition.

This should apply when using @JsonSerialize(as/converter/using) and @JsonBackReference on the same element, as well as when using @JsonSerialize(contentAs/contentConverter/contentUsing) on the parent and @JsonBackReference on the child.

I have part of this working already in a patch, and it could be ready soon.

cowtowncoder commented 7 years ago

Ok. It would be great to first submit a unit test to show a simple example, but a fix is of course very valuable too. Thank you for reporting this.

cowtowncoder commented 7 years ago

Still... I am not 100% sure I follow: given that back-reference is never written out, how could/should it matter? Or perhaps you meant @JsonManagedReference which makes more sense?

cowtowncoder commented 7 years ago

Can not reproduce -- may be reopened with a reproducible test case (unit test).