Swagger/OpenAPI definition:
I use Swashbuckle.AspNetCore v3.0.0 / Swagger-Ui v3.17.1
I need to exlude (i.e. do not show) model in Models list. As our partners do not use AspNet.Core, they don't need to know anything about IFormFile interface which is specific to AspNet.Core.
It will be very useful for us, to decorate the method parameter with some attribute to exclude IFormFile from rendering.
public async Task

For the specific example you gave, there's a broader issue for handling IFormFile parameters better on the backlog - #193
For the general case, you should just create a Document Filter (see readme) that removes the unwanted models from the Definitions dictionary:
// Startup.cs
services.AddSwaggerGen(c =>
{
...
c.DocumentFilter<RemoveBogusDefinitionsDocumentFilter>();
}
// RemoveBogusDefinitionsDocumentFilter.cs
public class RemoveBogusDefinitionsDocumentFilter : IDocumentFilter
{
public void Apply(SwaggerDocument swaggerDoc, DocumentFilterContext context)
{
swaggerDoc.Definitions.Remove("IFormFile");
}
}
Thanks, it helped. Just curious why Swashbuckle do not have an option for this?
For others looking for a solution that is more dynamic or generic, like the OP was originally hoping for, I've written a document filter which can access a custom attribute you can write using reflection and then remove the definitions which are a match (based on type name).
https://github.com/domaindrivendev/Swashbuckle/issues/178#issuecomment-546161898
Most helpful comment
For the specific example you gave, there's a broader issue for handling
IFormFileparameters better on the backlog - #193For the general case, you should just create a Document Filter (see readme) that removes the unwanted models from the
Definitionsdictionary: