Class: GraphQL::StaticValidation::FragmentTypesExist

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

Constant Summary collapse

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

Instance Method Summary collapse

Methods included from Message::MessageHelper

#message

Instance Method Details

#validate(context) ⇒ Object



12
13
14
15
16
# File 'lib/graphql/static_validation/rules/fragment_types_exist.rb', line 12

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