Closed
Description
I have a situation in which one of my setters has a @java.lang.Deprecated
annotation on an entity. The field itself does not have this annotation.
In swagger, in my schema/model, this fields ends up with the deprecated: true text. I did not expect that, and would like to avoid that.
public class DeprecatedEntity
{
@Schema(deprecated = false) // Does not work
private String myNonDeprecatedField;
public String getMyNonDeprecatedField()
{
return myNonDeprecatedField;
}
@Schema(deprecated = false) // Does not work
@Deprecated
public DeprecatedEntity setMyNonDeprecatedField(String myNonDeprecatedField)
{
this.myNonDeprecatedField = myNonDeprecatedField;
return this;
}
}
I have tried overriding this with @Schema(deprecated = false)
on both the setter and the field, but this does not seem to work. I assume that processing @Deprecated
is done by the springdoc library, although I'm not sure what part is springdoc and what part is swagger.
Using springdoc-openapi 1.4.1. See attached project.
springdoc-issue-override-deprecated.zip