{"id":112321,"date":"2026-10-03T02:17:50","date_gmt":"2026-10-02T18:17:50","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/112321.html"},"modified":"2026-10-03T02:17:50","modified_gmt":"2026-10-02T18:17:50","slug":"graphql-yoga-%e5%ae%89%e5%85%a8%e5%8a%a0%e5%9b%ba%e5%ae%9e%e6%88%98%ef%bc%9a%e7%94%a8-graphql-armor-%e4%b8%ba-graphql-%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%8a%a0%e8%a3%85%e6%a0%a1%e9%aa%8c%e6%8a%a4%e6%a0%8f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/112321.html","title":{"rendered":"GraphQL Yoga \u5b89\u5168\u52a0\u56fa\u5b9e\u6218\uff1a\u7528 GraphQL Armor \u4e3a GraphQL \u670d\u52a1\u5668\u52a0\u88c5\u6821\u9a8c\u62a4\u680f"},"content":{"rendered":"<ul class=\"gcb-tag-list\">\n<li><span class=\"gcb-tag\">\u540e\u7aef<\/span><\/li>\n<li><span class=\"gcb-tag\">API\u8bbe\u8ba1<\/span><\/li>\n<\/ul>\n<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011graphql-yoga<\/h3>\n<p class=\"gcb-project-desc\">&#x1f9d8; Rewrite of a fully-featured GraphQL Server with focus on easy setup, performance &amp; great developer experience. The core of Yoga implements WHATWG Fetch API and can run\/deploy on any JS environment.<\/p>\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/gh_mirrors\/gr\/graphql-yoga<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<p>\u672c\u7bc7\u4ee5 GraphQL Yoga \u4ed3\u5e93\u4e2d\u7684 examples\/graphql-armor \u793a\u4f8b\u4e3a\u4e3b\u4f53&#xff0c;\u8bb2\u89e3\u5982\u4f55\u628a GraphQL Armor \u8fd9\u4e00\u57fa\u4e8e Envelop \u7684\u5b89\u5168\u4e2d\u95f4\u4ef6\u96c6\u6210\u8fdb createYoga \u521b\u5efa\u7684\u670d\u52a1\u5668&#xff0c;\u5b9e\u73b0\u5bf9\u6076\u610f\u6216\u5f02\u5e38 GraphQL \u8bf7\u6c42\u7684\u62e6\u622a\u3002\u8bfb\u5b8c\u672c\u6587&#xff0c;\u4f60\u5c06\u80fd\u591f\u5728\u672c\u4ed3\u5e93\u793a\u4f8b\u57fa\u7840\u4e0a\u72ec\u7acb\u914d\u7f6e Armor \u63d2\u4ef6\u3001\u7406\u89e3\u5176\u63d2\u4ef6\u6ce8\u5165 Envelop \u7f16\u6392\u5668\u7684\u5e95\u5c42\u94fe\u8def&#xff0c;\u5e76\u901a\u8fc7 curl \u4e0e\u96c6\u6210\u6d4b\u8bd5\u9a8c\u8bc1\u5404\u9879\u9632\u62a4\u63aa\u65bd\u7684\u751f\u6548\u6548\u679c\u3002<\/p>\n<h3>\u793a\u4f8b\u5b9a\u4f4d\u4e0e\u5feb\u901f\u4e0a\u624b<\/h3>\n<p>examples\/graphql-armor \u662f\u4e00\u4e2a\u53ef\u72ec\u7acb\u8fd0\u884c\u7684\u6700\u5c0f\u5316\u793a\u4f8b&#xff0c;\u5176 package.json \u4e2d\u7684\u63cf\u8ff0\u4e3a &#034;Adding security layer to GraphQL Yoga using GraphQL Armor&#034;\u3002\u76ee\u5f55\u7ed3\u6784\u975e\u5e38\u7b80\u6d01&#xff1a;<\/p>\n<ul>\n<li>examples\/graphql-armor\/src\/yoga.ts&#xff1a;\u521b\u5efa Yoga \u5b9e\u4f8b\u5e76\u6302\u8f7d Armor \u63d2\u4ef6&#xff1b;<\/li>\n<li>examples\/graphql-armor\/src\/main.ts&#xff1a;\u57fa\u4e8e node:http \u542f\u52a8 HTTP \u670d\u52a1&#xff1b;<\/li>\n<li>examples\/graphql-armor\/integration-tests\/graphql-armor.spec.ts&#xff1a;\u9a8c\u8bc1\u9632\u62a4\u884c\u4e3a\u7684\u96c6\u6210\u6d4b\u8bd5\u3002<\/li>\n<\/ul>\n<p>\u5728\u4ed3\u5e93\u6839\u76ee\u5f55\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5373\u53ef\u542f\u52a8\u793a\u4f8b\u670d\u52a1&#xff08;\u8be5\u793a\u4f8b\u901a\u8fc7 pnpm workspace \u7684 &#8211;filter \u5b9a\u4f4d\u5230 example-graphql-armor \u5305&#xff09;&#xff1a;<\/p>\n<p>pnpm &#8211;filter example-graphql-armor start<\/p>\n<p>\u670d\u52a1\u542f\u52a8\u540e\u76d1\u542c 4000 \u7aef\u53e3&#xff0c;\u7aef\u70b9\u4e3a \/graphql&#xff08;\u89c1 examples\/graphql-armor\/src\/main.ts \u4e2d\u7684 server.listen(4000, &#8230;) \u4e0e yoga.graphqlEndpoint \u62fc\u63a5\u65e5\u5fd7&#xff09;\u3002\u5176\u4f9d\u8d56\u9501\u5b9a\u4e3a &#064;escape.tech\/graphql-armor&#064;3.1.7\u3001graphql&#064;17.0.2 \u4e0e workspace \u5185\u7684 graphql-yoga&#xff08;\u89c1 examples\/graphql-armor\/package.json&#xff09;&#xff0c;\u56e0\u6b64\u672c\u6587\u63cf\u8ff0\u7684\u884c\u4e3a\u5747\u4ee5\u6b64\u4e3a\u9002\u7528\u524d\u63d0\u3002<\/p>\n<h3>\u6838\u5fc3\u5b9e\u73b0&#xff1a;\u628a Armor \u63d2\u4ef6\u4ea4\u7ed9 createYoga<\/h3>\n<p>\u793a\u4f8b\u7684\u6838\u5fc3\u4ee3\u7801\u5728 examples\/graphql-armor\/src\/yoga.ts&#xff1a;<\/p>\n<p>import { versionInfo } from &#039;graphql&#039;;<br \/>\nimport { createSchema, createYoga, Plugin } from &#039;graphql-yoga&#039;;<br \/>\nimport { EnvelopArmor } from &#039;&#064;escape.tech\/graphql-armor&#039;;<\/p>\n<p>const armor &#061; new EnvelopArmor();<br \/>\nconst enhancements &#061; armor.protect();<\/p>\n<p>export const yoga &#061; createYoga({<br \/>\n  plugins: [<br \/>\n    &#8230;enhancements.plugins,<br \/>\n    \/\/ In GraphQL&gt;&#061;17 we have the &#096;hideSuggesstions&#096; option instead.<br \/>\n    &#8230;(versionInfo.major &gt;&#061; 17<br \/>\n      ? [<br \/>\n          {<br \/>\n            onValidate(params) {<br \/>\n              params.setValidationFn((s, d, r, options) &#061;&gt;<br \/>\n                params.validateFn(s, d, r, { &#8230;options, hideSuggestions: true }),<br \/>\n              );<br \/>\n            },<br \/>\n          } satisfies Plugin,<br \/>\n        ]<br \/>\n      : []),<br \/>\n  ],<br \/>\n  schema: createSchema({<br \/>\n    typeDefs: \/* GraphQL *\/ &#096;<br \/>\n      type Book {<br \/>\n        title: String<br \/>\n        author: String<br \/>\n      }<br \/>\n      type Query {<br \/>\n        books: [Book]<br \/>\n      }<br \/>\n    &#096;,<br \/>\n    resolvers: {<br \/>\n      Query: {<br \/>\n        books: () &#061;&gt; booksStore,<br \/>\n      },<br \/>\n    },<br \/>\n  }),<br \/>\n});<\/p>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u5305\u542b\u4e09\u5c42\u5173\u952e\u4fe1\u606f&#xff1a;<\/p>\n<li>Armor \u521d\u59cb\u5316\u4e0e\u63d2\u4ef6\u63d0\u53d6&#xff1a;new EnvelopArmor() \u521b\u5efa\u9632\u62a4\u5668\u5b9e\u4f8b&#xff0c;armor.protect() \u8fd4\u56de\u7684 enhancements.plugins \u662f\u4e00\u7ec4 Envelop \u63d2\u4ef6&#xff0c;\u76f4\u63a5\u5c55\u5f00\u8fdb createYoga \u7684 plugins \u6570\u7ec4\u5373\u53ef\u751f\u6548\u2014\u2014\u65e0\u9700\u4efb\u4f55\u9002\u914d\u5c42&#xff0c;\u56e0\u4e3a Yoga \u7684\u63d2\u4ef6\u4f53\u7cfb\u672c\u8eab\u5c31\u662f Envelop \u63d2\u4ef6\u4f53\u7cfb\u3002<\/li>\n<li>GraphQL 17 \u7684\u517c\u5bb9\u6027\u5206\u652f&#xff1a;\u4ece\u6e90\u7801\u7ed3\u6784\u770b&#xff0c;GraphQL 17 \u8d77 graphql-js \u63d0\u4f9b\u4e86\u539f\u751f\u7684 hideSuggestions \u6821\u9a8c\u9009\u9879\u3002\u793a\u4f8b\u636e\u6b64\u7528 versionInfo.major &gt;&#061; 17 \u505a\u4e86\u5206\u652f&#xff1a;\u5728 17 \u53ca\u4ee5\u4e0a\u7248\u672c&#xff0c;\u901a\u8fc7\u4e00\u4e2a\u989d\u5916\u7684 onValidate \u94a9\u5b50\u63d2\u4ef6&#xff0c;\u7528 params.setValidationFn \u5305\u88c5\u539f\u59cb validateFn&#xff0c;\u628a hideSuggestions: true \u5408\u5e76\u8fdb\u6821\u9a8c\u9009\u9879&#xff0c;\u8ba9\u5b98\u65b9\u6821\u9a8c\u5668\u81ea\u8eab\u4e0d\u518d\u8f93\u51fa\u5b57\u6bb5\u5efa\u8bae&#xff1b;\u4f4e\u4e8e 17 \u7684\u7248\u672c\u5219\u4f9d\u8d56 Armor \u81ea\u8eab\u7684\u5efa\u8bae\u5c4f\u853d\u80fd\u529b\u3002<\/li>\n<li>schema \u4e0e resolver&#xff1a;createSchema \u5b9a\u4e49\u4e86 Book \u7c7b\u578b\u548c books \u67e5\u8be2&#xff0c;\u6570\u636e\u6765\u81ea\u5185\u5b58\u4e2d\u7684 booksStore \u6570\u7ec4&#xff08;\u4e24\u672c\u4e66&#xff09;&#xff0c;\u4e3a\u540e\u7eed\u9a8c\u8bc1 curl \u8bf7\u6c42\u63d0\u4f9b\u4e86\u53ef\u9884\u671f\u7684\u56fa\u5b9a\u54cd\u5e94\u3002<\/li>\n<h4>Armor \u63d2\u4ef6\u4e3a\u4f55\u80fd\u76f4\u63a5\u6ce8\u5165 Yoga<\/h4>\n<p>createYoga \u7684 plugins \u53c2\u6570\u63a5\u53d7\u7684\u5c31\u662f Envelop \u63d2\u4ef6\u3002\u4ece packages\/graphql-yoga \u7684\u5165\u53e3 packages\/graphql-yoga\/src\/index.ts \u53ef\u4ee5\u770b\u5230&#xff0c;Yoga \u76f4\u63a5\u900f\u4f20\u4e86 &#064;envelop\/core \u7684 envelop\u3001useEnvelop\u3001useExtendContext \u7b49\u6838\u5fc3\u80fd\u529b&#xff0c;\u5e76\u5bfc\u51fa\u4e86 Plugin \u7c7b\u578b&#xff08;packages\/graphql-yoga\/src\/plugins\/types.js&#xff09;\u3002\u56e0\u6b64 enhancements.plugins \u4e0e\u666e\u901a Yoga \u5185\u7f6e\u63d2\u4ef6\u5904\u4e8e\u540c\u4e00\u6267\u884c\u94fe\u4e0a&#xff1a;\u6bcf\u4e2a\u63d2\u4ef6\u7684 onValidate\u3001onExecute \u7b49\u94a9\u5b50\u90fd\u4f1a\u88ab Envelop \u7f16\u6392\u5668\u7edf\u4e00\u8c03\u5ea6\u3002<\/p>\n<p>\u6821\u9a8c\u51fd\u6570\u7684\u66ff\u6362\u673a\u5236\u53ef\u5728 Envelop \u6838\u5fc3\u6e90\u7801\u4e2d\u5370\u8bc1\u3002packages\/envelop\/core\/src\/orchestrator.ts \u4e2d&#xff0c;\u7f16\u6392\u5668\u7ef4\u62a4\u4e00\u4e2a\u53ef\u53d8\u7684 validateFn&#xff08;\u521d\u59cb\u4e3a graphql \u5305\u5bfc\u51fa\u7684 validate&#xff09;&#xff0c;\u5e76\u901a\u8fc7 onValidate \u94a9\u5b50\u53c2\u6570\u66b4\u9732 setValidationFn \u4f9b\u63d2\u4ef6\u66ff\u6362&#xff0c;\u6700\u7ec8\u6267\u884c\u6821\u9a8c\u65f6\u8c03\u7528\u7684\u662f\u88ab\u66ff\u6362\u540e\u7684 validateFn\u3002\u793a\u4f8b\u4e2d GraphQL 17 \u5206\u652f\u91cc params.setValidationFn(&#8230;) \u6b63\u662f\u5229\u7528\u8fd9\u4e00\u673a\u5236&#xff0c;\u5728\u4e0d\u4fee\u6539 Armor \u8f93\u51fa\u7684\u524d\u63d0\u4e0b\u8ffd\u52a0 hideSuggestions \u9009\u9879\u3002<\/p>\n<h3>\u652f\u6301\u7684\u5b89\u5168\u63aa\u65bd<\/h3>\n<p>README \u58f0\u660e\u8be5\u793a\u4f8b&#xff08;\u914d\u5408 Armor \u9ed8\u8ba4\u914d\u7f6e&#xff09;\u8986\u76d6\u4ee5\u4e0b\u6574\u6539\u63aa\u65bd&#xff08;remediations&#xff09;&#xff1a;<\/p>\n<ul>\n<li>Aliases Limit&#xff1a;\u9650\u5236\u522b\u540d\u6570\u91cf&#xff0c;\u9632\u6b62\u901a\u8fc7\u6d77\u91cf\u522b\u540d\u653e\u5927\u6267\u884c\u6210\u672c&#xff1b;<\/li>\n<li>Character Limit&#xff1a;\u9650\u5236\u67e5\u8be2\u6587\u6863\u603b\u5b57\u7b26\u6570&#xff0c;\u62e6\u622a\u8d85\u957f\u67e5\u8be2&#xff1b;<\/li>\n<li>Cost Limit&#xff1a;\u6309\u67e5\u8be2\u590d\u6742\u5ea6\u6210\u672c\u8fdb\u884c\u9650\u5236&#xff1b;<\/li>\n<li>Depth Limit&#xff1a;\u9650\u5236\u67e5\u8be2\u5b57\u6bb5\u5d4c\u5957\u6df1\u5ea6&#xff0c;\u9632\u6b62\u6df1\u5c42\u5d4c\u5957\u62d6\u57ae\u6267\u884c&#xff1b;<\/li>\n<li>Directives Limit&#xff1a;\u9650\u5236\u6307\u4ee4&#xff08;directive&#xff09;\u4f7f\u7528\u6570\u91cf&#xff1b;<\/li>\n<li>Disabled Field Suggestion&#xff1a;\u5728&#034;\u5b57\u6bb5\u4e0d\u5b58\u5728&#034;\u7684\u6821\u9a8c\u9519\u8bef\u4e2d\u5c4f\u853d\u5b57\u6bb5\u5efa\u8bae&#xff0c;\u907f\u514d\u501f\u52a9\u62fc\u9519\u5b57\u6bb5\u540d\u7684\u62a5\u9519\u9010\u5b57\u63a2\u6d4b schema\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u4e9b\u63aa\u65bd\u5bf9\u5e94 Armor \u81ea\u8eab\u7684\u914d\u7f6e\u9879&#xff0c;\u793a\u4f8b\u4e2d new EnvelopArmor() \u4f7f\u7528\u7684\u662f\u5176\u5185\u7f6e\u9ed8\u8ba4\u9608\u503c&#xff1b;\u5982\u9700\u8c03\u6574&#xff08;\u5982\u653e\u5bbd maxDepth\u3001\u5173\u95ed\u67d0\u9879\u9632\u62a4&#xff09;&#xff0c;\u53ef\u5728 EnvelopArmor \u6784\u9020\u51fd\u6570\u7684\u914d\u7f6e\u5bf9\u8c61\u4e2d\u4fee\u6539&#xff0c;\u672c\u4ed3\u5e93\u793a\u4f8b\u672a\u5c55\u5f00\u8fd9\u90e8\u5206&#xff0c;\u9700\u53c2\u7167 Armor \u9879\u76ee\u81ea\u8eab\u7684\u6587\u6863\u3002<\/p>\n<h3>\u9632\u62a4\u6548\u679c\u9a8c\u8bc1<\/h3>\n<h4>\u5408\u6cd5\u67e5\u8be2\u5e94\u6b63\u5e38\u901a\u8fc7<\/h4>\n<p>\u5bf9\u7aef\u70b9\u53d1\u8d77\u5408\u6cd5\u67e5\u8be2&#xff0c;\u5e94\u8fd4\u56de\u6570\u636e\u800c\u975e\u88ab Armor \u62e6\u622a&#xff1a;<\/p>\n<p>$ curl &#8211;location &#8211;request POST &#039;http:\/\/localhost:4000\/graphql&#039; \\\\<br \/>\n  &#8211;header &#039;Content-Type: application\/json&#039; \\\\<br \/>\n  &#8211;data-raw &#039;{&#034;query&#034;:&#034;query { books { title } }&#034;}&#039;<\/p>\n<p>{&#034;data&#034;:{&#034;books&#034;:[{&#034;title&#034;:&#034;The Awakening&#034;},{&#034;title&#034;:&#034;City of Glass&#034;}]}}<\/p>\n<h4>\u5b57\u6bb5\u5efa\u8bae\u88ab\u5c4f\u853d<\/h4>\n<p>\u6545\u610f\u67e5\u8be2\u4e00\u4e2a\u4e0d\u5b58\u5728\u7684\u5b57\u6bb5 titlee&#xff08;README \u539f\u6587\u5199\u4f5c title[e]&#xff0c;\u793a\u4f8b payload \u5b9e\u4e3a titlee&#xff09;&#xff1a;<\/p>\n<p>$ curl &#8211;location &#8211;request POST &#039;http:\/\/localhost:4000\/graphql&#039; \\\\<br \/>\n  &#8211;header &#039;Content-Type: application\/json&#039; \\\\<br \/>\n  &#8211;data-raw &#039;{&#034;query&#034;:&#034;query { books { titlee } }&#034;}&#039;<\/p>\n<p>{&#034;data&#034;:null,&#034;errors&#034;:[{&#034;message&#034;:&#034;Cannot query field \\\\&#034;titlee\\\\&#034; on type \\\\&#034;Book\\\\&#034;. [Suggestion message hidden by GraphQLArmor]?&#034;,&#034;locations&#034;:[{&#034;line&#034;:1,&#034;column&#034;:17}],&#034;extensions&#034;:{}}]}<\/p>\n<p>\u9519\u8bef\u6d88\u606f\u4e2d\u539f\u672c graphql-js \u4f1a\u9644\u5e26\u7684 &#034;Did you mean title?&#034; \u5efa\u8bae\u88ab\u5c4f\u853d\u2014\u2014\u8fd9\u6b63\u662f Disabled Field Suggestion \u7684\u4ef7\u503c&#xff1a;\u653b\u51fb\u8005\u65e0\u6cd5\u901a\u8fc7\u62fc\u9519\u5b57\u6bb5\u540d\u518d\u8bfb\u53d6\u5efa\u8bae\u6765\u65e0\u6210\u672c\u5730\u679a\u4e3e schema\u3002<\/p>\n<h4>\u96c6\u6210\u6d4b\u8bd5\u5bf9\u884c\u4e3a\u7684\u56fa\u5316<\/h4>\n<p>examples\/graphql-armor\/integration-tests\/graphql-armor.spec.ts \u901a\u8fc7 yoga.fetch(&#8230;) \u76f4\u63a5\u5bf9\u5185\u5b58\u4e2d\u7684 Yoga \u5b9e\u4f8b\u53d1\u8d77\u8bf7\u6c42&#xff0c;\u8986\u76d6\u4e24\u4e2a\u65ad\u8a00&#xff1a;<\/p>\n<li>query{books{title}} \u5e94\u65e0 errors \u4e14 data \u4e0e\u5185\u8054\u5feb\u7167\u4e00\u81f4&#xff1b;<\/li>\n<li>query{books{titlee}} \u5e94\u6070\u597d\u4ea7\u751f 1 \u6761 errors&#xff0c;extensions.code \u4e3a GRAPHQL_VALIDATION_FAILED&#xff0c;\u4e14 data \u4e3a\u5047\u503c\u3002\u6d4b\u8bd5\u540c\u6837\u505a\u4e86\u7248\u672c\u5206\u652f&#xff1a;graphql \u4e3b\u7248\u672c &gt;&#061; 17 \u65f6\u671f\u671b\u6d88\u606f\u4e3a\u5e72\u51c0\u7684 Cannot query field &#034;titlee&#034; on type &#034;Book&#034;.&#xff08;\u6765\u81ea\u539f\u751f hideSuggestions&#xff09;&#xff0c;\u5426\u5219\u671f\u671b Cannot query field &#034;titlee&#034; on type &#034;Book&#034;. [Suggestion hidden]&#xff08;\u6765\u81ea Armor \u7684\u63d0\u793a\u66ff\u6362&#xff09;\u3002<\/li>\n<p>\u8fd9\u6bb5\u6d4b\u8bd5\u4e5f\u89e3\u91ca\u4e86 README \u4e2d curl \u8f93\u51fa\u4e0e\u6d4b\u8bd5\u5feb\u7167\u5728\u63aa\u8f9e\u4e0a\u7684\u7ec6\u5fae\u5dee\u5f02&#xff1a;\u4e24\u8005\u5206\u522b\u5bf9\u5e94 Armor \u7684\u63d0\u793a\u66ff\u6362\u4e0e GraphQL 17 \u539f\u751f\u9690\u85cf\u5efa\u8bae\u4e24\u79cd\u5b9e\u73b0\u8def\u5f84\u3002<\/p>\n<h3>\u5c0f\u7ed3\u4e0e\u4f7f\u7528\u8981\u70b9<\/h3>\n<ul>\n<li>\u96c6\u6210\u6210\u672c\u6781\u4f4e&#xff1a;new EnvelopArmor() &#043; armor.protect().plugins \u5c55\u5f00\u8fdb createYoga \u7684 plugins \u5373\u5b8c\u6210\u63a5\u5165&#xff0c;\u793a\u4f8b\u5b8c\u6574\u5b9e\u73b0\u4e0d\u8db3 60 \u884c&#xff08;examples\/graphql-armor\/src\/yoga.ts&#xff09;&#xff1b;<\/li>\n<li>\u63d2\u4ef6\u751f\u6548\u4f9d\u8d56 Yoga \u5bf9 Envelop \u94a9\u5b50\u7684\u539f\u751f\u8c03\u5ea6&#xff0c;setValidationFn \u673a\u5236\u7684\u5e95\u5c42\u5b9e\u73b0\u89c1 packages\/envelop\/core\/src\/orchestrator.ts&#xff1b;<\/li>\n<li>\u5f53\u524d\u4ed3\u5e93\u9501\u5b9a\u7684\u4f9d\u8d56\u7248\u672c\u4e3a &#064;escape.tech\/graphql-armor&#064;3.1.7\u3001graphql&#064;17.0.2&#xff1b;\u82e5\u4f60\u4f7f\u7528 graphql 16&#xff0c;\u884c\u4e3a\u4f1a\u8d70 Armor \u81ea\u8eab\u7684\u5efa\u8bae\u5c4f\u853d\u8def\u5f84&#xff0c;\u82e5\u4f7f\u7528 17 \u53ca\u4ee5\u4e0a&#xff0c;\u5219\u5982\u793a\u4f8b\u6240\u793a\u53e0\u52a0\u539f\u751f hideSuggestions&#xff1b;<\/li>\n<li>\u793a\u4f8b\u9ed8\u8ba4\u9608\u503c\u9002\u7528\u4e8e\u6f14\u793a&#xff0c;\u751f\u4ea7\u73af\u5883\u5efa\u8bae\u7ed3\u5408\u81ea\u8eab\u67e5\u8be2\u590d\u6742\u5ea6\u4e0e\u4e1a\u52a1\u7279\u5f81\u663e\u5f0f\u914d\u7f6e\u5404\u9879 limit&#xff0c;\u5e76\u901a\u8fc7\u7c7b\u4f3c\u672c\u793a\u4f8b\u7684\u96c6\u6210\u6d4b\u8bd5\u56fa\u5316\u9632\u62a4\u884c\u4e3a&#xff0c;\u9632\u6b62\u56de\u5f52\u3002<\/li>\n<\/ul>\n<p>  <img loading=\"lazy\" decoding=\"async\" class=\"gcb-icon-like\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261002181749-6abff54d81ac9.svg\" alt=\"\" width=\"16\" height=\"16\" \/> <span class=\"gcb-like-text\">\u8d5e<\/span>  <\/p>\n<p>   <span class=\"gcb-share-text\">\u5206\u4eab<\/span>  <\/p>\n<ul class=\"gcb-tag-list\">\n<li><span class=\"gcb-tag\">\u540e\u7aef<\/span><\/li>\n<li><span class=\"gcb-tag\">API\u8bbe\u8ba1<\/span><\/li>\n<\/ul>\n<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011graphql-yoga<\/h3>\n<p class=\"gcb-project-desc\">&#x1f9d8; Rewrite of a fully-featured GraphQL Server with focus on easy setup, performance &amp; great developer experience. The core of Yoga implements WHATWG Fetch API and can run\/deploy on any JS environment.<\/p>\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/gh_mirrors\/gr\/graphql-yoga<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<h4 class=\"gcb-related-title\">\u76f8\u5173\u63a8\u8350<\/h4>\n<ul class=\"gcb-related-list\">\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\"> DVA\u4e0eGraphQL Yoga\u96c6\u6210&#xff1a;Node.js GraphQL\u670d\u52a1\u5668\u5b9e\u8df5<\/h5>\n<p class=\"gcb-related-item-desc\">DVA\u4e0eGraphQL Yoga\u96c6\u6210&#xff1a;Node.js GraphQL\u670d\u52a1\u5668\u5b9e\u8df5 \u4f60\u662f\u5426\u5728\u6784\u5efa\u524d\u7aef\u5e94\u7528\u65f6&#xff0c;\u9762\u4e34REST API\u6570\u636e\u83b7\u53d6\u7e41\u7410\u3001\u524d\u540e\u7aef\u6570\u636e\u683c\u5f0f\u4e0d\u4e00\u81f4\u3001<\/p>\n<p>     <span class=\"gcb-tag\">\u524d\u7aef<\/span>\n      <\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">Prisma \u5b9e\u6218&#xff1a;\u7528 graphql-yoga \u4e0e prisma-binding \u5feb\u901f\u642d\u5efa Node.js GraphQL \u670d\u52a1\u5668<\/h5>\n<p class=\"gcb-related-item-desc\">Prisma \u5b9e\u6218&#xff1a;\u7528 graphql yoga \u4e0e prisma binding \u5feb\u901f\u642d\u5efa Node.js GraphQL \u670d\u52a1\u5668 \u672c\u7bc7\u6559\u7a0b\u5c06\u5e26\u4f60\u4ece\u96f6\u8d77\u6b65&#xff0c;\u5728<\/p>\n<p>     <span class=\"gcb-tag\">\u540e\u7aef<\/span><br \/>\n     <span class=\"gcb-tag\">\u6570\u636e\u5e93<\/span><br \/>\n     <span class=\"gcb-tag\">GraphQL<\/span>\n      <\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">\u4f7f\u7528 GraphQL Code Generator \u5728 Yoga \u670d\u52a1\u4e0a\u6267\u884c\u7c7b\u578b\u5b89\u5168 GraphQL \u64cd\u4f5c&#xff08;Yoga Tests \u5b9e\u6218\u793a\u4f8b&#xff09;<\/h5>\n<p class=\"gcb-related-item-desc\">\u4f7f\u7528 GraphQL Code Generator \u5728 Yoga \u670d\u52a1\u4e0a\u6267\u884c\u7c7b\u578b\u5b89\u5168 GraphQL \u64cd\u4f5c&#xff08;Yoga Tests \u5b9e\u6218\u793a\u4f8b&#xff09; \u672c\u6307\u5357\u4ee5\u4ed3\u5e93\u4e2d\u7684 <\/p>\n<p>     <span class=\"gcb-tag\">\u5f00\u53d1\u5de5\u5177<\/span>\n      <\/li>\n<\/ul>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0a\u4e00\u7bc7&#xff1a;<\/span><br \/>\n   Chroma\u5e38\u89c1\u95ee\u9898\u89e3\u7b54&#xff1a;\u89e3\u51b3\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u5178\u578b\u95ee\u9898 <\/p>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0b\u4e00\u7bc7&#xff1a;<\/span><br \/>\n   GitHub Training Kit\u9879\u76ee\u7ba1\u7406&#xff1a;GitHub Professional Services\u56e2\u961f\u7684\u5de5\u4f5c\u65b9\u6cd5 <\/p>\n<p>\u521b\u4f5c\u58f0\u660e\uff1a\u672c\u6587\u90e8\u5206\u5185\u5bb9\u7531AI\u8f85\u52a9\u751f\u6210\uff08AIGC\uff09\uff0c\u4ec5\u4f9b\u53c2\u8003<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u540e\u7aefAPI\u8bbe\u8ba1 \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011graphql-yoga &#x1f9d8; Rewrite of a fully-featured GraphQL Server with focus on easy setup, performance &amp; great developer experience. The core of Yoga implements WHATWG Fetch API and can run\/deploy on any JS environment. \u9879\u76ee\u5730<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-112321","post","type-post","status-publish","format-standard","hentry","category-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>GraphQL Yoga \u5b89\u5168\u52a0\u56fa\u5b9e\u6218\uff1a\u7528 GraphQL Armor \u4e3a GraphQL \u670d\u52a1\u5668\u52a0\u88c5\u6821\u9a8c\u62a4\u680f - \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\/112321.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"GraphQL Yoga \u5b89\u5168\u52a0\u56fa\u5b9e\u6218\uff1a\u7528 GraphQL Armor \u4e3a GraphQL \u670d\u52a1\u5668\u52a0\u88c5\u6821\u9a8c\u62a4\u680f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u540e\u7aefAPI\u8bbe\u8ba1 \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011graphql-yoga &#x1f9d8; Rewrite of a fully-featured GraphQL Server with focus on easy setup, performance &amp; great developer experience. The core of Yoga implements WHATWG Fetch API and can run\/deploy on any JS environment. \u9879\u76ee\u5730\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/112321.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-02T18:17:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261002181749-6abff54d81ac9.svg\" \/>\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\/112321.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/112321.html\",\"name\":\"GraphQL Yoga \u5b89\u5168\u52a0\u56fa\u5b9e\u6218\uff1a\u7528 GraphQL Armor \u4e3a GraphQL \u670d\u52a1\u5668\u52a0\u88c5\u6821\u9a8c\u62a4\u680f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-02T18:17:50+00:00\",\"dateModified\":\"2026-10-02T18:17:50+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/112321.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/112321.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/112321.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"GraphQL Yoga \u5b89\u5168\u52a0\u56fa\u5b9e\u6218\uff1a\u7528 GraphQL Armor \u4e3a GraphQL \u670d\u52a1\u5668\u52a0\u88c5\u6821\u9a8c\u62a4\u680f\"}]},{\"@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":"GraphQL Yoga \u5b89\u5168\u52a0\u56fa\u5b9e\u6218\uff1a\u7528 GraphQL Armor \u4e3a GraphQL \u670d\u52a1\u5668\u52a0\u88c5\u6821\u9a8c\u62a4\u680f - \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\/112321.html","og_locale":"zh_CN","og_type":"article","og_title":"GraphQL Yoga \u5b89\u5168\u52a0\u56fa\u5b9e\u6218\uff1a\u7528 GraphQL Armor \u4e3a GraphQL \u670d\u52a1\u5668\u52a0\u88c5\u6821\u9a8c\u62a4\u680f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u540e\u7aefAPI\u8bbe\u8ba1 \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011graphql-yoga &#x1f9d8; Rewrite of a fully-featured GraphQL Server with focus on easy setup, performance &amp; great developer experience. The core of Yoga implements WHATWG Fetch API and can run\/deploy on any JS environment. \u9879\u76ee\u5730","og_url":"https:\/\/www.wsisp.com\/helps\/112321.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-02T18:17:50+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261002181749-6abff54d81ac9.svg"}],"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\/112321.html","url":"https:\/\/www.wsisp.com\/helps\/112321.html","name":"GraphQL Yoga \u5b89\u5168\u52a0\u56fa\u5b9e\u6218\uff1a\u7528 GraphQL Armor \u4e3a GraphQL \u670d\u52a1\u5668\u52a0\u88c5\u6821\u9a8c\u62a4\u680f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-02T18:17:50+00:00","dateModified":"2026-10-02T18:17:50+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/112321.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/112321.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/112321.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"GraphQL Yoga \u5b89\u5168\u52a0\u56fa\u5b9e\u6218\uff1a\u7528 GraphQL Armor \u4e3a GraphQL \u670d\u52a1\u5668\u52a0\u88c5\u6821\u9a8c\u62a4\u680f"}]},{"@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\/112321","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=112321"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/112321\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=112321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=112321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=112321"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=112321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}