Class: GraphqlConnector::ServiceClassable::ParamsValidator
- Inherits:
-
Object
- Object
- GraphqlConnector::ServiceClassable::ParamsValidator
- Defined in:
- lib/graphql_connector/service_classable/params_validator.rb
Overview
Checks whether params for a specifc graphql query are in an expected format
Class Method Summary collapse
Class Method Details
.validate(query_params) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/graphql_connector/service_classable/params_validator.rb', line 10 def validate(query_params) params = [query_params].flatten return if params.empty? || params.map(&:class).uniq == [Symbol] || params.map(&:class).uniq == [String] raise InvalidParamsError, "Please ensure that #{query_params} are either "\ 'Symbols/Strings as described in the README '\ '(e.g.: params: [:id, :name])' end |