"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[6526],{3126:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>h,contentTitle:()=>r,default:()=>j,frontMatter:()=>d,metadata:()=>t,toc:()=>l});var i=n(5893),c=n(1151),o=n(4996);const d={id:"jsonschema",title:"2.13 JSON Schema \u4f7f\u7528",sidebar_label:"2.13 JSON Schema \u4f7f\u7528",description:"\u914d\u7f6e\u6587\u4ef6\u4e5f\u8981\u667a\u80fd\u63d0\u793a"},r=void 0,t={id:"jsonschema",title:"2.13 JSON Schema \u4f7f\u7528",description:"\u914d\u7f6e\u6587\u4ef6\u4e5f\u8981\u667a\u80fd\u63d0\u793a",source:"@site/docs/jsonschema.mdx",sourceDirName:".",slug:"/jsonschema",permalink:"/docs/jsonschema",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/jsonschema.mdx",tags:[],version:"current",lastUpdatedBy:"MonkSoul",lastUpdatedAt:1682387971,formattedLastUpdatedAt:"Apr 25, 2023",frontMatter:{id:"jsonschema",title:"2.13 JSON Schema \u4f7f\u7528",sidebar_label:"2.13 JSON Schema \u4f7f\u7528",description:"\u914d\u7f6e\u6587\u4ef6\u4e5f\u8981\u667a\u80fd\u63d0\u793a"},sidebar:"docs",previous:{title:"2.12 GlobalUsing \u4f7f\u7528",permalink:"/docs/globalusing"},next:{title:"2.14 Visual Studio \u9ad8\u6548\u7387",permalink:"/docs/vsfast"}},h={},l=[{value:"2.13.1 \u5173\u4e8e JSON Schema",id:"2131-\u5173\u4e8e-json-schema",level:2},{value:"2.13.2 \u5b66\u4e60 JSON Schema \u7f16\u5199",id:"2132-\u5b66\u4e60-json-schema-\u7f16\u5199",level:2},{value:"2.13.3 \u6846\u67b6\u63d0\u4f9b",id:"2133-\u6846\u67b6\u63d0\u4f9b",level:2},{value:"2.13.4 \u5982\u4f55\u4f7f\u7528",id:"2134-\u5982\u4f55\u4f7f\u7528",level:2},{value:"2.13.5 JSON Schema \u5931\u6548\u89e3\u51b3",id:"2135-json-schema-\u5931\u6548\u89e3\u51b3",level:2},{value:"2.13.5.1 Visual Studio",id:"21351-visual-studio",level:3},{value:"2.13.5.2 Visual Studio Code",id:"21352-visual-studio-code",level:3},{value:"2.13.6 \u5982\u4f55\u66f4\u65b0 JSON Schema",id:"2136-\u5982\u4f55\u66f4\u65b0-json-schema",level:2},{value:"2.13.6.1 Visual Studio",id:"21361-visual-studio",level:3},{value:"2.13.6.2 Visual Studio Code",id:"21362-visual-studio-code",level:3},{value:"2.13.7 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"2137-\u53cd\u9988\u4e0e\u5efa\u8bae",level:2}];function a(e){const s={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,c.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.h2,{id:"2131-\u5173\u4e8e-json-schema",children:["2.13.1 \u5173\u4e8e ",(0,i.jsx)(s.code,{children:"JSON Schema"})]}),"\n",(0,i.jsxs)(s.p,{children:[(0,i.jsx)(s.code,{children:"JSON Schema"})," \u662f\u7528\u4e8e\u9a8c\u8bc1 ",(0,i.jsx)(s.code,{children:"JSON"})," \u6570\u636e\u7ed3\u6784\u7684\u5f3a\u5927\u5de5\u5177\uff0c",(0,i.jsx)(s.code,{children:"Schema"})," \u53ef\u4ee5\u7406\u89e3\u4e3a\u6a21\u5f0f\u6216\u8005\u89c4\u5219\u3002"]}),"\n",(0,i.jsx)(s.p,{children:(0,i.jsxs)(s.strong,{children:["\u6709\u4e86 ",(0,i.jsx)(s.code,{children:"JSON Schema"})," \u518d\u4e5f\u4e0d\u6015\u914d\u7f6e\u5199\u9519\u7684\u60c5\u51b5\u4e86\uff01"]})}),"\n",(0,i.jsxs)(s.h2,{id:"2132-\u5b66\u4e60-json-schema-\u7f16\u5199",children:["2.13.2 \u5b66\u4e60 ",(0,i.jsx)(s.code,{children:"JSON Schema"})," \u7f16\u5199"]}),"\n",(0,i.jsxs)(s.p,{children:["\u4f5c\u4e3a\u4e00\u4e2a\u6846\u67b6\u63d0\u4f9b ",(0,i.jsx)(s.code,{children:"JSON Schema"})," \u662f\u975e\u5e38\u6709\u5fc5\u8981\u7684\uff0c\u53ef\u4ee5\u8ba9\u5f00\u53d1\u8005\u5728\u6dfb\u52a0\u914d\u7f6e\u7684\u65f6\u5019\u80fd\u591f\u6709\u667a\u80fd\u63d0\u793a\u548c\u6821\u9a8c\u529f\u80fd\uff0c\u5982\u679c\u60f3\u5b66\u4e60 ",(0,i.jsx)(s.code,{children:"JSON Schema"})," \u7f16\u5199\u53ef\u4ee5\u67e5\u770b\u4ee5\u4e0b\u6587\u6863\uff1a"]}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://json-schema.apifox.cn/",children:"https://json-schema.apifox.cn/"})}),"\n",(0,i.jsx)(s.li,{children:(0,i.jsx)(s.a,{href:"https://zhuanlan.zhihu.com/p/355175938",children:"https://zhuanlan.zhihu.com/p/355175938"})}),"\n"]}),"\n",(0,i.jsxs)(s.p,{children:["\u8fd9\u91cc\u4e5f\u63d0\u4f9b\u4e00\u4e2a\u975e\u5e38\u4fbf\u6377\u7684\u521b\u5efa ",(0,i.jsx)(s.code,{children:"JSON Schema"})," \u7684\u5728\u7ebf\u7f51\u7ad9\uff0c\u53ef\u4ee5\u6839\u636e ",(0,i.jsx)(s.code,{children:"json"})," \u6587\u4ef6\u5185\u5bb9\u81ea\u52a8\u751f\u6210 ",(0,i.jsx)(s.code,{children:"JSON Schema"}),"\uff0c\u4e4b\u540e\u8fdb\u884c\u5c0f\u91cf\u4fee\u6539\u5373\u53ef\uff1a"]}),"\n",(0,i.jsx)(s.p,{children:(0,i.jsx)(s.a,{href:"https://hellosean1025.github.io/json-schema-visual-editor/",children:"https://hellosean1025.github.io/json-schema-visual-editor/"})}),"\n",(0,i.jsx)(s.h2,{id:"2133-\u6846\u67b6\u63d0\u4f9b",children:"2.13.3 \u6846\u67b6\u63d0\u4f9b"}),"\n",(0,i.jsxs)(s.p,{children:[(0,i.jsx)(s.code,{children:"Furion"})," \u6846\u67b6\u63d0\u4f9b\u4e86\u5b8c\u6574\u7684 ",(0,i.jsx)(s.code,{children:"Furion"})," \u548c ",(0,i.jsx)(s.code,{children:"ASP.NET Core"})," \u7684 ",(0,i.jsx)(s.code,{children:"JSON Schema"})," \u6587\u4ef6\uff0c\u901a\u8fc7\u8be5\u6587\u4ef6\u53ef\u4ee5\u5728\u7f16\u5199\u914d\u7f6e\u6587\u4ef6\u65f6\u63d0\u4f9b\u5b8c\u6574\u7684\u667a\u80fd\u63d0\u793a\u548c\u6821\u9a8c\u3002"]}),"\n",(0,i.jsx)(s.p,{children:(0,i.jsx)(s.strong,{children:(0,i.jsxs)(s.a,{href:"https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",children:["\u67e5\u770b ",(0,i.jsx)(s.code,{children:"JSON Schema"})," \u6e90\u7801\u5730\u5740"]})})}),"\n",(0,i.jsx)(s.h2,{id:"2134-\u5982\u4f55\u4f7f\u7528",children:"2.13.4 \u5982\u4f55\u4f7f\u7528"}),"\n",(0,i.jsxs)(s.p,{children:["\u4f7f\u7528\u65b9\u5f0f\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u8981\u5728 ",(0,i.jsx)(s.code,{children:".json"})," \u6587\u4ef6\u7684\u5934\u90e8\u6dfb\u52a0 ",(0,i.jsx)(s.code,{children:'"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",'})," \u5373\u53ef\uff0c\u5982\uff1a"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-json",metastring:"showLineNumbers {2}",children:'{\r\n "$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",\r\n\r\n "Logging": {\r\n "LogLevel": {\r\n "Default": "Information",\r\n "Microsoft": "Warning",\r\n "Microsoft.Hosting.Lifetime": "Information",\r\n "Microsoft.EntityFrameworkCore": "Information",\r\n "Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware": "Information"\r\n }\r\n },\r\n "AllowedHosts": "*"\r\n}\n'})}),"\n",(0,i.jsx)("img",{src:(0,o.Z)("img/js1.png")}),"\n",(0,i.jsx)("img",{src:(0,o.Z)("img/js2.png")}),"\n",(0,i.jsx)("img",{src:(0,o.Z)("img/js3.png")}),"\n",(0,i.jsx)("img",{src:(0,o.Z)("img/js4.png")}),"\n",(0,i.jsx)("img",{src:(0,o.Z)("img/js7.png")}),"\n",(0,i.jsxs)(s.h2,{id:"2135-json-schema-\u5931\u6548\u89e3\u51b3",children:["2.13.5 ",(0,i.jsx)(s.code,{children:"JSON Schema"})," \u5931\u6548\u89e3\u51b3"]}),"\n",(0,i.jsxs)(s.p,{children:["\u5982\u679c\u6dfb\u52a0\u4e86 ",(0,i.jsx)(s.code,{children:'"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",'})," \u4f9d\u7136\u65e0\u6cd5\u8fdb\u884c\u667a\u80fd\u63d0\u793a\u6821\u9a8c\uff0c\u53ef\u5c1d\u8bd5\u5173\u95ed ",(0,i.jsx)(s.code,{children:".json"})," \u6587\u4ef6\u518d\u91cd\u65b0\u6253\u5f00\u3002"]}),"\n",(0,i.jsx)(s.p,{children:"\u5982\u679c\u4e0a\u9762\u6b65\u9aa4\u4f9d\u7136\u65e0\u6548\uff0c\u90a3\u4e48\u8fd8\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u65b9\u5f0f\uff1a"}),"\n",(0,i.jsxs)(s.h3,{id:"21351-visual-studio",children:["2.13.5.1 ",(0,i.jsx)(s.code,{children:"Visual Studio"})]}),"\n",(0,i.jsx)("img",{src:(0,o.Z)("img/js5.png")}),"\n",(0,i.jsx)("img",{src:(0,o.Z)("img/js6.png")}),"\n",(0,i.jsxs)(s.h3,{id:"21352-visual-studio-code",children:["2.13.5.2 ",(0,i.jsx)(s.code,{children:"Visual Studio Code"})]}),"\n",(0,i.jsxs)(s.p,{children:["\u91cd\u542f ",(0,i.jsx)(s.code,{children:"Visual Studio Code"})," \u5373\u53ef\u3002"]}),"\n",(0,i.jsxs)(s.h2,{id:"2136-\u5982\u4f55\u66f4\u65b0-json-schema",children:["2.13.6 \u5982\u4f55\u66f4\u65b0 ",(0,i.jsx)(s.code,{children:"JSON Schema"})]}),"\n",(0,i.jsxs)(s.p,{children:["\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",(0,i.jsx)(s.code,{children:"JSON Schema"})," \u5728\u7b2c\u4e00\u6b21\u83b7\u53d6\u4e4b\u540e\u4f1a\u81ea\u52a8\u7f13\u5b58\u8d77\u6765\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4 ",(0,i.jsx)(s.code,{children:".json"})," \u6587\u4ef6\u63d0\u793a\u9519\u8bef\uff0c\u8fd9\u4e2a\u65f6\u5019\u53ea\u9700\u8981\u5220\u9664\u7f13\u5b58\u5373\u53ef\u3002"]}),"\n",(0,i.jsxs)(s.h3,{id:"21361-visual-studio",children:["2.13.6.1 ",(0,i.jsx)(s.code,{children:"Visual Studio"})]}),"\n",(0,i.jsxs)(s.p,{children:["\u6253\u5f00\u7535\u8111\u7684 ",(0,i.jsx)(s.code,{children:"\u8fd0\u884c"})," \u5e76\u8f93\u5165 ",(0,i.jsx)(s.code,{children:"%AppData%"}),"\uff0c\u4e4b\u540e\u8fdb\u5165 ",(0,i.jsx)(s.code,{children:"C:\\Users\\\u4f60\u7684\u7535\u8111\u7528\u6237\u540d\\AppData\\Local\\Microsoft\\VisualStudio"})," \u4e0b"]}),"\n",(0,i.jsx)("img",{src:(0,o.Z)("img/js8.png")}),"\n",(0,i.jsx)("img",{src:(0,o.Z)("img/js9.png")}),"\n",(0,i.jsx)("img",{src:(0,o.Z)("img/js10.png")}),"\n",(0,i.jsx)(s.p,{children:(0,i.jsxs)(s.strong,{children:["\u4e4b\u540e\u5220\u9664 ",(0,i.jsx)(s.code,{children:"http/https"})," \u5f00\u5934\u7684\u6587\u4ef6\u5373\u53ef\u3002"]})}),"\n",(0,i.jsxs)(s.h3,{id:"21362-visual-studio-code",children:["2.13.6.2 ",(0,i.jsx)(s.code,{children:"Visual Studio Code"})]}),"\n",(0,i.jsxs)(s.p,{children:["\u540c\u4e0a\uff0c\u8fd0\u884c\u8fdb\u5165 ",(0,i.jsx)(s.code,{children:"%AppData%"}),"\uff0c\u4e4b\u540e\u8fdb\u5165\u4e0b\u5217\u8def\u5f84\uff1a",(0,i.jsx)(s.code,{children:"C:\\Users\\\u4f60\u7684\u7535\u8111\u7528\u6237\u540d\\AppData\\Roaming\\Code\\User\\globalStorage\\vscode.json-language-features\\json-schema-cache"})]}),"\n",(0,i.jsx)("img",{src:(0,o.Z)("img/js11.png")}),"\n",(0,i.jsx)(s.p,{children:(0,i.jsx)(s.strong,{children:"\u4e4b\u540e\u5220\u9664\u8fd9\u4e9b\u6587\u4ef6\u5373\u53ef\u3002"})}),"\n",(0,i.jsx)(s.h2,{id:"2137-\u53cd\u9988\u4e0e\u5efa\u8bae",children:"2.13.7 \u53cd\u9988\u4e0e\u5efa\u8bae"}),"\n",(0,i.jsx)(s.admonition,{title:"\u4e0e\u6211\u4eec\u4ea4\u6d41",type:"note",children:(0,i.jsxs)(s.p,{children:["\u7ed9 Furion \u63d0 ",(0,i.jsx)(s.a,{href:"https://gitee.com/dotnetchina/Furion/issues/new?issue",children:"Issue"}),"\u3002"]})})]})}function j(e={}){const{wrapper:s}={...(0,c.a)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(a,{...e})}):a(e)}},1151:(e,s,n)=>{n.d(s,{Z:()=>r,a:()=>d});var i=n(7294);const c={},o=i.createContext(c);function d(e){const s=i.useContext(o);return i.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function r(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:d(e.components),i.createElement(o.Provider,{value:s},e.children)}}}]);