How to ignore class typed propery from schema in swagger.json

Viewed 292

I am using ASP NET Core 5 and Swashbuckle 6.1.4

I configured new SchemaFilter according this answer.

So here is my example class:

public class ExampleClass
    {
        public int Id { get; set; }
        public string Name { get; set; }

        [SwaggerIgnore]
        public int Price { get; set; }

        [SwaggerIgnore]
        public AnotherClassFromThirdPartyLibrary OtherClass { get; set; }
    }

Integer Price successfully dissappear from schema, but the problem is when I try to ignore OtherClass which is class from 3rd party library, and there are a lot of Class-typed properties in it. So i got a lot of classes in my schema. How can I exclude it from schema with all it`s properties?

0 Answers
Related