argument.ex (1099B)
1 defmodule Absinthe.Blueprint.Input.Argument do 2 @moduledoc false 3 4 alias Absinthe.Blueprint 5 6 @enforce_keys [:name, :source_location, :input_value] 7 defstruct [ 8 :name, 9 :input_value, 10 :source_location, 11 # Added by phases 12 schema_node: nil, 13 # Value converted to native elixir value 14 value: nil, 15 flags: %{}, 16 errors: [] 17 ] 18 19 @type t :: %__MODULE__{ 20 name: String.t(), 21 input_value: Blueprint.Input.Value.t(), 22 source_location: Blueprint.SourceLocation.t(), 23 schema_node: nil | Absinthe.Type.Argument.t(), 24 value: any, 25 flags: Blueprint.flags_t(), 26 errors: [Absinthe.Phase.Error.t()] 27 } 28 29 @spec value_map([t]) :: %{atom => any} 30 def value_map(arguments) do 31 arguments 32 |> Enum.filter(fn 33 %__MODULE__{schema_node: nil} -> 34 false 35 36 %__MODULE__{input_value: %{normalized: %Blueprint.Input.Null{}}, value: nil} -> 37 true 38 39 %__MODULE__{value: nil} -> 40 false 41 42 arg -> 43 arg 44 end) 45 |> Map.new(&{&1.schema_node.identifier, &1.value}) 46 end 47 end