zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

directives.ex (675B)


      1 defmodule Absinthe.Phase.Document.Directives do
      2   @moduledoc false
      3 
      4   # Expand all directives in the document.
      5   #
      6   # Note that no validation occurs in this phase.
      7 
      8   use Absinthe.Phase
      9   alias Absinthe.Blueprint
     10 
     11   @spec run(Blueprint.t(), Keyword.t()) :: {:ok, Blueprint.t()}
     12   def run(input, _options \\ []) do
     13     node = Blueprint.prewalk(input, &handle_node/1)
     14     {:ok, node}
     15   end
     16 
     17   @spec handle_node(Blueprint.node_t()) :: Blueprint.node_t()
     18   defp handle_node(%{directives: directives} = node) do
     19     Enum.reduce(directives, node, fn directive, acc ->
     20       Blueprint.Directive.expand(directive, acc)
     21     end)
     22   end
     23 
     24   defp handle_node(node) do
     25     node
     26   end
     27 end