Class: GraphQL::StaticValidation::DefinitionDependencies::DependencyMap

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/static_validation/definition_dependencies.rb

Overview

Map definition AST nodes to the definition AST nodes they depend on. Expose circular dependencies.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDependencyMap

Returns a new instance of DependencyMap.



85
86
87
88
89
90
# File 'lib/graphql/static_validation/definition_dependencies.rb', line 85

def initialize
  @dependencies = Hash.new { |h, k| h[k] = [] }
  @cyclical_definitions = []
  @unmet_dependencies = Hash.new { |h, k| h[k] = [] }
  @unused_dependencies = []
end

Instance Attribute Details

#cyclical_definitionsArray<GraphQL::Language::Nodes::FragmentDefinition> (readonly)



77
78
79
# File 'lib/graphql/static_validation/definition_dependencies.rb', line 77

def cyclical_definitions
  @cyclical_definitions
end

#unmet_dependenciesHash<Node, Array<GraphQL::Language::Nodes::FragmentSpread>> (readonly)

Returns:



80
81
82
# File 'lib/graphql/static_validation/definition_dependencies.rb', line 80

def unmet_dependencies
  @unmet_dependencies
end

#unused_dependenciesArray<GraphQL::Language::Nodes::FragmentDefinition> (readonly)



83
84
85
# File 'lib/graphql/static_validation/definition_dependencies.rb', line 83

def unused_dependencies
  @unused_dependencies
end

Instance Method Details

#[](definition_node) ⇒ Array<GraphQL::Language::Nodes::AbstractNode>

Returns dependencies for definition_node.

Returns:



93
94
95
# File 'lib/graphql/static_validation/definition_dependencies.rb', line 93

def [](definition_node)
  @dependencies[definition_node]
end