Sha256: 40c76214b9172211d4cb7294c507b80824bee7be10d571097aeed1f7a1fd2935

Contents?: true

Size: 562 Bytes

Versions: 43

Compression:

Stored size: 562 Bytes

Contents

module GraphQL
  class 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
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
graphql-1.2.6 lib/graphql/query/input_validation_result.rb
graphql-1.2.5 lib/graphql/query/input_validation_result.rb
graphql-1.2.4 lib/graphql/query/input_validation_result.rb
graphql-1.2.3 lib/graphql/query/input_validation_result.rb
graphql-1.2.2 lib/graphql/query/input_validation_result.rb
graphql-1.2.1 lib/graphql/query/input_validation_result.rb
graphql-1.2.0 lib/graphql/query/input_validation_result.rb
graphql-1.1.0 lib/graphql/query/input_validation_result.rb
graphql-1.0.0 lib/graphql/query/input_validation_result.rb
graphql-0.19.4 lib/graphql/query/input_validation_result.rb
graphql-0.19.3 lib/graphql/query/input_validation_result.rb
graphql-0.19.2 lib/graphql/query/input_validation_result.rb
graphql-0.19.1 lib/graphql/query/input_validation_result.rb
graphql-0.19.0 lib/graphql/query/input_validation_result.rb
graphql-0.18.15 lib/graphql/query/input_validation_result.rb
graphql-0.18.14 lib/graphql/query/input_validation_result.rb
graphql-0.18.13 lib/graphql/query/input_validation_result.rb
graphql-0.18.12 lib/graphql/query/input_validation_result.rb
graphql-0.18.11 lib/graphql/query/input_validation_result.rb
graphql-0.18.10 lib/graphql/query/input_validation_result.rb