module GraphQL::StaticValidation::FragmentNamesAreUnique
Public Class Methods
Source
# File lib/graphql/static_validation/rules/fragment_names_are_unique.rb, line 9 def initialize(*) super @fragments_by_name = Hash.new { |h, k| h[k] = [] } end
Calls superclass method
Public Instance Methods
Source
# File lib/graphql/static_validation/rules/fragment_names_are_unique.rb, line 19 def on_document(_n, _p) super @fragments_by_name.each do |name, fragments| if fragments.length > 1 add_error(GraphQL::StaticValidation::FragmentNamesAreUniqueError.new( %|Fragment name "#{name}" must be unique|, nodes: fragments, name: name )) end end end
Calls superclass method
# File lib/graphql/static_validation/rules/fragment_names_are_unique.rb, line 14 def on_fragment_definition(node, parent) @fragments_by_name[node.name] << node super end
Calls superclass method