directive.ex (695B)
1 defmodule Absinthe.Language.Directive do 2 @moduledoc false 3 4 alias Absinthe.{Blueprint, Language} 5 6 defstruct name: nil, 7 arguments: [], 8 loc: nil 9 10 @type t :: %__MODULE__{ 11 name: String.t(), 12 arguments: [Language.Argument], 13 loc: Language.loc_t() 14 } 15 16 defimpl Blueprint.Draft do 17 def convert(node, doc) do 18 %Blueprint.Directive{ 19 name: node.name, 20 arguments: Absinthe.Blueprint.Draft.convert(node.arguments, doc), 21 source_location: source_location(node) 22 } 23 end 24 25 defp source_location(%{loc: nil}), do: nil 26 defp source_location(%{loc: loc}), do: Blueprint.SourceLocation.at(loc) 27 end 28 end