You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mutations_helpers.rb
    path of file: ./repos/kontena/server/app/helpers
    
    the code of the file until where you have to start completion: module MutationsHelpers
  # Validate an array field using a block
  #
  # array :foo do
  #   string
  # end
  #
  # validate_each :foo do |foo|
  #   if already
    
  def validate_each(key)
    return unless @inputs[key]

    errors = Mutations::ErrorArray.new
    @inputs[key].each do |item|
      kind, message = yield item

      errors << Mutations::ErrorAtom.new(key, kind, message: message) if kind
    end
    if errors.any?
      add_error(key, errors)
    end