You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I have two entities which have a bidirectional reference between each other (OneToMany and ManyToOne) and I use swagger to generate my DTOs.
I want to annotate my variables with @JsonBackReference and @JsonManagedReference.
To achieve this, I added inside the pojo.mustache, in the #vars loop the following fragment:
{{#vendorExtensions.x-java-field-annotation}}
{{{.}}}
{{/vendorExtensions.x-java-field-annotation}}
And in my *.yaml, I added the following for two variables:
In TaskDto definition:
taskList:
type: object
$ref: '#/definitions/TaskListDto'
x-java-field-annotation:
- "@com.fasterxml.jackson.annotation.JsonBackReference"
In TaskListDto definition:
tasks:
type: array
items:
$ref: '#/definitions/TaskDto'
x-java-field-annotation:
- "@com.fasterxml.jackson.annotation.JsonManagedReference"
When I generate the code, I can see the annotation only on the variable tasks and on the taskList nothing. I'm using swagger-codegen-2.4.24
Any idea please about what I'm doing wrong ?
Best regards,
Ali
Beta Was this translation helpful? Give feedback.
All reactions