context.ex (585B)
1 defmodule Absinthe.Phase.Document.Context do 2 @moduledoc "Pass on context and root value to document." 3 4 use Absinthe.Phase 5 alias Absinthe.Blueprint 6 7 @spec run(Blueprint.t(), Keyword.t()) :: {:ok, Blueprint.t()} 8 def run(blueprint, options \\ []) do 9 context = Map.merge(blueprint.execution.context, options[:context] || %{}) 10 blueprint = put_in(blueprint.execution.context, context) 11 12 root_value = Map.merge(blueprint.execution.root_value, options[:root_value] || %{}) 13 blueprint = put_in(blueprint.execution.root_value, root_value) 14 15 {:ok, blueprint} 16 end 17 end