Sha256: 990d5904ae33b38daf1cc77dcf8d165ddc16e55198bfe270a2b3c97ee6c11732

Contents?: true

Size: 640 Bytes

Versions: 8

Compression:

Stored size: 640 Bytes

Contents

module GraphQL
  module StaticValidation
    class ArgumentsAreDefined < GraphQL::StaticValidation::ArgumentsValidator
      def validate_node(parent, node, defn, context)
        argument_defn = context.warden.arguments(defn).find { |arg| arg.name == node.name }
        if argument_defn.nil?
          kind_of_node = node_type(parent)
          error_arg_name = parent_name(parent, defn)
          context.errors << message("#{kind_of_node} '#{error_arg_name}' doesn't accept argument '#{node.name}'", parent, context: context)
          GraphQL::Language::Visitor::SKIP
        else
          nil
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
graphql-1.2.6 lib/graphql/static_validation/rules/arguments_are_defined.rb
graphql-1.2.5 lib/graphql/static_validation/rules/arguments_are_defined.rb
graphql-1.2.4 lib/graphql/static_validation/rules/arguments_are_defined.rb
graphql-1.2.3 lib/graphql/static_validation/rules/arguments_are_defined.rb
graphql-1.2.2 lib/graphql/static_validation/rules/arguments_are_defined.rb
graphql-1.2.1 lib/graphql/static_validation/rules/arguments_are_defined.rb
graphql-1.2.0 lib/graphql/static_validation/rules/arguments_are_defined.rb
graphql-1.1.0 lib/graphql/static_validation/rules/arguments_are_defined.rb