Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for @JsonBackReference #3682

Open
ccarv opened this issue Aug 19, 2020 · 0 comments · May be fixed by #4699
Open

Support for @JsonBackReference #3682

ccarv opened this issue Aug 19, 2020 · 0 comments · May be fixed by #4699

Comments

@ccarv
Copy link

ccarv commented Aug 19, 2020

I have a field annotated with @JsonBackReference, which is the proper way to handle circular references in your Java objects using Jackson. Traditionally, you would normally annotate with @JsonIgnore but this is not recommended by Jackson. In springdoc, it is recommended to use @Schema(hidden = true) to suppress specific fields but this is ignored when a Jackson annotation is present. See this issue for more details.

Steps To Reproduce
Declare the following annotations at the field level:

  • @JsonBackReference
  • @Schema(hidden = true)

Expected behavior
The field should not be present when viewing models in the swagger UI.

Additional context
It might be worth noting that Jackson recommends using @JsonManagedReference and @JsonBackReference to handle circular references, and thus should be supported by swagger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant