Description
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.