Я нашел метод сделать это, описанный здесь:
https://github.com/domaindrivendev/Swas ... /issues/73
Но Похоже, это устарело в текущей версии Swashbuckle.
Метод, рекомендуемый для старой версии Swashbuckle, использует реализацию IModelFilter следующим образом:
Код: Выделить всё
public class OmitIgnoredProperties : IModelFilter
{
public void Apply(DataType model, DataTypeRegistry dataTypeRegistry, Type type)
{
var ignoredProperties = … // use reflection to find any properties on
// type decorated with the ignore attributes
foreach (var prop in ignoredProperties)
model.Properties.Remove(prop.Name);
}
}
SwaggerSpecConfig.Customize(c => c.ModelFilter());
Подробнее здесь: https://stackoverflow.com/questions/410 ... y-on-model
Мобильная версия