如何在 Swagger UI 中隐藏模型部分? [英] How to hide the Models section in Swagger UI?
本文介绍了如何在 Swagger UI 中隐藏模型部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用
如何隐藏?
解决方案
要隐藏模型"部分,请将 defaultModelsExpandDepth: -1
添加到 index.html 中的 Swagger UI 配置代码.html
.
注意选项名称使用复数 Model*s*
而不是 Model
.
//index.html<脚本>window.onload = 函数(){//开始 Swagger UI 调用区域const ui = SwaggerUIBundle({url: "https://petstore.swagger.io/v2/swagger.json",dom_id: '#swagger-ui',defaultModelsExpandDepth: -1,//<-------
Swagger UI 还有很多其他的配置选项 控制 API 文档呈现.
I use Swagger UI to display API documentation. By default, it displays the "Models" section at the bottom:
How to hide it?
解决方案
To hide the "Models" section, add defaultModelsExpandDepth: -1
to the Swagger UI configuration code in your index.html
.
Note the option name uses plural 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, // <-------
Swagger UI also has many other configuration options that control API documentation rendering.
这篇关于如何在 Swagger UI 中隐藏模型部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文