zf

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

variable_definition.ex (978B)


      1 defmodule Absinthe.Language.VariableDefinition do
      2   @moduledoc false
      3 
      4   alias Absinthe.{Blueprint, Language}
      5 
      6   defstruct variable: nil,
      7             type: nil,
      8             directives: [],
      9             default_value: nil,
     10             loc: %{line: nil}
     11 
     12   @type t :: %__MODULE__{
     13           variable: Language.Variable.t(),
     14           type: Language.type_reference_t(),
     15           default_value: any,
     16           loc: Language.loc_t()
     17         }
     18 
     19   defimpl Blueprint.Draft do
     20     def convert(node, doc) do
     21       %Blueprint.Document.VariableDefinition{
     22         name: node.variable.name,
     23         type: Blueprint.Draft.convert(node.type, doc),
     24         directives: Absinthe.Blueprint.Draft.convert(node.directives, doc),
     25         default_value: Blueprint.Draft.convert(node.default_value, doc),
     26         source_location: source_location(node)
     27       }
     28     end
     29 
     30     defp source_location(%{loc: nil}), do: nil
     31     defp source_location(%{loc: loc}), do: Blueprint.SourceLocation.at(loc)
     32   end
     33 end