Class: GraphQL::StaticValidation::FieldsAreDefinedOnType

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

Instance Method Summary collapse

Methods included from Message::MessageHelper

#message

Instance Method Details

#validate(context) ⇒ Object



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

def validate(context)
  visitor = context.visitor
  visitor[GraphQL::Language::Nodes::Field] << ->(node, parent) {
    parent_type = context.object_types[-2]
    parent_type = parent_type.unwrap
    validate_field(context, node, parent_type, parent)
  }
end