Sha256: ece3a6a2e8c2ea6dd042163477f8e525bff11431f4e530603f0bc86c4e065f63

Contents?: true

Size: 586 Bytes

Versions: 9

Compression:

Stored size: 586 Bytes

Contents

class GraphQL::StaticValidation::RequiredArgumentsArePresent < GraphQL::StaticValidation::ArgumentsValidator
  def validate_node(node, defn, context)
    present_argument_names = node.arguments.map(&:name)
    required_argument_names = defn.arguments.values
      .select { |a| a.type.kind.non_null? }
      .map(&:name)

    missing_names = required_argument_names - present_argument_names
    if missing_names.any?
      context.errors << message("#{node.class.name.split("::").last} '#{node.name}' is missing required arguments: #{missing_names.join(", ")}", node)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
graphql-0.7.1 lib/graphql/static_validation/rules/required_arguments_are_present.rb
graphql-0.7.0 lib/graphql/static_validation/rules/required_arguments_are_present.rb
graphql-0.6.2 lib/graphql/static_validation/rules/required_arguments_are_present.rb
graphql-0.6.1 lib/graphql/static_validation/rules/required_arguments_are_present.rb
graphql-0.6.0 lib/graphql/static_validation/rules/required_arguments_are_present.rb
graphql-0.5.0 lib/graph_ql/static_validation/rules/required_arguments_are_present.rb
graphql-0.4.0 lib/graph_ql/static_validation/rules/required_arguments_are_present.rb
graphql-0.3.0 lib/graph_ql/static_validation/rules/required_arguments_are_present.rb
graphql-0.2.0 lib/graph_ql/static_validation/required_arguments_are_present.rb