Class: GraphQL::Query::InputValidationResult
- Inherits:
-
Object
- Object
- GraphQL::Query::InputValidationResult
- Defined in:
- lib/graphql/query/input_validation_result.rb
Instance Attribute Summary collapse
-
#problems ⇒ Object
Returns the value of attribute problems.
Instance Method Summary collapse
- #add_problem(explanation, path = nil) ⇒ Object
- #merge_result!(path, inner_result) ⇒ Object
- #valid? ⇒ Boolean
Instance Attribute Details
#problems ⇒ Object
Returns the value of attribute problems.
3 4 5 |
# File 'lib/graphql/query/input_validation_result.rb', line 3 def problems @problems end |
Instance Method Details
#add_problem(explanation, path = nil) ⇒ Object
9 10 11 12 |
# File 'lib/graphql/query/input_validation_result.rb', line 9 def add_problem(explanation, path = nil) @problems ||= [] @problems.push({ 'path' => path || [], 'explanation' => explanation }) end |
#merge_result!(path, inner_result) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/graphql/query/input_validation_result.rb', line 14 def merge_result!(path, inner_result) return if inner_result.valid? inner_result.problems.each do |p| item_path = [path, *p['path']] add_problem(p['explanation'], item_path) end end |
#valid? ⇒ Boolean
5 6 7 |
# File 'lib/graphql/query/input_validation_result.rb', line 5 def valid? @problems.nil? end |