Module: GraphQL::StaticValidation::FieldsHaveAppropriateSelections

Includes:
Error::ErrorHelper
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 Error::ErrorHelper

#error

Instance Method Details

#on_field(node, parent) ⇒ Object

[View source]

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

def on_field(node, parent)
  field_defn = field_definition
  if validate_field_selections(node, field_defn.type.unwrap)
    super
  end
end

#on_operation_definition(node, _parent) ⇒ Object

[View source]

16
17
18
19
20
# File 'lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb', line 16

def on_operation_definition(node, _parent)
  if validate_field_selections(node, type_definition)
    super
  end
end