Sha256: a39ffa3344f1f70b4bd725c0ebeae38d3f75b94c1dac4675d674ff2513e13a43

Contents?: true

Size: 753 Bytes

Versions: 4

Compression:

Stored size: 753 Bytes

Contents

# frozen_string_literal: true

module Karafka
  module Web
    module Tracking
      module Consumers
        module Contracts
          # Expected topic information that needs to go out
          class Topic < Tracking::Contracts::Base
            configure

            required(:name) { |val| val.is_a?(String) && !val.empty? }
            required(:partitions) { |val| val.is_a?(Hash) }

            virtual do |data, errors|
              next unless errors.empty?

              partition_contract = Partition.new

              data.fetch(:partitions).each do |_partition_id, details|
                partition_contract.validate!(details)
              end

              nil
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
karafka-web-0.6.3 lib/karafka/web/tracking/consumers/contracts/topic.rb
karafka-web-0.6.2 lib/karafka/web/tracking/consumers/contracts/topic.rb
karafka-web-0.6.1 lib/karafka/web/tracking/consumers/contracts/topic.rb
karafka-web-0.6.0 lib/karafka/web/tracking/consumers/contracts/topic.rb