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.
5 6 7 |
# File 'lib/graphql/query/input_validation_result.rb', line 5 def problems @problems end |
Instance Method Details
#add_problem(explanation, path = nil) ⇒ Object
11 12 13 14 |
# File 'lib/graphql/query/input_validation_result.rb', line 11 def add_problem(explanation, path = nil) @problems ||= [] @problems.push({ "path" => path || [], "explanation" => explanation }) end |
#merge_result!(path, inner_result) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/graphql/query/input_validation_result.rb', line 16 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
7 8 9 |
# File 'lib/graphql/query/input_validation_result.rb', line 7 def valid? @problems.nil? end |