enum_type_definition.ex (1041B)
1 defmodule Absinthe.Language.EnumTypeDefinition do 2 @moduledoc false 3 4 alias Absinthe.{Blueprint, Language} 5 6 defstruct name: nil, 7 description: nil, 8 values: [], 9 directives: [], 10 loc: %{line: nil} 11 12 @type t :: %__MODULE__{ 13 name: String.t(), 14 description: nil | String.t(), 15 values: [String.t()], 16 directives: [Language.Directive.t()], 17 loc: Language.loc_t() 18 } 19 20 defimpl Blueprint.Draft do 21 def convert(node, doc) do 22 %Blueprint.Schema.EnumTypeDefinition{ 23 name: node.name, 24 description: node.description, 25 identifier: Macro.underscore(node.name) |> String.to_atom(), 26 values: Absinthe.Blueprint.Draft.convert(node.values, 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