Class: GraphqlConnector::ServiceClassable::ReturnFieldsValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql_connector/service_classable/return_fields_validator.rb

Overview

Valdations for return fields set within the context of a service class

Class Method Summary collapse

Class Method Details

.validate(return_fields) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/graphql_connector/service_classable/return_fields_validator.rb', line 9

def validate(return_fields)
  unless return_fields.is_a?(Array)
    raise ReturnFieldsErrors, 'Please ensure that returns is followed '\
                              'by an array. E.g. returns: [:id]'
  end

  return_fields.each { |entry| recursive_validation(entry) }
end