Deployed 79ebc54 with MkDocs version: 0.16.3

This commit is contained in:
Vladimir Razuvaev 2017-09-05 15:30:30 +07:00
parent 94f3d1ddaa
commit b5895421b8
4 changed files with 31 additions and 28 deletions

View File

@ -219,9 +219,9 @@ are used. Instead, it provides tools for creating rich API for your existing app
<li>Parsing, validating and <a href="executing-queries/">executing GraphQL queries</a> against this Type System</li>
<li>Rich <a href="error-handling/">error reporting</a>, including query validation and execution errors</li>
<li>Optional tools for <a href="type-system/type-language/">parsing GraphQL Type language</a></li>
<li>Tools for <a href="./data-fetching.md/#solving-n1-problem">batching requests</a> to backend storage</li>
<li><a href="./data-fetching.md/#async-php">Async PHP platforms support</a> via promises</li>
<li><a href="./executing-queries.md/#using-server">Standard HTTP server</a></li>
<li>Tools for <a href="data-fetching/#solving-n1-problem">batching requests</a> to backend storage</li>
<li><a href="data-fetching/#async-php">Async PHP platforms support</a> via promises</li>
<li><a href="executing-queries/#using-server">Standard HTTP server</a></li>
</ul>
<p>Also, several <a href="complementary-tools/">complementary tools</a> are available which provide integrations with
existing PHP frameworks, add support for Relay, etc.</p>
@ -280,5 +280,5 @@ existing PHP frameworks, add support for Relay, etc.</p>
<!--
MkDocs version : 0.16.3
Build Date UTC : 2017-08-20 17:18:32
Build Date UTC : 2017-09-05 08:30:29
-->

View File

