How to hide the Models section in Swagger UI?

前端 未结 5 1267
遇见更好的自我
遇见更好的自我 2020-12-20 17:03

I use Swagger UI to display API documentation. By default, it displays the \"Models\" section at the bottom:

How to hide it?

5条回答
  •  感动是毒
    2020-12-20 17:36

    For .Net Core 3.0 just Add c.DefaultModelsExpandDepth(-1); on your Startup.cs

    // Startup.cs
    
    app.UseSwaggerUI(c =>
    {
        c.DefaultModelsExpandDepth(-1); // Disable swagger schemas at bottom
        c.SwaggerEndpoint("/swagger/v1/swagger.json", "Your API V1");
    });
    

提交回复
热议问题