doc/index.html in gqli-0.3.0 vs doc/index.html in gqli-0.4.0

- old
+ new

@@ -362,10 +362,40 @@ <span class='rbrace'>}</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span> </code></pre> +<h3 id="label-Directives">Directives</h3> + +<p>In GraphQL, nodes can be selectively included or removed by the usage of +directives, there are 2 directives available for the querying specification +to do this: <code>@include</code> and <code>@skip</code>.</p> + +<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/DSL.html" title="GQLi::DSL (module)">DSL</a></span></span><span class='period'>.</span><span class='id identifier rubyid_query'><span class='object_link'><a href="GQLi/DSL.html#query-class_method" title="GQLi::DSL.query (method)">query</a></span></span> <span class='lbrace'>{</span> + <span class='id identifier rubyid_someNode'>someNode</span><span class='lparen'>(</span><span class='symbol'>:@include</span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span><span class='label'>if:</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_includes_some_node?'>includes_some_node?</span><span class='rbrace'>}</span><span class='rparen'>)</span> +<span class='rbrace'>}</span> +</code></pre> + +<p>This will get transformed to:</p> + +<pre class="code ruby"><code class="ruby">query { + someNode @include(if: true) # or false +} +</code></pre> + +<p>This behaviour is equivalent to using native Ruby to include/exclude a +field from the query:</p> + +<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/DSL.html" title="GQLi::DSL (module)">DSL</a></span></span><span class='period'>.</span><span class='id identifier rubyid_query'><span class='object_link'><a href="GQLi/DSL.html#query-class_method" title="GQLi::DSL.query (method)">query</a></span></span> <span class='lbrace'>{</span> + <span class='id identifier rubyid_someNode'>someNode</span> <span class='kw'>if</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_includes_some_node?'>includes_some_node?</span> +<span class='rbrace'>}</span> +</code></pre> + +<p>The difference is that by using the native implementation, in case of the +condition not being met, the node will be completely not included in the +outgoing query.</p> + <h2 id="label-Yet+to+be+implemented">Yet to be implemented</h2> <ul><li> <p>Mutation queries</p> </li><li> <p>Subscription queries</p> @@ -395,10 +425,10 @@ href="https://github.com/contentful-developer-relations/community-code-of-conduct">Read our full Code of Conduct</a>.</p> </div></div> <div id="footer"> - Generated on Fri Oct 19 16:26:03 2018 by + Generated on Fri Nov 16 16:26:30 2018 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.9.16 (ruby-2.5.1). </div> </div> \ No newline at end of file