zf

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

field.ex (1401B)


      1 defmodule Absinthe.Language.Field do
      2   @moduledoc false
      3 
      4   alias Absinthe.{Blueprint, Language}
      5 
      6   defstruct alias: nil,
      7             name: nil,
      8             arguments: [],
      9             directives: [],
     10             selection_set: nil,
     11             loc: %{line: nil}
     12 
     13   @type t :: %__MODULE__{
     14           alias: nil | String.t(),
     15           name: String.t(),
     16           arguments: [Absinthe.Language.Argument.t()],
     17           directives: [Absinthe.Language.Directive.t()],
     18           selection_set: Absinthe.Language.SelectionSet.t(),
     19           loc: Absinthe.Language.loc_t()
     20         }
     21 
     22   defimpl Blueprint.Draft do
     23     def convert(node, doc) do
     24       %Blueprint.Document.Field{
     25         name: node.name,
     26         alias: node.alias,
     27         selections: Absinthe.Blueprint.Draft.convert(selections(node.selection_set), doc),
     28         arguments: Absinthe.Blueprint.Draft.convert(node.arguments, doc),
     29         directives: Absinthe.Blueprint.Draft.convert(node.directives, doc),
     30         source_location: source_location(node)
     31       }
     32     end
     33 
     34     defp source_location(%{loc: nil}), do: nil
     35     defp source_location(%{loc: loc}), do: Blueprint.SourceLocation.at(loc)
     36 
     37     @spec selections(nil | Language.SelectionSet.t()) :: [
     38             Language.Field.t() | Language.InlineFragment.t() | Language.FragmentSpread.t()
     39           ]
     40     defp selections(nil), do: []
     41     defp selections(node), do: node.selections
     42   end
     43 end