Class: GraphQL::StaticValidation::FragmentsAreOnCompositeTypes

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

Constant Summary collapse

HAS_TYPE_CONDITION =
[
  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
17
18
# File 'lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb', line 12

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