|
|
|
|
<!doctype html>
|
|
|
|
|
<html lang="en" dir="ltr" class="docs-wrapper plugin-docs plugin-id-default docs-version-current docs-doc-page docs-doc-id-settings/specificationdocumentsettings" data-has-hydrated="false">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<meta name="generator" content="Docusaurus v3.0.0">
|
|
|
|
|
<title data-rh="true">7. 规范化文档配置 | Furion</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="http://furion.baiqian.ltd/docs/settings/specificationdocumentsettings"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="7. 规范化文档配置 | Furion"><meta data-rh="true" name="description" content="如需编写配置的时候提供智能提示和校验,可查看 【2.7 JSON Schema 使用】"><meta data-rh="true" property="og:description" content="如需编写配置的时候提供智能提示和校验,可查看 【2.7 JSON Schema 使用】"><link data-rh="true" rel="icon" href="/img/favicon.ico"><link data-rh="true" rel="canonical" href="http://furion.baiqian.ltd/docs/settings/specificationdocumentsettings"><link data-rh="true" rel="alternate" href="http://furion.baiqian.ltd/docs/settings/specificationdocumentsettings" hreflang="en"><link data-rh="true" rel="alternate" href="http://furion.baiqian.ltd/docs/settings/specificationdocumentsettings" hreflang="x-default"><link rel="alternate" type="application/rss+xml" href="/blog/rss.xml" title="Furion RSS Feed">
|
|
|
|
|
<link rel="alternate" type="application/atom+xml" href="/blog/atom.xml" title="Furion Atom Feed"><link rel="stylesheet" href="/assets/css/styles.3f87a095.css">
|
|
|
|
|
<script src="/assets/js/runtime~main.89709a83.js" defer="defer"></script>
|
|
|
|
|
<script src="/assets/js/main.10e5dc01.js" defer="defer"></script>
|
|
|
|
|
</head>
|
|
|
|
|
<body class="navigation-with-keyboard">
|
|
|
|
|
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return localStorage.getItem("theme")}catch(t){}}();t(null!==e?e:"light")}(),function(){try{const a=new URLSearchParams(window.location.search).entries();for(var[t,e]of a)if(t.startsWith("docusaurus-data-")){var n=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(n,e)}}catch(t){}}(),document.documentElement.setAttribute("data-announcement-bar-initially-dismissed",function(){try{return"true"===localStorage.getItem("docusaurus.announcement.dismiss")}catch(t){}return!1}())</script><div id="__docusaurus"><div class="floatbar_hUWl"><div class="qrcode_sWwE"><img title="微信扫码关注 Furion 官方公众号" src="/img/weixin_qrcode.jpg" style="display:block"><div>❤️ 关注 Furion 微信公众号有惊喜哦!</div></div><div style="display:flex;flex-direction:row-reverse;align-items:flex-start"><div class="title_SD0k">🫠 遇到问题了</div><div class="extend__5i1"><a class="item_Y35a" href="/docs/subscribe"><div style="flex:1"><div class="itemTitle_If_T">⭐️ VIP 服务 ⭐️</div><div class="itemDesc_dp7r">仅需 499 元/年,尊享 365 天项目无忧</div></div><div class="jiantou_mV_o"></div></a><div class="item_Y35a"><div style="flex:1"><div class="itemTitle_If_T">问题反馈</div><div class="itemDesc_dp7r">到 Furion 开源仓库反馈</div></div><div class="jiantou_mV_o"></div></div></div></div></div><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><div class="announcementBar_mb4j" style="background-color:#4623d9;color:yellow" role="banner"><div class="content_knG7 announcementBarContent_xLdY">⭐️ 开通 VIP 服务仅需 499 元/年,尊享 365 天项目无忧 <a href="/docs/subscribe" style="background-color:rgb(199, 29, 36);color:#ffffff;padding:1px 10px;border-radius:3px;text-decoration:none;display:inline-block;margin:0 5px;font-size:12px;cursor:pointer;">立即开通</a>⭐️</div></div><nav aria-label="Main" class="navbar navbar--fixed-top navbarHideable_m1mJ"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="/img/furionlogo.png" alt="Furion Logo" class="themedComponent_mlkZ themedComponent--light_NVdE"><img src="/img/furionlogo.png" alt="Furion Logo" class="themedComponent_mlkZ themedComponent--dark_xIcU"></div><b class="navbar__title text--truncate">Furion</b></a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/docs/category/appendix">文档</a><a class="navbar__item navbar__link" href="/docs/global/app">静态类</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/docs/settings/appsettings">配置</a><a class="navbar__item navbar__link" href="/blog">博客</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">更新日志</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/docs/upgrade">📝 查看日志(v4.9.1.7)</a></li><li><a class="dropdown__link" href="/docs/target">🚀 路线图</a></li></ul></div><a href="http://furion.baiqian.ltd/api/api" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">API<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><
|
|
|
|
|
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="71-关于配置">7.1 关于配置<a href="#71-关于配置" class="hash-link" aria-label="Direct link to 7.1 关于配置" title="Direct link to 7.1 关于配置"></a></h2>
|
|
|
|
|
<p>规范化文档配置指的是 <code>Furion</code> 框架 Swagger 文档配置选项。</p>
|
|
|
|
|
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="72-配置信息">7.2 配置信息<a href="#72-配置信息" class="hash-link" aria-label="Direct link to 7.2 配置信息" title="Direct link to 7.2 配置信息"></a></h2>
|
|
|
|
|
<ul>
|
|
|
|
|
<li><code>SpecificationDocumentSettings</code>:配置根节点<!-- -->
|
|
|
|
|
<ul>
|
|
|
|
|
<li><code>DocumentTitle</code>:文档标题,<code>string</code>,默认 <code>Specification Api Document</code></li>
|
|
|
|
|
<li><code>DefaultGroupName</code>:默认分组名,<code>string</code>,默认 <code>Default</code></li>
|
|
|
|
|
<li><code>EnableAuthorized</code>:是否启用权限控制,<code>bool</code>,默认 <code>true</code></li>
|
|
|
|
|
<li><code>FormatAsV2</code>:采用 <code>Swagger 2.0</code> 版本,<code>bool</code>,默认 <code>false</code> <strong><a href="https://github.com/domaindrivendev/Swashbuckle.WebApi/issues/1393" target="_blank" rel="noopener noreferrer">已弃用</a></strong></li>
|
|
|
|
|
<li><code>RoutePrefix</code>:规范化文档地址,<code>string</code>,默认 <code>api</code>,<strong>如果希望在首页,改为空字符串即可</strong>。</li>
|
|
|
|
|
<li><code>DocExpansionState</code>:文档显示方式,<code>DocExpansion</code>,默认 <code>List</code>,取值:<!-- -->
|
|
|
|
|
<ul>
|
|
|
|
|
<li><code>List</code>:列表式(展开子类),<strong>默认值</strong></li>
|
|
|
|
|
<li><code>Full</code>:完全展开</li>
|
|
|
|
|
<li><code>None</code>:列表式(不展开子类)</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<li><code>XmlComments</code>:程序集注释描述文件名(可带 <code>.xml</code>,<code>string</code>,默认 <code>Furion.Application, Furion.Web.Entry, Furion.Web.Core</code></li>
|
|
|
|
|
<li><code>GroupOpenApiInfos</code>:分组信息配置,<code>SpecificationOpenApiInfo[]</code>,默认 <code>{ 'Group': 'Default'}</code></li>
|
|
|
|
|
<li><code>SecurityDefinitions</code>:安全策略定义配置,<code>SpecificationOpenApiSecurityScheme[]</code>,默认 <code>[]</code></li>
|
|
|
|
|
<li><code>Servers</code>:配置 Server 下拉列表,<code>OpenApiServer[]</code> 类型,默认 <code>[]</code>,如:<code>{Servers:[ { Url:"地址", Description:"描述"} ]}</code></li>
|
|
|
|
|
<li><code>HideServers</code>:是否隐藏 Server 下拉列表,<code>bool</code> 类型,默认 <code>true</code></li>
|
|
|
|
|
<li><code>RouteTemplate</code>:配置文档 <code>swagger.json</code> 路由模板,默认模板:<code>swagger/{documentName}/swagger.json</code>, <code>{documentName}</code> 代表分组名,<strong>必须保留原样</strong></li>
|
|
|
|
|
<li><code>PackagesGroups</code>:配置模块化内置分组名称,<code>string[]</code> 类型,默认 <code>[]</code></li>
|
|
|
|
|
<li><code>EnableEnumSchemaFilter</code>:启用枚举 Schema 筛选器,<code>bool</code> 类型,默认 <code>true</code></li>
|
|
|
|
|
<li><code>EnableTagsOrderDocumentFilter</code>:启用标签排序筛选器,<code>bool</code> 类型,默认 <code>true</code></li>
|
|
|
|
|
<li><code>ServerDir</code>:配置 <code>IIS</code> 添加 <code>Application</code> 部署名,<code>string</code> 类型,默认空,<strong>仅在 Furion v3.2.0+` 有效</strong></li>
|
|
|
|
|
<li><code>LoginInfo</code>:配置 <code>Swagger</code> 是否需要登录才能访问,<code>SpecificationLoginInfo</code> 类型,默认 <code>null</code>,<strong>仅在 Furion v3.3.3+` 有效</strong>
|
|
|
|
|
<ul>
|
|
|
|
|
<li><code>Enabled</code>:是否启用登录授权,默认 <code>false</code></li>
|
|
|
|
|
<li><code>CheckUrl</code>:检查登录状态的 <code>Url</code> 地址,<strong>该地址必须是 <code>POST</code> 请求</strong></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<li><code>SubmitUrl</code>:提交登录的 <code>Url</code> 地址,<strong>该地址必须是 <code>POST</code> 请求且只有一个 <code>SpecificationAuth</code> 类型参数</strong>,成功登录返回 <code>200</code>,否则返回 <code>401</code>,支持相对地址,以 <code>/</code> 开头</li>
|
|
|
|
|
<li><code>EnableAllGroups</code>:启用 <code>Swagger</code> 总分组功能,自动将所有分组的接口合并到 <code>All Groups</code> 中,<code>bool</code> 类型,默认 <code>false</code>,<strong>仅在 Furion v3.3.4+` 有效</strong></li>
|
|
|
|
|
<li><code>EnumToNumber</code>:枚举类型生成值类型,<code>bool</code> 类型,默认 <code>false</code>,<strong>仅在 Furion 4.8.8.35+` 有效</strong></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p>另外 <code>SpecificationOpenApiInfo</code> 内置配置如下:</p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li><code>Group</code>:分组唯一标识,<code>string</code> 类型,必填</li>
|
|
|
|
|
<li><code>Order</code>:分组排序,<code>int</code> 类型,数字越大排前面,默认 <code>0</code></li>
|
|
|
|
|
<li><code>Visible</code>:配置分组是否可见,<code>bool</code> 类型,默认 <code>true</code></li>
|
|
|
|
|
<li><code>Title</code>:配置分组标题,<code>string</code> 类型</li>
|
|
|
|
|
<li><code>Description</code>:配置分组描述,<code>string</code> 类型</li>
|
|
|
|
|
<li><code>Version</code>:配置分组版本,默认 <code>1.0</code></li>
|
|
|
|
|
<li><code>TermsOfService</code>:配置相关链接地址,<code>Uri</code> 类型</li>
|
|
|
|
|
<li><code>Contact</code>:配置联系方式,<code>OpenApiContact</code> 类型</li>
|
|
|
|
|
<li><code>License</code>:配置协议,<code>OpenApiLicense</code> 类型</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="73-配置示例">7.3 配置示例<a href="#73-配置示例" class="hash-link" aria-label="Direct link to 7.3 配置示例" title="Direct link to 7.3 配置示例"></a></h2>
|
|
|
|
|
<div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar" style="color:#bfc7d5;background-color:#292d3e"><code class="codeBlockLines_e6Vv codeBlockLinesWithNumbering_o6Pm"><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain">{</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain"> "SpecificationDocumentSettings": {</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain"> "GroupOpenApiInfos": [</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain"> {</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain"> "Group": "Group1",</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain"> "Title": "分组标题",</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain"> "Description": "这里是分组描述",</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain"> "Version": "版本号",</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain"> "TermsOfService": "http://furion.baiqian.ltd",</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain"> "Contact": {</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain"> "Name": "百小僧",</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain"> "Url": "https://gitee.com/monksoul",</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain"> "Email": "monksoul@outlook.com"</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain"> },</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain"> "License": {</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bfc7d5"><span class="codeLineNumber_Tfdd"></span><span class="codeLineContent_feaV"><span class="token plain"> "Name": "MIT",</span></span><br></span><span class="token-line codeLine_lJS_" style="color:#bf
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|