zf

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

input_object_type_definition.ex (1204B)


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