zf

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

enum_value_definition.ex (1016B)


      1 defmodule Absinthe.Language.EnumValueDefinition do
      2   @moduledoc false
      3 
      4   alias Absinthe.{Blueprint, Language}
      5 
      6   @enforce_keys [:value]
      7   defstruct [
      8     :value,
      9     description: nil,
     10     directives: [],
     11     loc: %{line: nil, column: nil}
     12   ]
     13 
     14   @type t :: %__MODULE__{
     15           value: String.t(),
     16           description: nil | String.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.EnumValueDefinition{
     24         value: node.value |> Macro.underscore() |> String.to_atom(),
     25         name: node.value,
     26         identifier: node.value |> Macro.underscore() |> String.to_atom(),
     27         description: node.description,
     28         directives: Absinthe.Blueprint.Draft.convert(node.directives, doc),
     29         source_location: source_location(node)
     30       }
     31     end
     32 
     33     defp source_location(%{loc: nil}), do: nil
     34     defp source_location(%{loc: loc}), do: Blueprint.SourceLocation.at(loc)
     35   end
     36 end