zf

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

field_definition.ex (1282B)


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