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

Includes:
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.

Defined Under Namespace

Modules: ClassConfigured

Constant Summary

Constants included from EmptyObjects

EmptyObjects::EMPTY_ARRAY, 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
# File 'lib/graphql/schema/member/has_validators.rb', line 20

def validators
  @own_validators || EMPTY_ARRAY
end