Class: GraphQL::StaticValidation::FragmentTypesExist

Inherits:
Object
  • Object
show all
Includes:
Message::MessageHelper
Defined in:
lib/graph_ql/static_validation/rules/fragment_types_exist.rb

Constant Summary collapse

FRAGMENTS_ON_TYPES =
[
  GraphQL::Nodes::FragmentDefinition,
  GraphQL::Nodes::InlineFragment,
]

Instance Method Summary collapse

Methods included from Message::MessageHelper

#message

Instance Method Details

#validate(context) ⇒ Object



9
10
11
12
13
# File 'lib/graph_ql/static_validation/rules/fragment_types_exist.rb', line 9

def validate(context)
  FRAGMENTS_ON_TYPES.each do |node_class|
    context.visitor[node_class] << -> (node, parent) { validate_type_exists(node, context) }
  end
end