zf

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

union_type_definition.ex (1051B)


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