Sha256: eb0124944584d83a4fb0c24b6c5e2c2bc6285f4729d6b0da98806725180efe37
Contents?: true
Size: 919 Bytes
Versions: 13
Compression:
Stored size: 919 Bytes
Contents
# frozen_string_literal: true module GraphQL module StaticValidation module FragmentTypesExist def on_fragment_definition(node, _parent) if validate_type_exists(node) super end end def on_inline_fragment(node, _parent) if validate_type_exists(node) super end end private def validate_type_exists(fragment_node) if !fragment_node.type true else type_name = fragment_node.type.name type = @types.type(type_name) if type.nil? add_error(GraphQL::StaticValidation::FragmentTypesExistError.new( "No such type #{type_name}, so it can't be a fragment condition", nodes: fragment_node, type: type_name )) false else true end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems