{"id":47825,"date":"2023-07-15T15:17:09","date_gmt":"2022-11-18T13:39:09","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8python%e7%9a%84graphql%e5%ba%93strawberry%e6%9d%a5%e7%a6%81%e6%ad%a2%e8%be%93%e5%87%ba%e6%97%a5%e5%bf%97%e5%92%8c%e5%a0%86%e6%a0%88%e8%b7%9f%e8%b8%aa%e3%80%82\/"},"modified":"2024-04-30T13:43:13","modified_gmt":"2024-04-30T05:43:13","slug":"%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8python%e7%9a%84graphql%e5%ba%93strawberry%e6%9d%a5%e7%a6%81%e6%ad%a2%e8%be%93%e5%87%ba%e6%97%a5%e5%bf%97%e5%92%8c%e5%a0%86%e6%a0%88%e8%b7%9f%e8%b8%aa%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8python%e7%9a%84graphql%e5%ba%93strawberry%e6%9d%a5%e7%a6%81%e6%ad%a2%e8%be%93%e5%87%ba%e6%97%a5%e5%bf%97%e5%92%8c%e5%a0%86%e6%a0%88%e8%b7%9f%e8%b8%aa%e3%80%82\/","title":{"rendered":"\u901a\u8fc7\u4f7f\u7528Python\u7684GraphQL\u5e93Strawberry\u6765\u7981\u6b62\u8f93\u51fa\u65e5\u5fd7\u548c\u5806\u6808\u8ddf\u8e2a"},"content":{"rendered":"<p>\u5728FastAPI\u7684\u5b98\u65b9\u6587\u6863\u4e2d\u4ecb\u7ecd\u4e86GraphQL\u7684\u5e93\u3002<\/p>\n<p>\u63a8\u8350\u7684GraphQL\u5e93\u662fStrawberry\u3002<\/p>\n<p>\u8fd9\u6b21\u6211\u4f7f\u7528Strawberry\u5e93\u6765\u5b9e\u73b0GraphQL\u7684API\u65f6\u9047\u5230\u4e86\u4e00\u4e9b\u56f0\u96be\uff0c\u4e3b\u8981\u662f\u5173\u4e8e\u65e5\u5fd7\u8f93\u51fa\u7684\u95ee\u9898\u3002\u4e0b\u9762\u6211\u5c06\u9610\u8ff0\u5177\u4f53\u95ee\u9898\u53ca\u5176\u89e3\u51b3\u65b9\u6cd5\u3002<\/p>\n<h1>\u5173\u4e8e\u8349\u8393\u7684\u4e8b\u60c5<\/h1>\n<p>\u6539\u5199\u540e\u7684\u53e5\u5b50\uff1a\u6539\u4e00\u6539\uff0cStrawberry\u5c31\u662fPython\u7528\u7684GraphQL\u5e93\u3002Python\u7528\u7684GraphQL\u5e93\u4e2d\uff0cGraphene\u662f\u4e00\u4e2a\u6587\u6863\u5168\u9762\u800c\u4e14\u5386\u53f2\u60a0\u4e45\u7684\u5e93\u3002\u76f8\u6bd4\u4e4b\u4e0b\uff0cStrawberry\u662f\u4e00\u4e2a\u76f8\u5bf9\u8f83\u65b0\u7684\u5e93\u3002<br \/>\nFastAPI\u7684\u6587\u6863\u63a8\u8350\u4f7f\u7528Strawberry\u3002<br \/>\n\u542c\u8bf4\u5b83\u7684\u8bbe\u8ba1\u7406\u5ff5\u4e0eFastAPI\u5f88\u76f8\u4f3c\u3002<\/p>\n<p>\u8349\u8393\u4ecd\u5728\u79ef\u6781\u5f00\u53d1\u4e2d\uff0c\u5728GitHub\u4e0a\u6709\u9891\u7e41\u7684\u63d0\u4ea4\u8bb0\u5f55\u3002\u56e0\u6b64\uff0c\u4f5c\u4e3aGraphQL\u7684\u529f\u80fd\u8fd8\u4e0d\u591f\u5145\u5206\u3002\u5c31\u6211\u4e2a\u4eba\u800c\u8a00\uff0c\u65e5\u5fd7\u8f93\u51fa\u65b9\u9762\uff0c\u6211\u9047\u5230\u4e86\u4e00\u4e9b\u9ebb\u70e6\uff0c\u56e0\u4e3a\u8349\u8393\u5b98\u65b9\u6587\u6863\u6ca1\u6709\u8be6\u7ec6\u4ecb\u7ecd\u65e5\u5fd7\u8f93\u51fa\u3002<\/p>\n<h1>\u8f93\u51fa\u5806\u6808\u8ddf\u8e2a\u65e5\u5fd7<\/h1>\n<p>\u5728\u5e94\u7528\u7a0b\u5e8f\u7684\u8fd0\u7ef4\u9636\u6bb5\uff0c\u65e5\u5fd7\u8f93\u51fa\u975e\u5e38\u91cd\u8981\u3002<br \/>\n\u7136\u800c\uff0c\u5982\u679c\u6309\u7167Strawberry\u7684\u5b98\u65b9\u6587\u6863\u6765\u5b9e\u65bd\uff0c\u90a3\u4e48\u5728\u8fdb\u884c\u751f\u4ea7\u90e8\u7f72\u65f6\uff0c\u65e5\u5fd7\u8f93\u51fa\u4f1a\u88ab\u5806\u6ee1\u5806\u6808\u8ddf\u8e2a\u4fe1\u606f&#8230;<br \/>\n\u8fd9\u662f\u56e0\u4e3aFastAPI\u4f7f\u7528\u7684ASGI\u670d\u52a1\u5668\u4e0eStrawberry\u7684\u89c4\u8303\u5b58\u5728\u95ee\u9898\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u5047\u8bbe\u6709\u4e00\u6bb5\u4ee3\u7801\u6765\u83b7\u53d6\u7528\u6237\u5217\u8868\uff0c\u5982\u679c\u65e0\u6cd5\u83b7\u53d6\u5230\u5217\u8868\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7raise\u8bed\u53e5\u5f15\u53d1\u5f02\u5e38\uff0c\u7136\u540eStrawberry\u4f1a\u6355\u83b7\u8be5\u5f02\u5e38\u5e76\u8fd4\u56de\u7ed3\u679c\u5230GraphQL\u9875\u9762\uff0c\u800c\u65e0\u9700\u8fdb\u884c\u8f93\u5165\u5230\u6a21\u5f0f\u7684\u5904\u7406\uff0c\u8fd9\u6837\u5904\u7406\u8d77\u6765\u7b80\u5355\u3002\u4f46\u662f\uff0c\u63a7\u5236\u53f0\u5374\u5145\u65a5\u7740\u5806\u6808\u8ddf\u8e2a\u4fe1\u606f\u3002<\/p>\n<pre class=\"post-pre\"><code>Traceback (most recent call last):\r\n  File \"\/root\/.cache\/pypoetry\/virtualenvs\/app-9TtSrW0h-py3.9\/lib\/python3.9\/site-packages\/graphql\/execution\/execute.py\", line 625, in await_result\r\n    return_type, field_nodes, info, path, await result\r\n  File \"\/root\/.cache\/pypoetry\/virtualenvs\/app-9TtSrW0h-py3.9\/lib\/python3.9\/site-packages\/strawberry\/extensions\/directives.py\", line 19, in resolve\r\n    result = await await_maybe(_next(root, info, *args, **kwargs))\r\n  File \"\/root\/.cache\/pypoetry\/virtualenvs\/app-9TtSrW0h-py3.9\/lib\/python3.9\/site-packages\/strawberry\/schema\/schema_converter.py\", line 392, in _resolver\r\n    return _get_result(_source, strawberry_info, **kwargs)\r\n  File \"\/root\/.cache\/pypoetry\/virtualenvs\/app-9TtSrW0h-py3.9\/lib\/python3.9\/site-packages\/strawberry\/schema\/schema_converter.py\", line 384, in _get_result\r\n<\/code><\/pre>\n<p>\u7531\u4e8e\u8fd9\u4e2a\u95ee\u9898,raises\u4e5f\u88abASGI\u670d\u52a1\u5668\u6355\u6349\u5230\u4e86\u3002Strawberry\u8ba4\u4e3a\u8fd9\u662f\u6b63\u5e38\u5904\u7406\uff0c\u4f46\u5728ASGI\u670d\u52a1\u5668\u770b\u6765\u5374\u6210\u4e86\u5f02\u5e38\u5904\u7406\uff0c\u4ea7\u751f\u4e86\u4e0d\u4e00\u81f4\u7684\u95ee\u9898\u3002<\/p>\n<h1>\u4e0d\u4ea7\u751f\u5806\u6808\u8ddf\u8e2a\u4fe1\u606f\u7684\u65b9\u6cd5\u3002<\/h1>\n<p>\u8981\u60f3\u907f\u514d\u8f93\u51fa\u5806\u6808\u8ddf\u8e2a\u4fe1\u606f\uff0c\u9700\u8981\u7ee7\u627fExtension\u548cGraphQLRouter\u6765\u8fdb\u884c\u5b9a\u5236\u3002<br \/>\n\u5b8c\u6210\u7684\u4ee3\u7801\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<pre class=\"post-pre\"><code>import strawberry\r\n\r\nfrom fastapi import FastAPI, Request\r\nfrom strawberry.fastapi import GraphQLRouter\r\nfrom strawberry.http import GraphQLHTTPResponse, process_result\r\nfrom strawberry.types import ExecutionResult\r\nfrom graphql.error.graphql_error import GraphQLError\r\n\r\nfrom strawberry.extensions import Extension\r\n\r\nclass MyExtension(Extension):\r\n    def get_results(self):\r\n        # resolver, mutation\u306e\u51e6\u7406\u304c\u7d42\u308f\u308b\u3068GraphQLRouter\u306e\u51e6\u7406\u306e\u524d\u306b\u3053\u3053\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u308b\r\n        # \u30a8\u30e9\u30fc\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u304b\u5224\u5b9a\r\n        errors = self.execution_context.result.errors\r\n        if errors is not None and len(errors) &gt; 0:\r\n            # erros\u306bGraphQLError\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u3068GraphQLRouter\u306e\u51e6\u7406\u306b\u79fb\u308b\u6642\u306b\u30c8\u30ec\u30fc\u30b9\u30d0\u30c3\u30af\u304c\u51fa\u529b\u3055\u308c\u308b\u305f\u3081data\u306b\u79fb\u3057\u66ff\u3048\r\n            self.execution_context.result.data = self.execution_context.result.errors\r\n            self.execution_context.result.errors = []\r\n\r\n\r\nclass MyGraphQLRouter(GraphQLRouter):\r\n  async def process_result(\r\n        self, request: Request, result: ExecutionResult\r\n    ) -&gt; GraphQLHTTPResponse:\r\n        if type(result.data[0]) is GraphQLError:\r\n            # data\u306b\u79fb\u3057\u66ff\u3048\u305fGraphQLError\u3092\u518d\u5ea6errors\u306b\u79fb\u3057\u66ff\u3048\r\n            result.errors = result.data\r\n            result.errors[0].message = result.data\r\n            result.data = None\r\n        # GrphQL\u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306b\u5909\u63db\u3059\u308b\r\n        data: GraphQLHTTPResponse = process_result(result)\r\n        return data\r\n\r\n@strawberry.type\r\nclass Query:\r\n    @strawberry.field\r\n    def users(self) -&gt; str:\r\n        users = get_users()\r\n        if len(users) == 0:\r\n            Exception(\"\u30e6\u30fc\u30b6\u30fc\u4e00\u89a7\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\") \r\n        return \"\u30e6\u30fc\u30b6\u30fc\u4e00\u89a7\u53d6\u5f97\u3057\u307e\u3057\u305f\"\r\n\r\nschema = strawberry.Schema(query=Query, extensions=[MyExtension])\r\ngraphql_app = MyGraphQLRouter(schema)\r\n\r\napp = FastAPI()\r\napp.include_router(graphql_app, prefix=\"\/graphql\")\r\n<\/code><\/pre>\n<p>\u5728 Extension \u4e0a\uff0c\u60a8\u53ef\u4ee5\u5728 resolver \u548c mutation \u5904\u7406\u7ed3\u675f\u540e\u63d2\u5165\u5176\u4ed6\u5904\u7406\u903b\u8f91\u3002<br \/>\n\u5728 GraphQLRouter \u4e0a\uff0c\u60a8\u53ef\u4ee5\u5728\u521b\u5efa\u54cd\u5e94\u65f6\u63d2\u5165\u5904\u7406\u903b\u8f91\u3002<br \/>\n\u5904\u7406\u7684\u987a\u5e8f\u662f\u5148 Extension\uff0c\u7136\u540e\u662f GraphQLRouter\u3002<br \/>\n\u540c\u65f6\uff0c\u5728 Extension \u548c GraphQLRouter \u4e4b\u95f4\u4f1a\u8f93\u51fa\u5806\u6808\u8ddf\u8e2a\u3002<br \/>\n\u56e0\u6b64\uff0c\u60a8\u9700\u8981\u5728 Extension \u4e2d\u5904\u7406\uff0c\u4ee5\u907f\u514d\u8f93\u51fa\u5806\u6808\u8ddf\u8e2a\u3002<br \/>\n\u5806\u6808\u8ddf\u8e2a\u4f1a\u5728 self.execution_context.result.errors \u4e2d\u5b58\u5728\u9519\u8bef\u65f6\u8f93\u51fa\uff0c\u56e0\u6b64\u60a8\u9700\u8981\u5c06\u8fd9\u4e9b\u9519\u8bef\u8f6c\u79fb\u5230 self.execution_context.result.data \u4e2d\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u5728\u6b64\u60c5\u51b5\u4e0b\uff0c\u4e3a\u4e86\u5c06\u5176\u89c6\u4e3a\u6b63\u5e38\u5904\u7406\u5e76\u8fd4\u56de\u54cd\u5e94\uff0c\u6211\u4eec\u901a\u8fc7GraphQLRouter\u518d\u6b21\u6267\u884cself.execution_context.result.errors\u7684\u64cd\u4f5c\u3002<\/p>\n<h1>\u603b\u7ed3<\/h1>\n<p>\u4f7f\u7528FastAPI\u63a8\u8350\u7684GraphQL\u5e93Strawberry\u65f6\uff0c\u6211\u5728\u65e5\u5fd7\u8f93\u51fa\u65b9\u9762\u9047\u5230\u4e86\u56f0\u96be\uff0c\u56e0\u4e3a\u4e0d\u65ad\u8f93\u51fa\u4e86\u5806\u6808\u8ddf\u8e2a\u4fe1\u606f\uff0c\u6240\u4ee5\u603b\u7ed3\u4e86\u4e00\u4e9b\u907f\u514d\u65b9\u6cd5\u3002<br \/>\n\u5e0c\u671b\u8fd9\u4e9b\u6280\u5de7\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff0c\u56e0\u4e3a\u5b98\u65b9\u6587\u6863\u4e2d\u6ca1\u6709\u63d0\u5230\u3002<br \/>\n\u968f\u7740Strawberry\u7684\u5f00\u53d1\u8fdb\u5c55\uff0c\u8fd9\u4e2a\u95ee\u9898\u5e94\u8be5\u4f1a\u5f97\u5230\u89e3\u51b3&#8230;?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728FastAPI\u7684\u5b98\u65b9\u6587\u6863\u4e2d\u4ecb\u7ecd\u4e86GraphQL\u7684\u5e93\u3002 \u63a8\u8350\u7684GraphQL\u5e93\u662fStrawberry\u3002 \u8fd9\u6b21\u6211 [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-47825","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u901a\u8fc7\u4f7f\u7528Python\u7684GraphQL\u5e93Strawberry\u6765\u7981\u6b62\u8f93\u51fa\u65e5\u5fd7\u548c\u5806\u6808\u8ddf\u8e2a - Blog - Silicon Cloud<\/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.silicloud.com\/zh\/blog\/\u901a\u8fc7\u4f7f\u7528python\u7684graphql\u5e93strawberry\u6765\u7981\u6b62\u8f93\u51fa\u65e5\u5fd7\u548c\u5806\u6808\u8ddf\u8e2a\u3002\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u901a\u8fc7\u4f7f\u7528Python\u7684GraphQL\u5e93Strawberry\u6765\u7981\u6b62\u8f93\u51fa\u65e5\u5fd7\u548c\u5806\u6808\u8ddf\u8e2a\" \/>\n<meta property=\"og:description\" content=\"\u5728FastAPI\u7684\u5b98\u65b9\u6587\u6863\u4e2d\u4ecb\u7ecd\u4e86GraphQL\u7684\u5e93\u3002 \u63a8\u8350\u7684GraphQL\u5e93\u662fStrawberry\u3002 \u8fd9\u6b21\u6211 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u901a\u8fc7\u4f7f\u7528python\u7684graphql\u5e93strawberry\u6765\u7981\u6b62\u8f93\u51fa\u65e5\u5fd7\u548c\u5806\u6808\u8ddf\u8e2a\u3002\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-18T13:39:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-30T05:43:13+00:00\" \/>\n<meta name=\"author\" content=\"\u6e05, \u5b87\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6e05, \u5b87\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8python%e7%9a%84graphql%e5%ba%93strawberry%e6%9d%a5%e7%a6%81%e6%ad%a2%e8%be%93%e5%87%ba%e6%97%a5%e5%bf%97%e5%92%8c%e5%a0%86%e6%a0%88%e8%b7%9f%e8%b8%aa%e3%80%82\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8python%e7%9a%84graphql%e5%ba%93strawberry%e6%9d%a5%e7%a6%81%e6%ad%a2%e8%be%93%e5%87%ba%e6%97%a5%e5%bf%97%e5%92%8c%e5%a0%86%e6%a0%88%e8%b7%9f%e8%b8%aa%e3%80%82\/\",\"name\":\"\u901a\u8fc7\u4f7f\u7528Python\u7684GraphQL\u5e93Strawberry\u6765\u7981\u6b62\u8f93\u51fa\u65e5\u5fd7\u548c\u5806\u6808\u8ddf\u8e2a - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2022-11-18T13:39:09+00:00\",\"dateModified\":\"2024-04-30T05:43:13+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8python%e7%9a%84graphql%e5%ba%93strawberry%e6%9d%a5%e7%a6%81%e6%ad%a2%e8%be%93%e5%87%ba%e6%97%a5%e5%bf%97%e5%92%8c%e5%a0%86%e6%a0%88%e8%b7%9f%e8%b8%aa%e3%80%82\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8python%e7%9a%84graphql%e5%ba%93strawberry%e6%9d%a5%e7%a6%81%e6%ad%a2%e8%be%93%e5%87%ba%e6%97%a5%e5%bf%97%e5%92%8c%e5%a0%86%e6%a0%88%e8%b7%9f%e8%b8%aa%e3%80%82\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8python%e7%9a%84graphql%e5%ba%93strawberry%e6%9d%a5%e7%a6%81%e6%ad%a2%e8%be%93%e5%87%ba%e6%97%a5%e5%bf%97%e5%92%8c%e5%a0%86%e6%a0%88%e8%b7%9f%e8%b8%aa%e3%80%82\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u901a\u8fc7\u4f7f\u7528Python\u7684GraphQL\u5e93Strawberry\u6765\u7981\u6b62\u8f93\u51fa\u65e5\u5fd7\u548c\u5806\u6808\u8ddf\u8e2a\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\",\"name\":\"\u6e05, \u5b87\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"caption\":\"\u6e05, \u5b87\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8python%e7%9a%84graphql%e5%ba%93strawberry%e6%9d%a5%e7%a6%81%e6%ad%a2%e8%be%93%e5%87%ba%e6%97%a5%e5%bf%97%e5%92%8c%e5%a0%86%e6%a0%88%e8%b7%9f%e8%b8%aa%e3%80%82\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u901a\u8fc7\u4f7f\u7528Python\u7684GraphQL\u5e93Strawberry\u6765\u7981\u6b62\u8f93\u51fa\u65e5\u5fd7\u548c\u5806\u6808\u8ddf\u8e2a - Blog - Silicon Cloud","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.silicloud.com\/zh\/blog\/\u901a\u8fc7\u4f7f\u7528python\u7684graphql\u5e93strawberry\u6765\u7981\u6b62\u8f93\u51fa\u65e5\u5fd7\u548c\u5806\u6808\u8ddf\u8e2a\u3002\/","og_locale":"zh_CN","og_type":"article","og_title":"\u901a\u8fc7\u4f7f\u7528Python\u7684GraphQL\u5e93Strawberry\u6765\u7981\u6b62\u8f93\u51fa\u65e5\u5fd7\u548c\u5806\u6808\u8ddf\u8e2a","og_description":"\u5728FastAPI\u7684\u5b98\u65b9\u6587\u6863\u4e2d\u4ecb\u7ecd\u4e86GraphQL\u7684\u5e93\u3002 \u63a8\u8350\u7684GraphQL\u5e93\u662fStrawberry\u3002 \u8fd9\u6b21\u6211 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u901a\u8fc7\u4f7f\u7528python\u7684graphql\u5e93strawberry\u6765\u7981\u6b62\u8f93\u51fa\u65e5\u5fd7\u548c\u5806\u6808\u8ddf\u8e2a\u3002\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2022-11-18T13:39:09+00:00","article_modified_time":"2024-04-30T05:43:13+00:00","author":"\u6e05, \u5b87","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u6e05, \u5b87","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8python%e7%9a%84graphql%e5%ba%93strawberry%e6%9d%a5%e7%a6%81%e6%ad%a2%e8%be%93%e5%87%ba%e6%97%a5%e5%bf%97%e5%92%8c%e5%a0%86%e6%a0%88%e8%b7%9f%e8%b8%aa%e3%80%82\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8python%e7%9a%84graphql%e5%ba%93strawberry%e6%9d%a5%e7%a6%81%e6%ad%a2%e8%be%93%e5%87%ba%e6%97%a5%e5%bf%97%e5%92%8c%e5%a0%86%e6%a0%88%e8%b7%9f%e8%b8%aa%e3%80%82\/","name":"\u901a\u8fc7\u4f7f\u7528Python\u7684GraphQL\u5e93Strawberry\u6765\u7981\u6b62\u8f93\u51fa\u65e5\u5fd7\u548c\u5806\u6808\u8ddf\u8e2a - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2022-11-18T13:39:09+00:00","dateModified":"2024-04-30T05:43:13+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8python%e7%9a%84graphql%e5%ba%93strawberry%e6%9d%a5%e7%a6%81%e6%ad%a2%e8%be%93%e5%87%ba%e6%97%a5%e5%bf%97%e5%92%8c%e5%a0%86%e6%a0%88%e8%b7%9f%e8%b8%aa%e3%80%82\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8python%e7%9a%84graphql%e5%ba%93strawberry%e6%9d%a5%e7%a6%81%e6%ad%a2%e8%be%93%e5%87%ba%e6%97%a5%e5%bf%97%e5%92%8c%e5%a0%86%e6%a0%88%e8%b7%9f%e8%b8%aa%e3%80%82\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8python%e7%9a%84graphql%e5%ba%93strawberry%e6%9d%a5%e7%a6%81%e6%ad%a2%e8%be%93%e5%87%ba%e6%97%a5%e5%bf%97%e5%92%8c%e5%a0%86%e6%a0%88%e8%b7%9f%e8%b8%aa%e3%80%82\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u901a\u8fc7\u4f7f\u7528Python\u7684GraphQL\u5e93Strawberry\u6765\u7981\u6b62\u8f93\u51fa\u65e5\u5fd7\u548c\u5806\u6808\u8ddf\u8e2a"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e","name":"\u6e05, \u5b87","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","caption":"\u6e05, \u5b87"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8python%e7%9a%84graphql%e5%ba%93strawberry%e6%9d%a5%e7%a6%81%e6%ad%a2%e8%be%93%e5%87%ba%e6%97%a5%e5%bf%97%e5%92%8c%e5%a0%86%e6%a0%88%e8%b7%9f%e8%b8%aa%e3%80%82\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/47825","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=47825"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/47825\/revisions"}],"predecessor-version":[{"id":92252,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/47825\/revisions\/92252"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=47825"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=47825"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=47825"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}