Module: GraphQL::Schema::Member::HasValidators Private

Includes:
FindInheritedValue::EmptyObjects
Included in:
Argument, Field, InputObject, Resolver
Defined in:
lib/graphql/schema/member/has_validators.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Constant Summary

Constants included from FindInheritedValue::EmptyObjects

FindInheritedValue::EmptyObjects::EMPTY_ARRAY, FindInheritedValue::EmptyObjects::EMPTY_HASH

Instance Method Summary collapse

Instance Method Details

#validates(validation_config) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Build Validators based on the given configuration and use them for this schema member

Parameters:

  • validation_config (Hash{Symbol => Hash})

12
13
14
15
16
17
# File 'lib/graphql/schema/member/has_validators.rb', line 12

def validates(validation_config)
  new_validators = GraphQL::Schema::Validator.from_config(self, validation_config)
  @own_validators ||= []
  @own_validators.concat(new_validators)
  nil
end

#validatorsArray<GraphQL::Schema::Validator>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:


20
21
22
23
24
25
26
27
# File 'lib/graphql/schema/member/has_validators.rb', line 20

def validators
  own_validators = @own_validators || EMPTY_ARRAY
  if self.is_a?(Class) && superclass.respond_to?(:validators) && (inherited_validators = superclass.validators).any?
    inherited_validators + own_validators
  else
    own_validators
  end
end