Sha256: 13fcf53b6419255313ba2bbbd2322b50fc8115b70f84c889b092a364a794b14b

Contents?: true

Size: 514 Bytes

Versions: 3

Compression:

Stored size: 514 Bytes

Contents

class GraphQL::Query
  class InputValidationResult
    attr_accessor :problems

    def valid?
      @problems.nil?
    end

    def add_problem(explanation, path = nil)
      @problems ||= []
      @problems.push({ 'path' => path || [], 'explanation' => explanation })
    end

    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
graphql-0.12.1 lib/graphql/query/input_validation_result.rb
graphql-0.12.0 lib/graphql/query/input_validation_result.rb
graphql-0.11.1 lib/graphql/query/input_validation_result.rb