The property marked with JsonIgnore is still shown in the Swagger UI documentation for the web API

I use the Swashbuckle package, which integrates swagger with a Web API project. I want to hide a property marked as Ignored in the documentation. I tried to use different methods like IgnoreDataMember, DataContract and DataMember, JsonIgnore or XmlIgnore, but nothing works with swagger ui.

However, in the default API documentation, it works as expected. This is what my model looks like:

public partial class Model : BaseSettingsModel
{
    public string ReceiptTitle { get; set; }

    [IgnoreDataMember]
    public FieldsEnum Fields { get; set; }

    public string DisplayFields { get; set; }
}
+4
source share
1 answer

Moving from version 1.3.0 to 1.3.6 will solve this for you. At least @JsonIgnoreand @XmlTransientobserved.

JsonIgnore JSON.net NuGet.

+2

All Articles