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