named.ex (1039B)
1 defmodule Absinthe.Blueprint.Document.Fragment.Named do 2 @moduledoc false 3 4 alias Absinthe.Blueprint 5 alias __MODULE__ 6 7 @enforce_keys [:name, :type_condition] 8 defstruct [ 9 :name, 10 :type_condition, 11 selections: [], 12 directives: [], 13 source_location: nil, 14 # Populated by phases 15 schema_node: nil, 16 complexity: nil, 17 flags: %{}, 18 errors: [] 19 ] 20 21 @type t :: %__MODULE__{ 22 directives: [Blueprint.Directive.t()], 23 errors: [Absinthe.Phase.Error.t()], 24 name: String.t(), 25 selections: [Blueprint.Document.selection_t()], 26 schema_node: nil | Absinthe.Type.t(), 27 source_location: nil | Blueprint.SourceLocation.t(), 28 flags: Blueprint.flags_t(), 29 type_condition: Blueprint.TypeReference.Name.t() 30 } 31 32 @doc """ 33 Generate a use reference for a fragment. 34 """ 35 @spec to_use(t) :: Named.Use.t() 36 def to_use(%__MODULE__{} = node) do 37 %Named.Use{ 38 name: node.name, 39 source_location: node.source_location 40 } 41 end 42 end