Class: GraphQL::StaticValidation::FieldsHaveAppropriateSelections

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

Overview

Scalars can't have selections Objects must have selections

Instance Method Summary collapse

Methods included from Message::MessageHelper

#message

Instance Method Details

#validate(context) ⇒ Object


8
9
10
11
12
13
14
# File 'lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb', line 8

def validate(context)
  context.visitor[GraphQL::Language::Nodes::Field] << ->(node, parent)  {
    return if context.skip_field?(node.name)
    field_defn = context.field_definition
    validate_field_selections(node, field_defn, context)
  }
end