Hel*_*len 17
要隐藏“模型”部分,请添加defaultModelsExpandDepth: -1到index.html.
请注意,选项名称使用复数Model*s*not Model。
// index.html
<script>
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "https://petstore.swagger.io/v2/swagger.json",
dom_id: '#swagger-ui',
defaultModelsExpandDepth: -1, // <-------
Run Code Online (Sandbox Code Playgroud)
Swagger UI 还具有许多其他配置选项,用于控制 API 文档呈现。
小智 6
对于 .Net Core 3.0 只需添加 c.DefaultModelsExpandDepth(-1); 在您的 Startup.cs 上
// Startup.cs
app.UseSwaggerUI(c =>
{
c.DefaultModelsExpandDepth(-1); // Disable swagger schemas at bottom
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Your API V1");
});
Run Code Online (Sandbox Code Playgroud)
小智 5
在 Docket bean 中添加新的
Docket(DocumentationType.SWAGGER_2).ignoredParameterTypes(YourClass.class,YourAnother.class)
我希望它有帮助
| 归档时间: |
|
| 查看次数: |
16023 次 |
| 最近记录: |