@ -327,22 +327,22 @@
},
{
"location": "/type-system/type-language/",
"text": "Defining your schema\n\n\nType language\n is a convenient way to define your schema,\nespecially with IDE autocompletion and syntax validation.\n\n\nHere is a simple schema defined in GraphQL type language (e.g. in a separate \nschema.graphql\n file):\n\n\nschema {\n query: Query\n mutation: Mutation\n}\n\ntype Query {\n greetings(input: HelloInput!): String!\n}\n\ninput HelloInput {\n firstName: String!\n lastName: String\n}\n\n\n\n\nIn order to create schema instance out of this file, use \n\nGraphQL\\Utils\\BuildSchema\n:\n\n\n<?php\nuse GraphQL\\Utils\\BuildSchema;\n\n$contents = file_get_contents('schema.graphql');\n$schema = BuildSchema::build($contents);\n\n\n\n\nBy default, such schema is created without any resolvers. As a result, it doesn't support \nInterfaces\n and \nUnions\n\nbecause it is impossible to resolve actual implementations during execution.\n\n\nAlso, we have to rely on \ndefault field resolver\n and \nroot value\n in \norder to execute a query against this schema.\n\n\nDefining resolvers\n\n\nIn order to enable \nInterfaces\n, \nUnions\n and custom field resolvers you can pass the second argument: \n\ntype config decorator\n to schema builder. \n\n\nIt accepts default type config produced by the builder and is expected to add missing options like \n\nresolveType\n for interface types or \n\nresolveField\n for object types.\n\n\n<?php\nuse GraphQL\\Utils\\BuildSchema;\n\n$typeConfigDecorator = function($typeConfig, $typeDefinitionNode) {\n $name = $typeConfig['name'];\n // ... add missing options to $typeConfig based on type $name\n return $typeConfig;\n};\n\n$contents = file_get_contents('schema.graphql');\n$schema = BuildSchema::build($contents, $typeConfigDecorator);\n\n\n\n\nPerformance considerations\n\n\nMethod \nbuild()\n produces a \nlazy schema\n\nautomatically, so it works efficiently even with very large schemas.\n\n\nBut parsing type definition file on each request is suboptimal, so it is recommended to cache \nintermediate parsed representation of the schema for the production environment:\n\n\n<?php\nuse GraphQL\\Language\\Parser;\nuse GraphQL\\Utils\\BuildSchema;\nuse GraphQL\\Utils\\AST;\n\n$cacheFilename = 'cached_schema.php';\n\nif (!file_exists($cacheFilename)) {\n $document = Parser::parse(file_get_contents('./schema.graphql'));\n file_put_contents($cacheFilename, \"<?php\\nreturn \" . var_export($document->toArray(), true));\n} else {\n $document = AST::fromArray(require $cacheFilename); // fromArray() is a lazy operation as well\n}\n\n$typeConfigDecorator = function () {};\n$schema = BuildSchema::build($document, $typeConfigDecorator);",
"text": "Defining your schema\n\n\nSince 0.9.0\n\n\nType language\n is a convenient way to define your schema,\nespecially with IDE autocompletion and syntax validation.\n\n\nHere is a simple schema defined in GraphQL type language (e.g. in a separate \nschema.graphql\n file):\n\n\nschema {\n query: Query\n mutation: Mutation\n}\n\ntype Query {\n greetings(input: HelloInput!): String!\n}\n\ninput HelloInput {\n firstName: String!\n lastName: String\n}\n\n\n\n\nIn order to create schema instance out of this file, use \n\nGraphQL\\Utils\\BuildSchema\n:\n\n\n<?php\nuse GraphQL\\Utils\\BuildSchema;\n\n$contents = file_get_contents('schema.graphql');\n$schema = BuildSchema::build($contents);\n\n\n\n\nBy default, such schema is created without any resolvers. As a result, it doesn't support \nInterfaces\n and \nUnions\n\nbecause it is impossible to resolve actual implementations during execution.\n\n\nAlso, we have to rely on \ndefault field resolver\n and \nroot value\n in \norder to execute a query against this schema.\n\n\nDefining resolvers\n\n\nSince 0.10.0\n\n\nIn order to enable \nInterfaces\n, \nUnions\n and custom field resolvers you can pass the second argument: \n\ntype config decorator\n to schema builder. \n\n\nIt accepts default type config produced by the builder and is expected to add missing options like \n\nresolveType\n for interface types or \n\nresolveField\n for object types.\n\n\n<?php\nuse GraphQL\\Utils\\BuildSchema;\n\n$typeConfigDecorator = function($typeConfig, $typeDefinitionNode) {\n $name = $typeConfig['name'];\n // ... add missing options to $typeConfig based on type $name\n return $typeConfig;\n};\n\n$contents = file_get_contents('schema.graphql');\n$schema = BuildSchema::build($contents, $typeConfigDecorator);\n\n\n\n\nPerformance considerations\n\n\nSince 0.10.0\n\n\nMethod \nbuild()\n produces a \nlazy schema\n\nautomatically, so it works efficiently even with very large schemas.\n\n\nBut parsing type definition file on each request is suboptimal, so it is recommended to cache \nintermediate parsed representation of the schema for the production environment:\n\n\n<?php\nuse GraphQL\\Language\\Parser;\nuse GraphQL\\Utils\\BuildSchema;\nuse GraphQL\\Utils\\AST;\n\n$cacheFilename = 'cached_schema.php';\n\nif (!file_exists($cacheFilename)) {\n $document = Parser::parse(file_get_contents('./schema.graphql'));\n file_put_contents($cacheFilename, \"<?php\\nreturn \" . var_export($document->toArray(), true));\n} else {\n $document = AST::fromArray(require $cacheFilename); // fromArray() is a lazy operation as well\n}\n\n$typeConfigDecorator = function () {};\n$schema = BuildSchema::build($document, $typeConfigDecorator);",
"title": "Using Type Language"
},
{
"location": "/type-system/type-language/#defining-your-schema",
"text": "Type language is a convenient way to define your schema,\nespecially with IDE autocompletion and syntax validation. Here is a simple schema defined in GraphQL type language (e.g. in a separate schema.graphql file): schema {\n query: Query\n mutation: Mutation\n}\n\ntype Query {\n greetings(input: HelloInput!): String!\n}\n\ninput HelloInput {\n firstName: String!\n lastName: String\n} In order to create schema instance out of this file, use GraphQL\\Utils\\BuildSchema : <?php\nuse GraphQL\\Utils\\BuildSchema;\n\n$contents = file_get_contents('schema.graphql');\n$schema = BuildSchema::build($contents); By default, such schema is created without any resolvers. As a result, it doesn't support Interfaces and Unions \nbecause it is impossible to resolve actual implementations during execution. Also, we have to rely on default field resolver and root value in \norder to execute a query against this schema.",
"text": "Since 0.9.0 Type language is a convenient way to define your schema,\nespecially with IDE autocompletion and syntax validation. Here is a simple schema defined in GraphQL type language (e.g. in a separate schema.graphql file): schema {\n query: Query\n mutation: Mutation\n}\n\ntype Query {\n greetings(input: HelloInput!): String!\n}\n\ninput HelloInput {\n firstName: String!\n lastName: String\n} In order to create schema instance out of this file, use GraphQL\\Utils\\BuildSchema : <?php\nuse GraphQL\\Utils\\BuildSchema;\n\n$contents = file_get_contents('schema.graphql');\n$schema = BuildSchema::build($contents); By default, such schema is created without any resolvers. As a result, it doesn't support Interfaces and Unions \nbecause it is impossible to resolve actual implementations during execution. Also, we have to rely on default field resolver and root value in \norder to execute a query against this schema.",
"title": "Defining your schema"
},
{
"location": "/type-system/type-language/#defining-resolvers",
"text": "In order to enable Interfaces , Unions and custom field resolvers you can pass the second argument: type config decorator to schema builder. It accepts default type config produced by the builder and is expected to add missing options like resolveType for interface types or resolveField for object types. <?php\nuse GraphQL\\Utils\\BuildSchema;\n\n$typeConfigDecorator = function($typeConfig, $typeDefinitionNode) {\n $name = $typeConfig['name'];\n // ... add missing options to $typeConfig based on type $name\n return $typeConfig;\n};\n\n$contents = file_get_contents('schema.graphql');\n$schema = BuildSchema::build($contents, $typeConfigDecorator);",
"text": "Since 0.10.0 In order to enable Interfaces , Unions and custom field resolvers you can pass the second argument: type config decorator to schema builder. It accepts default type config produced by the builder and is expected to add missing options like resolveType for interface types or resolveField for object types. <?php\nuse GraphQL\\Utils\\BuildSchema;\n\n$typeConfigDecorator = function($typeConfig, $typeDefinitionNode) {\n $name = $typeConfig['name'];\n // ... add missing options to $typeConfig based on type $name\n return $typeConfig;\n};\n\n$contents = file_get_contents('schema.graphql');\n$schema = BuildSchema::build($contents, $typeConfigDecorator);",
"title": "Defining resolvers"
},
{
"location": "/type-system/type-language/#performance-considerations",
"text": "Method build() produces a lazy schema \nautomatically, so it works efficiently even with very large schemas. But parsing type definition file on each request is suboptimal, so it is recommended to cache \nintermediate parsed representation of the schema for the production environment: <?php\nuse GraphQL\\Language\\Parser;\nuse GraphQL\\Utils\\BuildSchema;\nuse GraphQL\\Utils\\AST;\n\n$cacheFilename = 'cached_schema.php';\n\nif (!file_exists($cacheFilename)) {\n $document = Parser::parse(file_get_contents('./schema.graphql'));\n file_put_contents($cacheFilename, \"<?php\\nreturn \" . var_export($document->toArray(), true));\n} else {\n $document = AST::fromArray(require $cacheFilename); // fromArray() is a lazy operation as well\n}\n\n$typeConfigDecorator = function () {};\n$schema = BuildSchema::build($document, $typeConfigDecorator);",
"text": "Since 0.10.0 Method build() produces a lazy schema \nautomatically, so it works efficiently even with very large schemas. But parsing type definition file on each request is suboptimal, so it is recommended to cache \nintermediate parsed representation of the schema for the production environment: <?php\nuse GraphQL\\Language\\Parser;\nuse GraphQL\\Utils\\BuildSchema;\nuse GraphQL\\Utils\\AST;\n\n$cacheFilename = 'cached_schema.php';\n\nif (!file_exists($cacheFilename)) {\n $document = Parser::parse(file_get_contents('./schema.graphql'));\n file_put_contents($cacheFilename, \"<?php\\nreturn \" . var_export($document->toArray(), true));\n} else {\n $document = AST::fromArray(require $cacheFilename); // fromArray() is a lazy operation as well\n}\n\n$typeConfigDecorator = function () {};\n$schema = BuildSchema::build($document, $typeConfigDecorator);",
"title": "Performance considerations"
},
{

View File

@ -4,7 +4,7 @@
<url>
<loc>/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
@ -12,7 +12,7 @@
<url>
<loc>/getting-started/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
@ -20,7 +20,7 @@
<url>
<loc>/complementary-tools/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
@ -29,67 +29,67 @@
<url>
<loc>/type-system/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/type-system/object-types/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/type-system/scalar-types/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/type-system/enum-types/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/type-system/lists-and-nonnulls/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/type-system/interfaces/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/type-system/unions/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/type-system/input-types/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/type-system/directives/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/type-system/schema/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/type-system/type-language/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
@ -98,7 +98,7 @@
<url>
<loc>/executing-queries/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
@ -106,7 +106,7 @@
<url>
<loc>/data-fetching/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
@ -114,7 +114,7 @@
<url>
<loc>/error-handling/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
@ -122,7 +122,7 @@
<url>
<loc>/security/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
@ -130,7 +130,7 @@
<url>
<loc>/how-it-works/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>
@ -138,7 +138,7 @@
<url>
<loc>/reference/</loc>
<lastmod>2017-08-21</lastmod>
<lastmod>2017-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

View File

@ -192,6 +192,7 @@
<div class="section">
<h1 id="defining-your-schema">Defining your schema</h1>
<p>Since 0.9.0</p>
<p><a href="http://graphql.org/learn/schema/#type-language">Type language</a> is a convenient way to define your schema,
especially with IDE autocompletion and syntax validation.</p>
<p>Here is a simple schema defined in GraphQL type language (e.g. in a separate <strong>schema.graphql</strong> file):</p>
@ -224,6 +225,7 @@ because it is impossible to resolve actual implementations during execution.</p>
<p>Also, we have to rely on <a href="../../data-fetching/#default-field-resolver">default field resolver</a> and <strong>root value</strong> in
order to execute a query against this schema.</p>
<h1 id="defining-resolvers">Defining resolvers</h1>
<p>Since 0.10.0</p>
<p>In order to enable <strong>Interfaces</strong>, <strong>Unions</strong> and custom field resolvers you can pass the second argument:
<strong>type config decorator</strong> to schema builder. </p>
<p>It accepts default type config produced by the builder and is expected to add missing options like
@ -243,6 +245,7 @@ $schema = BuildSchema::build($contents, $typeConfigDecorator);
</code></pre>
<h1 id="performance-considerations">Performance considerations</h1>
<p>Since 0.10.0</p>
<p>Method <strong>build()</strong> produces a <a href="../schema/#lazy-loading-of-types">lazy schema</a>
automatically, so it works efficiently even with very large schemas.</p>
<p>But parsing type definition file on each request is suboptimal, so it is recommended to cache