zf

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

normalize.ex (801B)


      1 defmodule Absinthe.Phase.Schema.Arguments.Normalize do
      2   @moduledoc false
      3 
      4   # Populate all arguments in the document with their provided values:
      5   #
      6   # - If a literal value is provided for an argument, set the `Argument.t`'s
      7   #   `normalized_value` field to that value.
      8   #
      9   # Note that no validation occurs in this phase.
     10 
     11   use Absinthe.Phase
     12   alias Absinthe.Blueprint
     13   alias Absinthe.Blueprint.Input
     14 
     15   @spec run(Blueprint.t(), Keyword.t()) :: {:ok, Blueprint.t()}
     16   def run(input, _options \\ []) do
     17     node = Blueprint.prewalk(input, &handle_node/1)
     18     {:ok, node}
     19   end
     20 
     21   # Set provided value from the raw value
     22   defp handle_node(%Input.RawValue{} = node) do
     23     %Input.Value{
     24       normalized: node.content,
     25       raw: node
     26     }
     27   end
     28 
     29   defp handle_node(node) do
     30     node
     31   end
     32 end