Sha256: 9f4923a5840df0b3a352fd3c8f32f88d3a1fe1fa56b65f0c406ecd13f7e61389
Contents?: true
Size: 954 Bytes
Versions: 26
Compression:
Stored size: 954 Bytes
Contents
# frozen_string_literal: true module GraphQL module StaticValidation module FieldsAreDefinedOnType def on_field(node, parent) parent_type = @object_types[-2] field = context.warden.get_field(parent_type, node.name) if field.nil? if parent_type.kind.union? add_error(GraphQL::StaticValidation::FieldsHaveAppropriateSelectionsError.new( "Selections can't be made directly on unions (see selections on #{parent_type.name})", nodes: parent, node_name: parent_type.name )) else add_error(GraphQL::StaticValidation::FieldsAreDefinedOnTypeError.new( "Field '#{node.name}' doesn't exist on type '#{parent_type.name}'", nodes: node, field: node.name, type: parent_type.name )) end else super end end end end end
Version data entries
26 entries across 26 versions & 1 rubygems