mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-26 23:06:04 +03:00
270 lines
8.4 KiB
HTML
270 lines
8.4 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||
|
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
|
||
|
|
||
|
<link rel="shortcut icon" href="../img/favicon.ico">
|
||
|
<title>How it works - graphql-php</title>
|
||
|
<link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
|
||
|
|
||
|
<link rel="stylesheet" href="../css/theme.css" type="text/css" />
|
||
|
<link rel="stylesheet" href="../css/theme_extra.css" type="text/css" />
|
||
|
<link rel="stylesheet" href="../css/highlight.css">
|
||
|
|
||
|
<script>
|
||
|
// Current page data
|
||
|
var mkdocs_page_name = "How it works";
|
||
|
var mkdocs_page_input_path = "how-it-works.md";
|
||
|
var mkdocs_page_url = "/how-it-works/";
|
||
|
</script>
|
||
|
|
||
|
<script src="../js/jquery-2.1.1.min.js"></script>
|
||
|
<script src="../js/modernizr-2.8.3.min.js"></script>
|
||
|
<script type="text/javascript" src="../js/highlight.pack.js"></script>
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body class="wy-body-for-nav" role="document">
|
||
|
|
||
|
<div class="wy-grid-for-nav">
|
||
|
|
||
|
|
||
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
|
||
|
<div class="wy-side-nav-search">
|
||
|
<a href=".." class="icon icon-home"> graphql-php</a>
|
||
|
<div role="search">
|
||
|
<form id ="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||
|
<input type="text" name="q" placeholder="Search docs" />
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||
|
<ul class="current">
|
||
|
|
||
|
|
||
|
<li class="toctree-l1">
|
||
|
|
||
|
<a class="" href="..">About</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="toctree-l1">
|
||
|
|
||
|
<a class="" href="../getting-started/">Getting Started</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="toctree-l1">
|
||
|
|
||
|
<a class="" href="../complementary-tools/">Complementary Tools</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="toctree-l1">
|
||
|
|
||
|
<span class="caption-text">Type Definitions</span>
|
||
|
<ul class="subnav">
|
||
|
<li class="">
|
||
|
|
||
|
<a class="" href="../type-system/">Introduction</a>
|
||
|
</li>
|
||
|
<li class="">
|
||
|
|
||
|
<a class="" href="../type-system/object-types/">Object Types</a>
|
||
|
</li>
|
||
|
<li class="">
|
||
|
|
||
|
<a class="" href="../type-system/scalar-types/">Scalar Types</a>
|
||
|
</li>
|
||
|
<li class="">
|
||
|
|
||
|
<a class="" href="../type-system/enum-types/">Enumeration Types</a>
|
||
|
</li>
|
||
|
<li class="">
|
||
|
|
||
|
<a class="" href="../type-system/lists-and-nonnulls/">Lists and Non-Null</a>
|
||
|
</li>
|
||
|
<li class="">
|
||
|
|
||
|
<a class="" href="../type-system/interfaces/">Interfaces</a>
|
||
|
</li>
|
||
|
<li class="">
|
||
|
|
||
|
<a class="" href="../type-system/unions/">Unions</a>
|
||
|
</li>
|
||
|
<li class="">
|
||
|
|
||
|
<a class="" href="../type-system/input-types/">Mutations and Input Types</a>
|
||
|
</li>
|
||
|
<li class="">
|
||
|
|
||
|
<a class="" href="../type-system/directives/">Directives</a>
|
||
|
</li>
|
||
|
<li class="">
|
||
|
|
||
|
<a class="" href="../type-system/schema/">Schema</a>
|
||
|
</li>
|
||
|
<li class="">
|
||
|
|
||
|
<a class="" href="../type-system/type-language/">Using Type Language</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
|
||
|
<li class="toctree-l1">
|
||
|
|
||
|
<a class="" href="../executing-queries/">Executing Queries</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="toctree-l1">
|
||
|
|
||
|
<a class="" href="../data-fetching/">Fetching Data</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="toctree-l1">
|
||
|
|
||
|
<a class="" href="../error-handling/">Handling Errors</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="toctree-l1">
|
||
|
|
||
|
<a class="" href="../security/">Security</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="toctree-l1 current">
|
||
|
|
||
|
<a class="current" href="./">How it works</a>
|
||
|
<ul class="subnav">
|
||
|
|
||
|
<li class="toctree-l2"><a href="#overview">Overview</a></li>
|
||
|
|
||
|
|
||
|
<li class="toctree-l2"><a href="#parsing">Parsing</a></li>
|
||
|
|
||
|
|
||
|
<li class="toctree-l2"><a href="#validating">Validating</a></li>
|
||
|
|
||
|
|
||
|
<li class="toctree-l2"><a href="#executing">Executing</a></li>
|
||
|
|
||
|
|
||
|
<li class="toctree-l2"><a href="#errors-explained">Errors explained</a></li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
</li>
|
||
|
|
||
|
<li class="toctree-l1">
|
||
|
|
||
|
<a class="" href="../reference/">Class Reference</a>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
</div>
|
||
|
|
||
|
</nav>
|
||
|
|
||
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||
|
|
||
|
|
||
|
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
|
||
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||
|
<a href="..">graphql-php</a>
|
||
|
</nav>
|
||
|
|
||
|
|
||
|
<div class="wy-nav-content">
|
||
|
<div class="rst-content">
|
||
|
<div role="navigation" aria-label="breadcrumbs navigation">
|
||
|
<ul class="wy-breadcrumbs">
|
||
|
<li><a href="..">Docs</a> »</li>
|
||
|
|
||
|
|
||
|
|
||
|
<li>How it works</li>
|
||
|
<li class="wy-breadcrumbs-aside">
|
||
|
|
||
|
</li>
|
||
|
</ul>
|
||
|
<hr/>
|
||
|
</div>
|
||
|
<div role="main">
|
||
|
<div class="section">
|
||
|
|
||
|
<h1 id="overview">Overview</h1>
|
||
|
<p>Following reading describes implementation details of query execution process. It may clarify some
|
||
|
internals of GraphQL runtime but is not required to use it.</p>
|
||
|
<h1 id="parsing">Parsing</h1>
|
||
|
<p>TODOC</p>
|
||
|
<h1 id="validating">Validating</h1>
|
||
|
<p>TODOC</p>
|
||
|
<h1 id="executing">Executing</h1>
|
||
|
<p>TODOC</p>
|
||
|
<h1 id="errors-explained">Errors explained</h1>
|
||
|
<p>There are 3 types of errors in GraphQL:</p>
|
||
|
<ul>
|
||
|
<li><strong>Syntax</strong>: query has invalid syntax and could not be parsed;</li>
|
||
|
<li><strong>Validation</strong>: query is incompatible with type system (e.g. unknown field is requested);</li>
|
||
|
<li><strong>Execution</strong>: occurs when some field resolver throws (or returns unexpected value).</li>
|
||
|
</ul>
|
||
|
<p>Obviously, when <strong>Syntax</strong> or <strong>Validation</strong> error is detected - the process is interrupted and
|
||
|
the query is not executed.</p>
|
||
|
<p>Execution process never throws exceptions. Instead, all errors are caught and collected in
|
||
|
execution result.</p>
|
||
|
<p>GraphQL is forgiving to <strong>Execution</strong> errors which occur in resolvers of nullable fields.
|
||
|
If such field throws or returns unexpected value the value of the field in response will be simply
|
||
|
replaced with <strong>null</strong> and error entry will be registered.</p>
|
||
|
<p>If an exception is thrown in the non-null field - error bubbles up to the first nullable field.
|
||
|
This nullable field is replaced with <strong>null</strong> and error entry is added to the result.
|
||
|
If all fields up to the root are non-null - <strong>data</strong> entry will be removed from the result<br />
|
||
|
and only <strong>errors</strong> key will be presented.</p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<footer>
|
||
|
|
||
|
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
||
|
|
||
|
<a href="../reference/" class="btn btn-neutral float-right" title="Class Reference">Next <span class="icon icon-circle-arrow-right"></span></a>
|
||
|
|
||
|
|
||
|
<a href="../security/" class="btn btn-neutral" title="Security"><span class="icon icon-circle-arrow-left"></span> Previous</a>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<hr/>
|
||
|
|
||
|
<div role="contentinfo">
|
||
|
<!-- Copyright etc -->
|
||
|
|
||
|
</div>
|
||
|
|
||
|
Built with <a href="http://www.mkdocs.org">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||
|
</footer>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</section>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="rst-versions" role="note" style="cursor: pointer">
|
||
|
<span class="rst-current-version" data-toggle="rst-current-version">
|
||
|
|
||
|
|
||
|
<span><a href="../security/" style="color: #fcfcfc;">« Previous</a></span>
|
||
|
|
||
|
|
||
|
<span style="margin-left: 15px"><a href="../reference/" style="color: #fcfcfc">Next »</a></span>
|
||
|
|
||
|
</span>
|
||
|
</div>
|
||
|
<script src="../js/theme.js"></script>
|
||
|
|
||
|
</body>
|
||
|
</html>
|