{"id":102329,"date":"2026-09-08T13:49:50","date_gmt":"2026-09-08T05:49:50","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/102329.html"},"modified":"2026-09-08T13:49:50","modified_gmt":"2026-09-08T05:49:50","slug":"%e6%88%90%e4%b8%ba%e5%85%a8%e6%a0%88%c2%b7node-%e5%90%8e%e7%ab%af%e7%af%87%c2%b7%e6%8e%a5%e5%8f%a3%e6%96%87%e6%a1%a3%e8%87%aa%e5%8a%a8%e5%8c%96%ef%bc%9a%e8%ae%a9-openapi-%e4%b8%8e%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/102329.html","title":{"rendered":"\u6210\u4e3a\u5168\u6808\u00b7Node \u540e\u7aef\u7bc7\u00b7\u63a5\u53e3\u6587\u6863\u81ea\u52a8\u5316\uff1a\u8ba9 OpenAPI \u4e0e\u4ee3\u7801\u4e0d\u8131\u8282"},"content":{"rendered":"<h2>\u6210\u4e3a\u5168\u6808\u00b7Node \u540e\u7aef\u7bc7\u00b7\u63a5\u53e3\u6587\u6863\u81ea\u52a8\u5316&#xff1a;\u8ba9 OpenAPI \u4e0e\u4ee3\u7801\u4e0d\u8131\u8282<\/h2>\n<p>\u65b0\u4eba\u5165\u804c\u7b2c\u4e00\u5929&#xff0c;\u7167\u7740 Swagger \u8c03\u63a5\u53e3&#xff0c;\u7ed3\u679c\u8c03\u51fa\u4e00\u4e2a 500\u3002\u53bb\u95ee\u540e\u7aef&#xff0c;\u540e\u7aef\u8bf4&#034;\u8fd9\u4e2a\u5b57\u6bb5\u4e0a\u5468\u5c31\u6539\u4e86&#xff0c;\u6587\u6863\u6ca1\u987e\u4e0a&#034;\u3002\u8fd9\u7c7b\u4e8b\u7684\u6839\u56e0\u4e0d\u662f\u8c01\u5077\u61d2&#xff0c;\u800c\u662f\u6587\u6863\u548c\u4ee3\u7801\u672c\u6765\u5c31\u662f\u4e24\u4efd\u4e1c\u897f\u2014\u2014\u53ea\u8981\u5b58\u5728\u4e24\u4efd&#xff0c;\u5b83\u4eec\u8fdf\u65e9\u4f1a\u6f02\u79fb\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260908054939-6a9fa1f3161d3.png\" alt=\"\u6210\u4e3a\u5168\u6808\u00b7Node \u540e\u7aef\u7bc7\u00b7\u63a5\u53e3\u6587\u6863\u81ea\u52a8\u5316\uff1a\u8ba9 OpenAPI \u4e0e\u4ee3\u7801\u4e0d\u8131\u8282\" \/><\/p>\n<p>\u8fd9\u4e00\u7bc7\u4e0d\u8bb2&#034;\u600e\u4e48\u81ea\u52a8\u751f\u6210\u6587\u6863&#034;&#xff0c;\u800c\u662f\u8bb2\u66f4\u5f7b\u5e95\u7684\u89e3\u6cd5&#xff1a;\u8ba9\u5951\u7ea6\u672c\u8eab\u6210\u4e3a\u552f\u4e00\u4e8b\u5b9e\u6e90&#xff0c;\u518d\u7528\u673a\u5668\u95e8\u7981\u628a\u4ee3\u7801\u548c\u5951\u7ea6\u710a\u6b7b\u2014\u2014\u7ed3\u6784\u95e8\u7ba1\u683c\u5f0f\u3001\u8bed\u4e49\u95e8\u7ba1\u4e1a\u52a1\u89c4\u5219&#xff0c;\u5951\u7ea6\u4e00\u6539&#xff0c;\u6587\u6863\u3001\u9519\u8bef\u7801\u3001\u6743\u9650\u58f0\u660e\u5168\u90e8\u8ddf\u7740\u8d70\u3002<\/p>\n<h3>\u4e00\u3001\u6587\u6863\u4e3a\u4ec0\u4e48\u4f1a\u8131\u8282<\/h3>\n<p>\u5148\u770b\u6e05\u4e24\u79cd\u4e3b\u6d41\u89e3\u6cd5\u7684\u5931\u6548\u539f\u56e0&#xff1a;<\/p>\n<p>\u624b\u5199\u6587\u6863&#xff1a;\u5199\u5b8c\u90a3\u4e00\u523b\u5c31\u662f\u8fc7\u65f6\u7684\u5f00\u59cb\u3002\u4f60\u52a0\u4e86 coverImage \u5b57\u6bb5&#xff0c;\u8f6c\u5934\u53bb\u5fd9\u522b\u7684&#xff0c;\u6587\u6863\u5fd8\u4e86\u6539\u3002\u4e09\u4e2a\u6708\u540e&#xff0c;\u6587\u6863\u548c\u4ee3\u7801\u5df2\u7ecf\u5404\u8bf4\u5404\u8bdd\u3002<\/p>\n<p>\u4ee3\u7801\u751f\u6210\u6587\u6863&#xff08;\u6ce8\u89e3 \/ Swagger&#xff09;&#xff1a;\u770b\u4f3c&#034;\u6539\u4ee3\u7801\u6587\u6863\u81ea\u52a8\u66f4\u65b0&#034;&#xff0c;\u4f46\u6709\u4e24\u4e2a\u8f6f\u808b\u3002\u4e00\u662f\u63cf\u8ff0\u80fd\u529b\u6709\u9650\u2014\u2014\u590d\u6742\u7684\u4f01\u4e1a\u7ea6\u675f&#xff08;\u8c01\u6709\u6743\u8c03\u3001\u72b6\u6001\u600e\u4e48\u6d41\u8f6c&#xff09;\u6ce8\u89e3\u8868\u8fbe\u4e0d\u4e86&#xff1b;\u4e8c\u662f\u751f\u6210\u7269\u7ec8\u7a76\u662f&#034;\u526f\u4ea7\u7269&#034;&#xff0c;\u6ca1\u4eba\u628a\u5b83\u5f53\u6743\u5a01&#xff0c;\u7167\u6837\u6ca1\u4eba\u7ef4\u62a4&#xff0c;\u6f02\u79fb\u7167\u65e7\u3002<\/p>\n<p>\u4e24\u79cd\u89e3\u6cd5\u5bf9\u6bd4\u5982\u4e0b&#xff1a;<\/p>\n<table>\n<tr>\u89e3\u6cd5\u8868\u9762\u4f18\u52bf\u81f4\u547d\u8f6f\u808b\u6f02\u79fb\u65b9\u5f0f<\/tr>\n<tbody>\n<tr>\n<td>\u624b\u5199\u6587\u6863<\/td>\n<td>\u8868\u8fbe\u81ea\u7531\u3001\u53ef\u5199\u4e1a\u52a1\u89c4\u5219<\/td>\n<td>\u5199\u5b8c\u5373\u8fc7\u65f6&#xff0c;\u9760\u4eba\u8089\u7ef4\u62a4<\/td>\n<td>\u6539\u4ee3\u7801\u5fd8\u6539\u6587\u6863<\/td>\n<\/tr>\n<tr>\n<td>\u4ee3\u7801\u751f\u6210\u6587\u6863<\/td>\n<td>\u6539\u4ee3\u7801\u81ea\u52a8\u66f4\u65b0<\/td>\n<td>\u6ce8\u89e3\u8868\u8fbe\u4e0d\u4e86\u590d\u6742\u7ea6\u675f&#xff1b;\u751f\u6210\u7269\u65e0\u4eba\u5f53\u6743\u5a01<\/td>\n<td>\u7ea6\u675f\u5199\u5728\u6ce8\u89e3\u5916&#xff0c;\u7167\u6837\u6f02\u79fb<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6839\u56e0\u53ea\u6709\u4e00\u4e2a&#xff1a;\u6587\u6863\u548c\u4ee3\u7801\u662f&#034;\u4e24\u6837\u4e1c\u897f&#034;\u3002\u53ea\u8981\u5b83\u4eec\u662f\u4e24\u6837\u4e1c\u897f&#xff0c;\u8c01\u5148\u52a8\u3001\u8c01\u5c31\u4e0d\u5bf9\u9f50\u53e6\u4e00\u4e2a\u3002\u8981\u6839\u6cbb&#xff0c;\u5f97\u8ba9\u5b83\u4eec&#034;\u53d8\u6210\u4e00\u6837\u4e1c\u897f&#034;\u3002<\/p>\n<p>\u4e3e\u4e2a\u771f\u91d1\u767d\u94f6\u7684\u4ee3\u4ef7&#xff1a;\u524d\u7aef\u6309\u6587\u6863\u8bf4 POST \/comments \u8fd4\u56de 201&#xff0c;\u7ed3\u679c\u4ee3\u7801\u8fd4\u56de 200&#xff0c;\u524d\u7aef\u90a3\u8fb9\u7684\u6210\u529f\u56de\u8c03\u6c38\u8fdc\u4e0d\u89e6\u53d1&#xff0c;\u8bc4\u8bba&#034;\u53d1\u4e86\u4f46\u5217\u8868\u4e0d\u5237\u65b0&#034;&#xff0c;\u6392\u67e5\u4e00\u4e0b\u5348\u624d\u53d1\u73b0\u662f\u6587\u6863\u548c\u4ee3\u7801\u5dee\u4e86\u4e00\u4e2a\u72b6\u6001\u7801\u3002\u8fd9\u79cd&#034;\u6587\u6863\u8bf4 A\u3001\u4ee3\u7801\u505a B&#034;\u7684\u88c2\u7f1d&#xff0c;\u6bcf\u5929\u5728\u6bcf\u4e2a\u56e2\u961f\u91cc\u90fd\u5728\u53d1\u751f\u3002\u6587\u6863\u8131\u8282\u4e0d\u662f&#034;\u4e0d\u4e13\u4e1a&#034;\u7684\u5c0f\u4e8b&#xff0c;\u5b83\u662f\u76f4\u63a5\u4ea7\u751f bug \u7684\u6e90\u5934\u3002<\/p>\n<h3>\u4e8c\u3001\u5951\u7ea6\u5373\u6587\u6863&#xff1a;\u8ba9\u5951\u7ea6\u6210\u4e3a\u552f\u4e00\u4e8b\u5b9e\u6e90<\/h3>\n<p>\u6211\u4eec\u7684\u505a\u6cd5&#xff1a;docs\/api\/openapi.v1.yaml \u662f\u4e00\u4efd OpenAPI 3.1 \u5951\u7ea6&#xff0c;\u5b83\u672c\u8eab\u5c31\u662f\u540e\u7aef\u6240\u6709\u63a5\u53e3\u7684\u5355\u4e00\u4e8b\u5b9e\u6e90\u2014\u2014\u6bcf\u4e2a\u7aef\u70b9\u7684\u8def\u5f84\u3001\u65b9\u6cd5\u3001\u8bf7\u6c42\/\u54cd\u5e94\u5b57\u6bb5\u3001\u9519\u8bef\u7801\u3001\u4e43\u81f3 x-authz \u6388\u6743\u89c4\u5219&#xff0c;\u5168\u5199\u5728\u91cc\u9762\u3002<\/p>\n<p>\u5173\u952e\u533a\u522b\u5728&#034;\u65b9\u5411&#034;&#xff1a;<\/p>\n<ul>\n<li>\u666e\u901a\u9879\u76ee&#xff1a;\u4ee3\u7801\u662f\u771f\u76f8&#xff0c;\u6587\u6863\u662f\u4ee3\u7801\u7684\u6295\u5f71&#xff08;\u4ee3\u7801 \u2192 \u6587\u6863&#xff09;\u3002<\/li>\n<li>\u6211\u4eec&#xff1a;\u5951\u7ea6\u662f\u771f\u76f8&#xff0c;\u4ee3\u7801\u662f\u5951\u7ea6\u7684\u5b9e\u73b0\u7ea6\u675f&#xff08;\u5951\u7ea6 \u2192 \u4ee3\u7801\u5fc5\u987b\u5bf9\u9f50&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u6240\u4ee5\u4ee3\u7801\u4e0d\u662f&#034;\u751f\u6210\u6587\u6863&#034;&#xff0c;\u800c\u662f&#034;\u88ab\u5951\u7ea6\u7ea6\u675f&#034;\u3002\u5951\u7ea6\u91cc\u5199\u7684\u8fdc\u4e0d\u6b62\u8def\u5f84\u548c\u5b57\u6bb5\u3002\u770b updateArticle \u8fd9\u4e2a\u7aef\u70b9\u7684\u771f\u5b9e\u5b9a\u4e49&#xff1a;<\/p>\n<p><span class=\"token comment\"># docs\/api\/openapi.v1.yaml \u2014 PUT \/api\/v1\/articles\/{id}<\/span><br \/>\n<span class=\"token key atrule\">put<\/span><span class=\"token punctuation\">:<\/span><br \/>\n  <span class=\"token key atrule\">operationId<\/span><span class=\"token punctuation\">:<\/span> updateArticle<br \/>\n  <span class=\"token key atrule\">x-authz<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token key atrule\">minRole<\/span><span class=\"token punctuation\">:<\/span> editor<br \/>\n    <span class=\"token key atrule\">ownerOverride<\/span><span class=\"token punctuation\">:<\/span><br \/>\n      <span class=\"token key atrule\">param<\/span><span class=\"token punctuation\">:<\/span> id<br \/>\n      <span class=\"token key atrule\">ownerField<\/span><span class=\"token punctuation\">:<\/span> authorId<br \/>\n  <span class=\"token key atrule\">summary<\/span><span class=\"token punctuation\">:<\/span> \u66f4\u65b0\u6587\u7ae0<br \/>\n  <span class=\"token key atrule\">description<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token punctuation\">&gt;<\/span><span class=\"token scalar string\"><br \/>\n    \u4f5c\u8005\u672c\u4eba&#xff0c;\u6216 editor \/ admin\u3002**\u72b6\u6001\u526f\u4f5c\u7528&#xff08;\u663e\u5f0f\u5b9a\u4e49&#xff0c;\u907f\u514d\u4e24\u5b9e\u73b0\u5206\u6b67&#xff09;**&#xff1a;<br \/>\n    member \u7f16\u8f91\u81ea\u5df1\u5df2 published \u7684\u6587\u7ae0&#xff0c;\u4fdd\u5b58\u540e\u72b6\u6001\u81ea\u52a8\u9000\u56de pending \u9700\u91cd\u65b0\u5ba1\u6838&#xff1b;<br \/>\n    editor \u4e0e admin \u7f16\u8f91\u4e0d\u6539\u53d8\u72b6\u6001\u3002<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260908054942-6a9fa1f658801.png\" alt=\"\u5951\u7ea6\u5373\u6587\u6863\uff1a\u8ba9\u5951\u7ea6\u6210\u4e3a\u552f\u4e00\u4e8b\u5b9e\u6e90\" \/><\/p>\n<p>\u5b83\u7528 x-authz \u673a\u5668\u5316\u8bb0\u5f55&#034;\u81f3\u5c11\u4ec0\u4e48\u89d2\u8272&#xff08;minRole: editor&#xff09;\u3001\u662f\u5426\u6821\u9a8c\u8d44\u6e90\u5f52\u5c5e&#xff08;ownerOverride: param&#061;id, ownerField&#061;authorId&#xff09;\u201c&#xff1b;\u7528 ErrCode \u7edf\u4e00\u9519\u8bef\u7801\u8868\u5b9a\u4e49\u6bcf\u4e2a\u5931\u8d25\u7684\u4e1a\u52a1\u542b\u4e49&#xff1b;\u7528 x-allowed-transitions \u628a\u6587\u7ae0\u72b6\u6001\u673a\u516d\u6761\u8f6c\u79fb\u5199\u6b7b\u3002\u8fd9\u4e9b\u4e1c\u897f&#xff0c;\u662f Swagger \u6ce8\u89e3\u6839\u672c\u8868\u8fbe\u4e0d\u4e86\u7684\u2014\u2014\u6ce8\u89e3\u80fd\u8bf4&#034;\u8fd9\u4e2a\u53c2\u6570\u5fc5\u586b\u201d&#xff0c;\u8bf4\u4e0d\u4e86&#034;\u975e\u4f5c\u8005\u4e14\u975e\u7f16\u8f91\u8fd4\u56de 403 \u800c\u975e 404&#034;\u3002\u5951\u7ea6\u628a&#034;\u4e1a\u52a1\u89c4\u5219&#034;\u4e5f\u53d8\u6210\u4e86\u53ef\u88ab\u673a\u5668\u6821\u9a8c\u7684\u7ed3\u6784&#xff0c;\u8fd9\u662f\u5b83\u6bd4&#034;\u4ee3\u7801\u751f\u6210\u6587\u6863&#034;\u9ad8\u51fa\u4e00\u4e2a\u7ef4\u5ea6\u7684\u5730\u65b9\u3002<\/p>\n<p>\u6211\u4eec\u8fd9\u5957\u662f\u4e03\u7aef&#xff08;Node \/ Flutter \/ Taro \/ Go \/ Python \/ H5 \/ Admin&#xff09;\u5171\u7528\u4e00\u4e2a\u5951\u7ea6&#xff0c;\u5951\u7ea6\u4e00\u65e6\u8131\u8282&#xff0c;\u6240\u6709\u7aef\u90fd\u5f97\u8ddf\u7740\u9519\u2014\u2014\u6240\u4ee5\u673a\u5668\u95e8\u7981\u4e0d\u662f\u9526\u4e0a\u6dfb\u82b1&#xff0c;\u662f\u4e03\u7aef\u534f\u4f5c\u7684\u5e95\u7ebf\u3002\u6bd4\u5982 src\/shared\/response.ts \u7684\u7edf\u4e00\u4fe1\u5c01&#xff0c;\u548c\u5951\u7ea6\u91cc\u7684 ApiResponse \u7ec4\u4ef6\u662f\u4e25\u683c\u5bf9\u5e94\u7684&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ src\/shared\/response.ts \u2014 envelope \u6784\u9020\u5668<\/span><br \/>\n<span class=\"token keyword\">const<\/span> envelope <span class=\"token operator\">&#061;<\/span> <span class=\"token operator\">&lt;<\/span><span class=\"token constant\">T<\/span><span class=\"token operator\">&gt;<\/span><span class=\"token punctuation\">(<\/span>code<span class=\"token operator\">:<\/span> <span class=\"token builtin\">number<\/span><span class=\"token punctuation\">,<\/span> message<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><span class=\"token punctuation\">,<\/span> data<span class=\"token operator\">:<\/span> <span class=\"token constant\">T<\/span> <span class=\"token operator\">|<\/span> <span class=\"token keyword\">null<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> Envelope<span class=\"token operator\">&lt;<\/span><span class=\"token constant\">T<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token operator\">&#061;&gt;<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">{<\/span><br \/>\n  code<span class=\"token punctuation\">,<\/span><br \/>\n  message<span class=\"token punctuation\">,<\/span><br \/>\n  data<span class=\"token punctuation\">,<\/span><br \/>\n  requestId<span class=\"token operator\">:<\/span> <span class=\"token function\">requestId<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  timestamp<span class=\"token operator\">:<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">Date<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">toISOString<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u5951\u7ea6 ApiResponse \u4e0e\u4ee3\u7801 envelope \u5b57\u6bb5\u4e00\u4e00\u5bf9\u5e94&#xff1a;<\/p>\n<table>\n<tr>\u5951\u7ea6 ApiResponse \u5b57\u6bb5\u4ee3\u7801 envelope \u5b57\u6bb5\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>code&#xff08;ErrorCode \u679a\u4e3e&#xff09;<\/td>\n<td>code<\/td>\n<td>0&#061;\u6210\u529f&#xff0c;\u975e\u96f6&#061;\u4e1a\u52a1\u9519\u8bef\u7801<\/td>\n<\/tr>\n<tr>\n<td>message&#xff08;string&#xff09;<\/td>\n<td>message<\/td>\n<td>\u6210\u529f\u9ed8\u8ba4 ok&#xff0c;\u5931\u8d25\u53d6\u9519\u8bef\u7801\u6587\u6848<\/td>\n<\/tr>\n<tr>\n<td>data&#xff08;nullable&#xff09;<\/td>\n<td>data<\/td>\n<td>\u4e1a\u52a1\u6570\u636e&#xff0c;\u65e0\u6570\u636e\u65f6\u4e3a null<\/td>\n<\/tr>\n<tr>\n<td>requestId&#xff08;string&#xff09;<\/td>\n<td>requestId<\/td>\n<td>Web Crypto UUID&#xff0c;\u94fe\u8def\u8ffd\u8e2a\u7528<\/td>\n<\/tr>\n<tr>\n<td>timestamp&#xff08;date-time&#xff09;<\/td>\n<td>timestamp<\/td>\n<td>ISO 8601&#xff0c;\u4e0e\u4e1a\u52a1\u5b57\u6bb5\u65f6\u95f4\u683c\u5f0f\u4e00\u81f4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4fe1\u5c01\u957f\u4ec0\u4e48\u6837&#xff0c;\u5951\u7ea6\u8bf4\u4e86\u7b97&#xff0c;\u4e0d\u662f\u8def\u7531\u91cc\u968f\u624b\u5199\u7684\u3002\u5b9e\u73b0\u4e00\u65e6\u504f\u79bb\u5951\u7ea6&#xff0c;\u95e8\u7981\u5c31\u4f1a\u7ea2&#xff08;\u89c1\u7b2c\u4e09\u8282&#xff09;\u3002\u6587\u6863&#034;\u8131\u8282&#034;\u8fd9\u4ef6\u4e8b&#xff0c;\u4ece\u6839\u4e0a\u88ab\u6d88\u9664\u4e86&#xff0c;\u56e0\u4e3a\u6587\u6863\u5c31\u662f\u8fd9\u4e2a\u88ab\u673a\u5668\u6821\u9a8c\u7684\u5951\u7ea6\u3002<\/p>\n<h3>\u4e09\u3001\u53cc\u95e8\u6821\u9a8c&#xff1a;\u7ed3\u6784\u95e8 &#043; \u8bed\u4e49\u95e8<\/h3>\n<p>\u5149\u6709\u4e00\u4efd YAML \u8fd8\u4e0d\u591f&#xff0c;\u5f97\u6709\u4eba\u76ef\u7740&#034;\u4ee3\u7801\u548c\u5951\u7ea6\u771f\u7684\u5bf9\u9f50\u4e86&#034;\u3002\u6211\u4eec\u4e0a\u4e86\u4e24\u9053\u673a\u5668\u95e8\u7981&#xff0c;\u4efb\u4f55\u5951\u7ea6\u6539\u52a8\u540e\u90fd\u5fc5\u987b\u590d\u8dd1&#xff1a;<\/p>\n<ul>\n<li>\u7ed3\u6784\u95e8&#xff1a;openapi-spec-validator \u6821\u9a8c\u8fd9\u4efd YAML \u662f\u5408\u6cd5\u7684 OpenAPI \u6587\u6863\u2014\u2014\u5b57\u6bb5\u62fc\u9519\u3001\u5f15\u7528\u65ad\u94fe\u3001\u7248\u672c\u4e0d\u7b26&#xff0c;\u7acb\u523b\u62a5\u9519\u3002\u5b83\u5b88\u7684\u662f&#034;\u5951\u7ea6\u672c\u8eab\u5199\u5f97\u5bf9\u4e0d\u5bf9&#034;\u3002<\/li>\n<li>\u8bed\u4e49\u95e8&#xff1a;check_contract.py \u6821\u9a8c\u5951\u7ea6\u5185\u90e8\u7684\u4e00\u81f4\u6027\u2014\u2014\u9519\u8bef\u7801\u662f\u5426\u81ea\u6d3d\u3001\u6bcf\u4e2a\u7aef\u70b9\u7684 x-authz&#xff08;minRole &#043; ownerOverride&#xff09;\u662f\u5426\u95ed\u5408\u3001\u72b6\u6001\u673a\u77e9\u9635 x-allowed-transitions \u662f\u5426\u8986\u76d6\u516d\u6761\u8f6c\u79fb\u3001\u503c\u9519\u8bef\u7801\u96c6\u5408\u662f\u5426\u4e00\u81f4\u2026\u2026\u5b83\u5b88\u7684\u662f&#034;\u5951\u7ea6\u81ea\u5df1\u8bf4\u5f97\u901a\u4e0d\u901a&#034;\u3002<\/li>\n<\/ul>\n<p>\u4e3e\u4e2a\u8bed\u4e49\u95e8\u80fd\u6293\u3001\u7ed3\u6784\u95e8\u6293\u4e0d\u5230\u7684\u4f8b\u5b50&#xff1a;\u67d0\u4e2a\u7aef\u70b9\u58f0\u660e\u4e86 x-authz: { minRole: editor }&#xff0c;\u4f46\u8bed\u4e49\u95e8\u53d1\u73b0\u5b83\u7684\u9519\u8bef\u7801\u91cc\u6ca1\u6709\u5bf9\u5e94\u7684 403 \u5206\u652f\u2014\u2014\u7ed3\u6784\u4e0a\u95e8&#xff08;YAML \u5408\u6cd5&#xff09;\u5b8c\u5168\u653e\u884c&#xff0c;\u4f46\u903b\u8f91\u4e0a&#034;\u58f0\u660e\u8981\u9274\u6743\u5374\u6ca1\u5730\u65b9\u8fd4\u56de\u65e0\u6743\u9650&#034;\u8fd9\u4e2a\u77db\u76fe&#xff0c;\u53ea\u6709\u8bed\u4e49\u95e8\u80fd\u55c5\u51fa\u6765\u3002\u770b check_contract.py \u91cc R1 \u7684\u65ad\u8a00\u903b\u8f91&#xff1a;<\/p>\n<p><span class=\"token comment\"># docs\/api\/check_contract.py \u2014 x-authz \u673a\u5668\u5316\u6821\u9a8c&#xff08;R1&#xff09;<\/span><br \/>\n<span class=\"token keyword\">for<\/span> path<span class=\"token punctuation\">,<\/span> item <span class=\"token keyword\">in<\/span> spec<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;paths&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span>items<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> m<span class=\"token punctuation\">,<\/span> op <span class=\"token keyword\">in<\/span> item<span class=\"token punctuation\">.<\/span>items<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> m <span class=\"token keyword\">not<\/span> <span class=\"token keyword\">in<\/span> HTTP_METHODS<span class=\"token punctuation\">:<\/span><br \/>\n            <span class=\"token keyword\">continue<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> op<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;x-required-roles&#034;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">is<\/span> <span class=\"token keyword\">not<\/span> <span class=\"token boolean\">None<\/span> <span class=\"token keyword\">or<\/span> op<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;x-owner-resource&#034;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">is<\/span> <span class=\"token keyword\">not<\/span> <span class=\"token boolean\">None<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            r1_legacy<span class=\"token punctuation\">.<\/span>append<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>m<span class=\"token punctuation\">.<\/span>upper<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>path<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n        sec <span class=\"token operator\">&#061;<\/span> effective_security<span class=\"token punctuation\">(<\/span>item<span class=\"token punctuation\">,<\/span> op<span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> is_public<span class=\"token punctuation\">(<\/span>sec<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            <span class=\"token keyword\">continue<\/span><br \/>\n        n_login <span class=\"token operator\">&#043;&#061;<\/span> <span class=\"token number\">1<\/span><br \/>\n        az <span class=\"token operator\">&#061;<\/span> op<span class=\"token punctuation\">.<\/span>get<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;x-authz&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token keyword\">not<\/span> <span class=\"token builtin\">isinstance<\/span><span class=\"token punctuation\">(<\/span>az<span class=\"token punctuation\">,<\/span> <span class=\"token builtin\">dict<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">or<\/span> <span class=\"token string\">&#034;minRole&#034;<\/span> <span class=\"token keyword\">not<\/span> <span class=\"token keyword\">in<\/span> az<span class=\"token punctuation\">:<\/span><br \/>\n            r1_missing<span class=\"token punctuation\">.<\/span>append<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>m<span class=\"token punctuation\">.<\/span>upper<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>path<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n            <span class=\"token keyword\">continue<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> az<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;minRole&#034;<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token keyword\">not<\/span> <span class=\"token keyword\">in<\/span> ROLES<span class=\"token punctuation\">:<\/span><br \/>\n            r1_bad<span class=\"token punctuation\">.<\/span>append<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>m<span class=\"token punctuation\">.<\/span>upper<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>path<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> -&gt; minRole&#061;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>az<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;minRole&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u9010\u7aef\u70b9\u68c0\u67e5&#xff1a;\u9700\u767b\u5f55\u7684\u7aef\u70b9\u5fc5\u987b\u58f0\u660e x-authz.minRole&#xff0c;\u4e14\u53d6\u503c\u5fc5\u987b\u5728 member\/editor\/admin \u4e4b\u5185\u3002\u201c\u58f0\u660e\u9274\u6743\u5374\u6ca1\u5730\u65b9\u8fd4\u56de\u65e0\u6743\u9650&#034;\u8fd9\u7c7b\u903b\u8f91\u77db\u76fe&#xff0c;\u7531\u540e\u9762\u7684 N7 \u65ad\u8a00&#xff08;minRole\u2208{editor,admin} \u7684\u7aef\u70b9\u5fc5\u987b\u6302 403&#xff09;\u7ee7\u7eed\u628a\u4f4f\u2014\u2014\u4e24\u9053\u95e8\u5206\u5de5&#xff1a;\u7ed3\u6784\u95e8\u9632&#034;\u5199\u9519\u683c\u5f0f\u201d&#xff0c;\u8bed\u4e49\u95e8\u9632&#034;\u8bf4\u9519\u903b\u8f91&#034;\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260908054945-6a9fa1f96166a.png\" alt=\"\u53cc\u95e8\u6821\u9a8c\" \/><\/p>\n<p>\u843d\u5230\u65e5\u5e38&#xff0c;\u6539\u5951\u7ea6\u4e0d\u662f&#034;\u987a\u624b\u6539\u4e2a YAML&#034;&#xff0c;\u800c\u662f\u4e00\u5957\u56fa\u5b9a\u52a8\u4f5c&#xff1a;<\/p>\n<table>\n<tr>\u6b65\u9aa4\u52a8\u4f5c\u95e8\u7981\u72b6\u6001<\/tr>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>\u6539 openapi.v1.yaml&#xff08;\u5951\u7ea6\u5728\u524d&#xff09;<\/td>\n<td>\u2014<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>\u8dd1\u7ed3\u6784\u95e8 &#043; \u8bed\u4e49\u95e8<\/td>\n<td>\u53cc\u95e8\u7eff<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>\u6539\u4ee3\u7801\u5bf9\u9f50\u5951\u7ea6<\/td>\n<td>\u4ee3\u7801\u7f16\u8bd1\u901a\u8fc7<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>\u590d\u8dd1\u53cc\u95e8 &#043; \u6d4b\u8bd5<\/td>\n<td>\u5168\u90e8\u7eff<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>\u63d0\u4ea4<\/td>\n<td>\u2014<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5951\u7ea6\u5728\u524d\u3001\u5b9e\u73b0\u5728\u540e&#xff0c;\u987a\u5e8f\u4e0d\u80fd\u53cd&#xff0c;\u53cd\u4e86\u5c31\u4f1a\u6709\u4e00\u6bb5&#034;\u4ee3\u7801\u548c\u5951\u7ea6\u90fd\u4e0d\u7eff&#034;\u7684\u5c34\u5c2c\u7a97\u53e3\u3002\u4e24\u9053\u95e8\u5168\u7eff&#xff08;\u5f53\u524d\u662f 33 OK&#xff09;\u624d\u653e\u884c\u3002\u8fd9\u7b49\u4e8e\u628a&#034;\u6587\u6863\u5bf9\u4e0d\u5bf9&#034;\u4ece&#034;\u4eba\u8089 review&#034;\u53d8\u6210\u4e86&#034;\u6d41\u6c34\u7ebf\u81ea\u52a8\u5361\u70b9&#034;\u2014\u2014\u4f60\u6539\u4e86\u5951\u7ea6\u5374\u6ca1\u540c\u6b65\u4ee3\u7801&#xff0c;\u6216\u8005\u6539\u4e86\u4ee3\u7801\u5374\u6ca1\u540c\u6b65\u5951\u7ea6&#xff0c;\u95e8\u7981\u76f4\u63a5\u62d2\u7edd&#xff0c;\u7edd\u4e0d\u9760\u826f\u5fc3\u3002<\/p>\n<h3>\u56db\u3001P-16&#xff1a;\u4fe1\u5c01\u51b2\u7a81&#xff0c;\u4ee5\u5951\u7ea6\u4e3a\u51c6<\/h3>\n<p>&#034;\u5b9e\u73b0\u4e0d\u5f97\u504f\u79bb\u5951\u7ea6&#034;\u4e0d\u662f\u4e00\u53e5\u53e3\u53f7&#xff0c;\u5b83\u6765\u81ea\u4e00\u6b21\u771f\u5b9e\u7684\u51b2\u7a81&#xff08;P-16&#xff09;\u3002\u65e9\u671f\u6280\u672f\u65b9\u6848 \u00a73.1 \u81ea\u5df1\u8bbe\u8ba1\u4e86\u4e00\u5957\u54cd\u5e94\u4fe1\u5c01&#xff0c;\u548c\u5951\u7ea6\u91cc\u7684 ApiResponse \u76f4\u63a5\u77db\u76fe\u2014\u2014\u4e24\u8fb9\u5bf9 code \u7684\u8bed\u4e49\u3001\u6210\u529f\u65f6\u7684\u7ed3\u6784\u8bf4\u4e0d\u5230\u4e00\u5757\u53bb\u3002<\/p>\n<p>\u600e\u4e48\u88c1\u51b3&#xff1f;\u4ee5\u5951\u7ea6\u4e3a\u51c6&#xff0c;\u653e\u5f03\u8ba1\u5212\u91cc\u7684\u4fe1\u5c01\u3002\u56e0\u4e3a\u5951\u7ea6\u662f\u4e03\u7aef&#xff08;Node \/ Flutter \/ Taro \/ Go \/ Python \/ H5 \/ Admin&#xff09;\u5171\u540c\u4f9d\u8d56\u7684\u5730\u57fa&#xff0c;\u52a8\u4e86\u5b83\u5168\u94fe\u8def\u9707\u8361&#xff1b;\u800c\u67d0\u4e00\u7aef\u7684\u65e9\u671f\u65b9\u6848\u53ea\u662f\u8349\u7a3f&#xff0c;\u7406\u5e94\u5411\u5951\u7ea6\u770b\u9f50\u3002\u8fd9\u6b21\u51b2\u7a81\u6210\u4e86&#034;\u5951\u7ea6\u4f18\u5148&#034;\u6700\u751f\u52a8\u7684\u4e00\u8bfe&#xff1a;\u5f53&#034;\u4f60\u7684\u8bbe\u8ba1&#034;\u548c&#034;\u5951\u7ea6&#034;\u6253\u67b6&#xff0c;\u5148\u6000\u7591\u81ea\u5df1&#xff0c;\u518d\u6539\u5951\u7ea6\u2014\u2014\u800c\u4e14\u6539\u5951\u7ea6\u5fc5\u987b\u540c\u6b65\u6240\u6709\u95e8\u7981\u8bc1\u636e\u3002<\/p>\n<h3>\u4e94\u3001P-50&#xff1a;\u6ce8\u91ca \/ \u6587\u6863\u968f\u5951\u7ea6\u6f14\u8fdb&#xff08;\u6c89\u9ed8\u6280\u672f\u503a&#xff09;<\/h3>\n<p>\u5951\u7ea6\u4e0d\u662f\u5199\u5b8c\u5c31\u4e0d\u52a8\u7684\u3002\u5b83\u6f14\u8fdb\u65f6&#xff0c;\u6700\u9634\u9669\u7684\u526f\u4f5c\u7528\u662f\u6587\u6863\/\u6ce8\u91ca\u53d8 stale&#xff08;\u6c89\u9ed8\u6280\u672f\u503a&#xff09;&#xff1a;\u4f60\u6539\u4e86\u67d0\u4e2a\u9519\u8bef\u7801\u7684\u8bed\u4e49&#xff0c;\u4ee3\u7801\u91cc\u7684\u6ce8\u91ca\u3001README \u91cc\u7684\u8bf4\u660e\u3001\u9519\u8bef\u63d0\u793a\u6587\u6848\u8fd8\u505c\u7559\u5728\u65e7\u542b\u4e49&#xff0c;\u8bfb\u8005\u88ab\u6084\u6084\u8bef\u5bfc&#xff0c;\u4e14\u6ca1\u4eba\u62a5\u9519\u2014\u2014\u56e0\u4e3a\u5b83&#034;\u80fd\u7f16\u8bd1\u3001\u80fd\u8dd1&#034;&#xff0c;\u53ea\u662f\u8bf4\u9519\u4e86\u8bdd\u3002<\/p>\n<p>\u6211\u4eec\u7684\u7eaa\u5f8b&#xff08;P-50&#xff09;&#xff1a;\u51e1\u6539\u5951\u7ea6\u8bed\u4e49&#xff0c;grep \u5168\u4ed3\u7684\u6587\u6848\u4e00\u5e76\u66f4\u65b0\u3002\u9519\u8bef\u7801\u542b\u4e49\u53d8\u4e86&#xff0c;\u5c31\u628a\u6240\u6709\u5f15\u7528\u8fd9\u4e2a\u7801\u7684\u4e2d\u6587\u6ce8\u91ca\u3001\u63d0\u793a\u8bed\u3001\u6587\u6863\u6bb5\u843d\u641c\u51fa\u6765\u540c\u6b65&#xff1b;\u4e0d\u80fd\u53ea\u6539 codes.ts \u5c31\u5b8c\u4e8b\u3002\u8ba9&#034;\u6539\u4e00\u5904\u8bed\u4e49&#034;\u548c&#034;\u5168\u4ed3\u6587\u6848\u5bf9\u9f50&#034;\u6210\u4e3a\u540c\u4e00\u4e2a\u52a8\u4f5c&#xff0c;\u6280\u672f\u503a\u624d\u4e0d silent \u5730\u5806\u79ef\u3002\u8fd9\u4e60\u60ef\u770b\u7740\u5570\u55e6&#xff0c;\u4f46\u80fd\u6551\u547d\u2014\u2014\u66fe\u6709\u4e00\u6b21\u53ea\u6539\u4e86\u9519\u8bef\u7801\u6570\u5b57&#xff0c;\u5fd8\u4e86\u540c\u6b65\u67d0\u5904\u6ce8\u91ca&#xff0c;\u540e\u6765\u6709\u4eba\u7167\u90a3\u53e5\u65e7\u6ce8\u91ca\u5199\u65b0\u529f\u80fd&#xff0c;\u57cb\u4e86\u4e2a\u9690\u853d\u7684\u903b\u8f91\u5751&#xff0c;\u56de\u5934\u67e5\u8d77\u6765\u8d39\u4e86\u8001\u52b2\u3002<\/p>\n<h3>\u516d\u3001P-51&#xff1a;README \u6570\u5b57\u4ee5\u5b9e\u6d4b\u4e3a\u51c6&#xff0c;\u4e0d\u6284\u65e7\u6570<\/h3>\n<p>\u6587\u6863\u7eaa\u5f8b\u8fd8\u6709\u4e00\u4e2a\u5e38\u88ab\u5ffd\u89c6\u7684\u70b9&#xff1a;\u6570\u5b57\u5fc5\u987b\u6765\u81ea\u5b9e\u6d4b&#xff0c;\u4e0d\u80fd\u4ece\u65e7\u6587\u6863\u6284\u3002\u6bd4\u5982 README \u91cc\u7684\u76ee\u5f55\u6811\u662f\u4e00\u4efd&#034;\u627f\u8bfa&#034;\u2014\u2014\u5b83\u8bf4\u6709 routes \/ services \/ shared \/ types \u51e0\u4e2a\u76ee\u5f55&#xff0c;\u4f60\u5c31\u5f97 ls \u5bf9\u5f97\u4e0a&#xff0c;\u591a\u4e00\u4e2a\u5c11\u4e00\u4e2a\u90fd\u662f\u8c0e\u3002\u518d\u6bd4\u5982\u6d4b\u8bd5\u901a\u8fc7\u6570&#xff1a;\u6211\u4eec\u66fe\u6709\u4e00\u6bb5\u4ece\u65e7\u6587\u6863\u6284\u6765\u7684&#034;126 passed&#034;&#xff0c;\u4f46\u5b9e\u9645\u95e8\u7981\u8dd1\u51fa\u6765\u662f 133 passed&#xff08;\u8fc7\u7a0b\u4e2d\u8865\u4e86\u6d4b\u8bd5&#xff09;\u3002\u6b63\u786e\u505a\u6cd5\u662f\u4ee5\u5b9e\u8dd1\u4e3a\u51c6&#xff0c;\u628a README \u6539\u6210 133&#xff0c;\u800c\u4e0d\u662f\u628a\u5b9e\u8dd1\u7ed3\u679c&#034;\u51d1&#034;\u6210\u6587\u6863\u91cc\u7684\u65e7\u6570\u3002\u6587\u6863\u7684\u53ef\u4fe1\u5ea6&#xff0c;\u5c31\u662f\u9760\u8fd9\u79cd&#034;\u6570\u5b57\u5b81\u53ef\u4ece\u5934\u8dd1\u4e00\u904d&#034;\u7684\u8f83\u771f\u5806\u51fa\u6765\u7684\u3002\u6bd4\u5982 README \u5199&#034;\u6d4b\u8bd5\u8986\u76d6\u82e5\u5e72\u6a21\u5757&#034;&#xff0c;\u4f60\u5c31\u771f\u53bb\u6570\u6a21\u5757\u6570&#xff1b;\u5199&#034;\u8def\u7531 N \u4e2a\u6587\u4ef6&#034;&#xff0c;\u5c31 ls routes | wc -l \u6838\u5bf9\u3002\u627f\u8bfa\u548c\u73b0\u5b9e\u5bf9\u4e0d\u4e0a\u7684\u90a3\u4e00\u523b&#xff0c;\u5c31\u662f\u6587\u6863\u5f00\u59cb\u5931\u4fe1\u7684\u5f00\u59cb\u3002<\/p>\n<h3>\u4e03\u3001\u5c0f\u7ed3\u4e0e\u524d\u77bb<\/h3>\n<p>\u63a5\u53e3\u6587\u6863\u81ea\u52a8\u5316\u7684\u672c\u8d28&#xff0c;\u4e0d\u662f&#034;\u600e\u4e48\u751f\u6210\u6587\u6863&#034;&#xff0c;\u800c\u662f&#034;\u600e\u4e48\u8ba9\u6587\u6863\u4e0d\u53ef\u80fd\u9519&#034;&#xff1a;<\/p>\n<li>\u8131\u8282\u6839\u56e0&#xff1a;\u6587\u6863\u548c\u4ee3\u7801\u662f&#034;\u4e24\u6837\u4e1c\u897f&#034;&#xff0c;\u8c01\u5148\u52a8\u8c01\u8131\u8282&#xff1b;\u624b\u5199\u4f1a\u5fd8\u6539&#xff0c;\u4ee3\u7801\u751f\u6210\u4e5f\u53ea\u662f\u526f\u4ea7\u7269\u3002<\/li>\n<li>\u5951\u7ea6\u5373\u6587\u6863&#xff1a;openapi.v1.yaml&#xff08;OpenAPI 3.1&#xff09;\u662f\u5355\u4e00\u4e8b\u5b9e\u6e90&#xff1b;\u4ee3\u7801\u88ab\u5951\u7ea6\u7ea6\u675f\u800c\u975e\u751f\u6210\u6587\u6863\u3002response.ts \u4fe1\u5c01\u4e25\u683c\u5bf9\u9f50\u5951\u7ea6 ApiResponse\u3002<\/li>\n<li>\u53cc\u95e8\u6821\u9a8c&#xff1a;\u7ed3\u6784\u95e8&#xff08;openapi-spec-validator&#xff09;&#043; \u8bed\u4e49\u95e8&#xff08;check_contract.py&#xff0c;33 OK&#xff09;&#xff1b;\u5951\u7ea6\u6539\u52a8\u540e\u5fc5\u590d\u8dd1\u3002<\/li>\n<li>P-16&#xff1a;\u65e9\u671f\u65b9\u6848\u4fe1\u5c01\u4e0e\u5951\u7ea6\u77db\u76fe&#xff0c;\u4ee5\u5951\u7ea6\u4e3a\u51c6\u653e\u5f03\u8ba1\u5212\u4fe1\u5c01\u2014\u2014&#034;\u5b9e\u73b0\u4e0d\u5f97\u504f\u79bb\u5951\u7ea6&#034;\u7684\u7b2c\u4e00\u8bfe\u3002<\/li>\n<li>P-50&#xff1a;\u6539\u5951\u7ea6\u8bed\u4e49\u987b grep \u5168\u4ed3\u6587\u6848\u540c\u6b65&#xff0c;\u9632\u6c89\u9ed8\u6280\u672f\u503a\u3002<\/li>\n<li>P-51&#xff1a;README \u76ee\u5f55\u6811\u662f\u627f\u8bfa\u8981 ls \u5bf9\u5f97\u4e0a&#xff1b;\u6d4b\u8bd5\u6570 126\u2192133 \u4ee5\u5b9e\u6d4b\u4e3a\u51c6&#xff0c;\u4e0d\u6284\u65e7\u6587\u6863\u3002<\/li>\n<p>\u4e0b\u4e00\u7bc7&#xff08;{{LINK:M1-21}}&#xff09;\u6211\u4eec\u804a&#034;\u540e\u7aef\u6d4b\u8bd5\u7b56\u7565&#034;&#xff1a;\u5355\u5143\u6d4b\u8bd5\u3001\u96c6\u6210\u6d4b\u8bd5\u3001\u6d4b\u8bd5\u6570\u636e\u5e93\u600e\u4e48\u642d&#xff0c;\u4ee5\u53ca\u4e3a\u4ec0\u4e48&#034;\u95e8\u7981\u5168\u7eff \u2260 \u6ca1\u7f3a\u9677&#034;\u3002<\/p>\n<hr \/>\n<p>\u5982\u679c\u8fd9\u7bc7\u6587\u7ae0\u5bf9\u4f60\u6709\u5e2e\u52a9&#xff0c;\u6b22\u8fce\u8ba2\u9605\u6211\u7684 CSDN \u4e13\u680f \u300c\u6210\u4e3a\u5168\u6808\u300d&#xff1a;<\/p>\n<p>&#x1f517; \u4e13\u680f\u5730\u5740&#xff1a;https:\/\/blog.csdn.net\/fungleo\/category_13204651.html<\/p>\n<p>&#x1f4e6; \u672c\u7cfb\u5217\u914d\u5957\u4ee3\u7801\u4ed3\u5e93&#xff1a;https:\/\/github.com\/fengcms\/become-a-full-stack-developer<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260908054948-6a9fa1fc59dca.png\" alt=\"\u6210\u4e3a\u5168\u6808\u4e13\u680f\u8ba2\u9605\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6210\u4e3a\u5168\u6808\u00b7Node \u540e\u7aef\u7bc7\u00b7\u63a5\u53e3\u6587\u6863\u81ea\u52a8\u5316&#xff1a;\u8ba9 OpenAPI \u4e0e\u4ee3\u7801\u4e0d\u8131\u8282<br \/>\n\u65b0\u4eba\u5165\u804c\u7b2c\u4e00\u5929&#xff0c;\u7167\u7740 Swagger \u8c03\u63a5\u53e3&#xff0c;\u7ed3\u679c\u8c03\u51fa\u4e00\u4e2a 500\u3002\u53bb\u95ee\u540e\u7aef&#xff0c;\u540e\u7aef\u8bf4\\&#8221;\u8fd9\u4e2a\u5b57\u6bb5\u4e0a\u5468\u5c31\u6539\u4e86&#xff0c;\u6587\u6863\u6ca1\u987e\u4e0a\\&#8221;\u3002\u8fd9\u7c7b\u4e8b\u7684\u6839\u56e0\u4e0d\u662f\u8c01\u5077\u61d2&#xff0c;\u800c\u662f\u6587\u6863\u548c\u4ee3\u7801\u672c\u6765\u5c31\u662f\u4e24\u4efd\u4e1c\u897f\u2014\u2014\u53ea\u8981\u5b58\u5728\u4e24\u4efd&#xff0c;\u5b83\u4eec\u8fdf\u65e9\u4f1a\u6f02\u79fb\u3002 \u8fd9\u4e00\u7bc7\u4e0d\u8bb2\\&#8221;\u600e\u4e48\u81ea\u52a8\u751f\u6210\u6587\u6863\\&#8221;&#xff0c;\u800c\u662f\u8bb2\u66f4\u5f7b\u5e95\u7684\u89e3\u6cd5&#xff1a;\u8ba9\u5951\u7ea6\u672c\u8eab\u6210<\/p>\n","protected":false},"author":2,"featured_media":102325,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[11687,11653,11686,11688,186],"topic":[],"class_list":["post-102329","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-openapi","tag-11653","tag-11686","tag-11688","tag-node-js"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6210\u4e3a\u5168\u6808\u00b7Node \u540e\u7aef\u7bc7\u00b7\u63a5\u53e3\u6587\u6863\u81ea\u52a8\u5316\uff1a\u8ba9 OpenAPI \u4e0e\u4ee3\u7801\u4e0d\u8131\u8282 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/102329.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6210\u4e3a\u5168\u6808\u00b7Node \u540e\u7aef\u7bc7\u00b7\u63a5\u53e3\u6587\u6863\u81ea\u52a8\u5316\uff1a\u8ba9 OpenAPI \u4e0e\u4ee3\u7801\u4e0d\u8131\u8282 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6210\u4e3a\u5168\u6808\u00b7Node \u540e\u7aef\u7bc7\u00b7\u63a5\u53e3\u6587\u6863\u81ea\u52a8\u5316&#xff1a;\u8ba9 OpenAPI \u4e0e\u4ee3\u7801\u4e0d\u8131\u8282 \u65b0\u4eba\u5165\u804c\u7b2c\u4e00\u5929&#xff0c;\u7167\u7740 Swagger \u8c03\u63a5\u53e3&#xff0c;\u7ed3\u679c\u8c03\u51fa\u4e00\u4e2a 500\u3002\u53bb\u95ee\u540e\u7aef&#xff0c;\u540e\u7aef\u8bf4&quot;\u8fd9\u4e2a\u5b57\u6bb5\u4e0a\u5468\u5c31\u6539\u4e86&#xff0c;\u6587\u6863\u6ca1\u987e\u4e0a&quot;\u3002\u8fd9\u7c7b\u4e8b\u7684\u6839\u56e0\u4e0d\u662f\u8c01\u5077\u61d2&#xff0c;\u800c\u662f\u6587\u6863\u548c\u4ee3\u7801\u672c\u6765\u5c31\u662f\u4e24\u4efd\u4e1c\u897f\u2014\u2014\u53ea\u8981\u5b58\u5728\u4e24\u4efd&#xff0c;\u5b83\u4eec\u8fdf\u65e9\u4f1a\u6f02\u79fb\u3002 \u8fd9\u4e00\u7bc7\u4e0d\u8bb2&quot;\u600e\u4e48\u81ea\u52a8\u751f\u6210\u6587\u6863&quot;&#xff0c;\u800c\u662f\u8bb2\u66f4\u5f7b\u5e95\u7684\u89e3\u6cd5&#xff1a;\u8ba9\u5951\u7ea6\u672c\u8eab\u6210\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/102329.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-08T05:49:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260908054939-6a9fa1f3161d3.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/102329.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/102329.html\",\"name\":\"\u6210\u4e3a\u5168\u6808\u00b7Node \u540e\u7aef\u7bc7\u00b7\u63a5\u53e3\u6587\u6863\u81ea\u52a8\u5316\uff1a\u8ba9 OpenAPI \u4e0e\u4ee3\u7801\u4e0d\u8131\u8282 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-08T05:49:50+00:00\",\"dateModified\":\"2026-09-08T05:49:50+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/102329.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/102329.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/102329.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6210\u4e3a\u5168\u6808\u00b7Node \u540e\u7aef\u7bc7\u00b7\u63a5\u53e3\u6587\u6863\u81ea\u52a8\u5316\uff1a\u8ba9 OpenAPI \u4e0e\u4ee3\u7801\u4e0d\u8131\u8282\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u6210\u4e3a\u5168\u6808\u00b7Node \u540e\u7aef\u7bc7\u00b7\u63a5\u53e3\u6587\u6863\u81ea\u52a8\u5316\uff1a\u8ba9 OpenAPI \u4e0e\u4ee3\u7801\u4e0d\u8131\u8282 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/102329.html","og_locale":"zh_CN","og_type":"article","og_title":"\u6210\u4e3a\u5168\u6808\u00b7Node \u540e\u7aef\u7bc7\u00b7\u63a5\u53e3\u6587\u6863\u81ea\u52a8\u5316\uff1a\u8ba9 OpenAPI \u4e0e\u4ee3\u7801\u4e0d\u8131\u8282 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6210\u4e3a\u5168\u6808\u00b7Node \u540e\u7aef\u7bc7\u00b7\u63a5\u53e3\u6587\u6863\u81ea\u52a8\u5316&#xff1a;\u8ba9 OpenAPI \u4e0e\u4ee3\u7801\u4e0d\u8131\u8282 \u65b0\u4eba\u5165\u804c\u7b2c\u4e00\u5929&#xff0c;\u7167\u7740 Swagger \u8c03\u63a5\u53e3&#xff0c;\u7ed3\u679c\u8c03\u51fa\u4e00\u4e2a 500\u3002\u53bb\u95ee\u540e\u7aef&#xff0c;\u540e\u7aef\u8bf4\"\u8fd9\u4e2a\u5b57\u6bb5\u4e0a\u5468\u5c31\u6539\u4e86&#xff0c;\u6587\u6863\u6ca1\u987e\u4e0a\"\u3002\u8fd9\u7c7b\u4e8b\u7684\u6839\u56e0\u4e0d\u662f\u8c01\u5077\u61d2&#xff0c;\u800c\u662f\u6587\u6863\u548c\u4ee3\u7801\u672c\u6765\u5c31\u662f\u4e24\u4efd\u4e1c\u897f\u2014\u2014\u53ea\u8981\u5b58\u5728\u4e24\u4efd&#xff0c;\u5b83\u4eec\u8fdf\u65e9\u4f1a\u6f02\u79fb\u3002 \u8fd9\u4e00\u7bc7\u4e0d\u8bb2\"\u600e\u4e48\u81ea\u52a8\u751f\u6210\u6587\u6863\"&#xff0c;\u800c\u662f\u8bb2\u66f4\u5f7b\u5e95\u7684\u89e3\u6cd5&#xff1a;\u8ba9\u5951\u7ea6\u672c\u8eab\u6210","og_url":"https:\/\/www.wsisp.com\/helps\/102329.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-08T05:49:50+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260908054939-6a9fa1f3161d3.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/102329.html","url":"https:\/\/www.wsisp.com\/helps\/102329.html","name":"\u6210\u4e3a\u5168\u6808\u00b7Node \u540e\u7aef\u7bc7\u00b7\u63a5\u53e3\u6587\u6863\u81ea\u52a8\u5316\uff1a\u8ba9 OpenAPI \u4e0e\u4ee3\u7801\u4e0d\u8131\u8282 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-08T05:49:50+00:00","dateModified":"2026-09-08T05:49:50+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/102329.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/102329.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/102329.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u6210\u4e3a\u5168\u6808\u00b7Node \u540e\u7aef\u7bc7\u00b7\u63a5\u53e3\u6587\u6863\u81ea\u52a8\u5316\uff1a\u8ba9 OpenAPI \u4e0e\u4ee3\u7801\u4e0d\u8131\u8282"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/102329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=102329"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/102329\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/102325"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=102329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=102329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=102329"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=102329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}