mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-06 07:49:24 +03:00
Deployed fb0ca60 with MkDocs version: 0.16.3
This commit is contained in:
parent
b5895421b8
commit
0e822d392f
@ -280,5 +280,5 @@ existing PHP frameworks, add support for Relay, etc.</p>
|
||||
|
||||
<!--
|
||||
MkDocs version : 0.16.3
|
||||
Build Date UTC : 2017-09-05 08:30:29
|
||||
Build Date UTC : 2017-09-29 13:08:24
|
||||
-->
|
||||
|
@ -327,7 +327,7 @@
|
||||
},
|
||||
{
|
||||
"location": "/type-system/type-language/",
|
||||
"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);",
|
||||
"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(AST::toArray($document), 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"
|
||||
},
|
||||
{
|
||||
@ -342,7 +342,7 @@
|
||||
},
|
||||
{
|
||||
"location": "/type-system/type-language/#performance-considerations",
|
||||
"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);",
|
||||
"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(AST::toArray($document), 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"
|
||||
},
|
||||
{
|
||||
|
40
sitemap.xml
40
sitemap.xml
@ -4,7 +4,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/getting-started/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/complementary-tools/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@ -29,67 +29,67 @@
|
||||
|
||||
<url>
|
||||
<loc>/type-system/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>/type-system/object-types/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>/type-system/scalar-types/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>/type-system/enum-types/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>/type-system/lists-and-nonnulls/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>/type-system/interfaces/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>/type-system/unions/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>/type-system/input-types/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>/type-system/directives/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>/type-system/schema/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>/type-system/type-language/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@ -98,7 +98,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/executing-queries/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@ -106,7 +106,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/data-fetching/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@ -114,7 +114,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/error-handling/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@ -122,7 +122,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/security/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@ -130,7 +130,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/how-it-works/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@ -138,7 +138,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/reference/</loc>
|
||||
<lastmod>2017-09-05</lastmod>
|
||||
<lastmod>2017-09-29</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
|
@ -259,7 +259,7 @@ $cacheFilename = 'cached_schema.php';
|
||||
|
||||
if (!file_exists($cacheFilename)) {
|
||||
$document = Parser::parse(file_get_contents('./schema.graphql'));
|
||||
file_put_contents($cacheFilename, "<?php\nreturn " . var_export($document->toArray(), true));
|
||||
file_put_contents($cacheFilename, "<?php\nreturn " . var_export(AST::toArray($document), true));
|
||||
} else {
|
||||
$document = AST::fromArray(require $cacheFilename); // fromArray() is a lazy operation as well
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user