.Net Core 3.1删除Swagger UI上的架构 [英] .Net Core 3.1 Remove Schema on Swagger UI

查看:52
本文介绍了.Net Core 3.1删除Swagger UI上的架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有.Net 3.1 Web Api,我想删除此部分中的模式",在Swagger UI上.
怎么做?

I have .Net 3.1 Web Api, I would like to remove this sections "Schemas" on Swagger UI.
How to do it?

推荐答案

无需架构过滤器.经过几天的努力,我发现:

No need for a schema filter. After busting on it for days I have found out:

所有要做的事情都在

app.UseSwaggerUI(options =>
{
    options.DefaultModelsExpandDepth(-1);
}

注意:这是默认模型而不是默认模型.DIfference是DefaultModel是模型示例部分中模型的默认扩展深度,而DefaultModels是模型的扩展深度.

Note: It is Default Models not Default Model. DIfference is DefaultModel is the default expansion depth for the model on the model-example section, whereas DefaultModels is the expansion depth for models.

这篇关于.Net Core 3.1删除Swagger UI上的架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