Sha256: b5cbfde54768ebaaa176a7c188691ef0950c045eb8c32de2e417fe85521bb3ea

Contents?: true

Size: 733 Bytes

Versions: 13

Compression:

Stored size: 733 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  module StaticValidation
    module DirectivesAreDefined
      def initialize(*)
        super
      end

      def on_directive(node, parent)
        if !@types.directive_exists?(node.name)
          @directives_are_defined_errors_by_name ||= {}
          error = @directives_are_defined_errors_by_name[node.name] ||= begin
            err = GraphQL::StaticValidation::DirectivesAreDefinedError.new(
              "Directive @#{node.name} is not defined",
              nodes: [],
              directive: node.name
            )
            add_error(err)
            err
          end
          error.nodes << node
        else
          super
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
graphql-2.3.20 lib/graphql/static_validation/rules/directives_are_defined.rb
graphql-2.3.19 lib/graphql/static_validation/rules/directives_are_defined.rb
graphql-2.3.18 lib/graphql/static_validation/rules/directives_are_defined.rb
graphql-2.3.17 lib/graphql/static_validation/rules/directives_are_defined.rb
graphql-2.3.16 lib/graphql/static_validation/rules/directives_are_defined.rb
graphql-2.3.15 lib/graphql/static_validation/rules/directives_are_defined.rb
graphql-2.3.14 lib/graphql/static_validation/rules/directives_are_defined.rb
graphql-2.3.13 lib/graphql/static_validation/rules/directives_are_defined.rb
graphql-2.3.12 lib/graphql/static_validation/rules/directives_are_defined.rb
graphql-2.3.11 lib/graphql/static_validation/rules/directives_are_defined.rb
graphql-2.3.10 lib/graphql/static_validation/rules/directives_are_defined.rb
graphql-2.3.9 lib/graphql/static_validation/rules/directives_are_defined.rb
graphql-2.3.8 lib/graphql/static_validation/rules/directives_are_defined.rb