Sha256: 201b2b9ce25f1e916c6eee1b8f6d8b4c3ebfb1be1e0f2c488c9dc7798f98078b
Contents?: true
Size: 821 Bytes
Versions: 140
Compression:
Stored size: 821 Bytes
Contents
# frozen_string_literal: true module GraphQL module StaticValidation module InputObjectNamesAreUnique def on_input_object(node, parent) validate_input_fields(node) super end private def validate_input_fields(node) input_field_defns = node.arguments input_fields_by_name = Hash.new { |h, k| h[k] = [] } input_field_defns.each { |a| input_fields_by_name[a.name] << a } input_fields_by_name.each do |name, defns| if defns.size > 1 error = GraphQL::StaticValidation::InputObjectNamesAreUniqueError.new( "There can be only one input field named \"#{name}\"", nodes: defns, name: name ) add_error(error) end end end end end end
Version data entries
140 entries across 140 versions & 2 rubygems