Class: GraphQL::Schema::FieldValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/schema/field_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(field, errors) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/graphql/schema/field_validator.rb', line 2

def validate(field, errors)
  implementation = GraphQL::Schema::ImplementationValidator.new(field, as: "Field", errors: errors)
  implementation.must_respond_to(:name)
  implementation.must_respond_to(:type)
  implementation.must_respond_to(:description)
  implementation.must_respond_to(:arguments) do |arguments|
    validator = GraphQL::Schema::EachItemValidator.new(errors)
    validator.validate(arguments.keys, as: "#{field.name}.arguments keys", must_be: "Strings") { |k| k.is_a?(String) }
  end
  implementation.must_respond_to(:deprecation_reason)
end