Custom serializer not annotated on variable declaration for DTO-generated class #531
-
I have a DTO with the following annotation:
This references the subtotal field in my Entity, which is defined like this:
When the class gets generated, the variable is declared as private (no annotation), then exposed as public with the annotation.
This results in the following compiler error: Am I annotating in the DTO incorrectly? If not, is this a bug? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 8 replies
-
Yes, I remove the annotation of private field and move it to public property. This behavior affects kotlin serialization. is it? |
Beta Was this translation helpful? Give feedback.
-
If DTO language supports explicit annotation target like kotlin
Can it resolve problem? If yes, submit FR please. |
Beta Was this translation helpful? Give feedback.
-
I pulled down 0.8.126 this morning and I see that the private variables have gone away (good). But now how can I apply my custom serializer? I tried the various syntaxes discussed above but nothing makes its way onto the DTO... |
Beta Was this translation helpful? Give feedback.
-
Does the annotation move to generated DTO? |
Beta Was this translation helpful? Give feedback.
-
It cannot be reproduced, I validate it like this
|
Beta Was this translation helpful? Give feedback.
-
Oh, you said entity, not DTO. |
Beta Was this translation helpful? Give feedback.
-
Try |
Beta Was this translation helpful? Give feedback.
OK, now the DTO does not use the implicit backing field of kotlin, it uses explicit backing field whose name start with "_".
If this broken kotlin serializaton and there is no workaround, I will change the DTO to remove explicit backing field.
Howevery, I'm super busy now, please wait a few days.