Sha256: 46cad58009272d17975ce8899df44310cbc4871a35b5c7e58bd90d09db82b77f

Contents?: true

Size: 823 Bytes

Versions: 11

Compression:

Stored size: 823 Bytes

Contents

# frozen_string_literal: true

module Karafka
  module Web
    module Tracking
      module Consumers
        module Contracts
          # Expected data for each subscription group
          # It's mostly about topics details
          class SubscriptionGroup < Web::Contracts::Base
            configure

            required(:id) { |val| val.is_a?(String) && !val.empty? }
            required(:topics) { |val| val.is_a?(Hash) }
            required(:state) { |val| val.is_a?(Hash) }

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

              topic_contract = Topic.new

              data.fetch(:topics).each_value do |details|
                topic_contract.validate!(details)
              end

              nil
            end
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
karafka-web-0.7.10 lib/karafka/web/tracking/consumers/contracts/subscription_group.rb
karafka-web-0.7.9 lib/karafka/web/tracking/consumers/contracts/subscription_group.rb
karafka-web-0.7.8 lib/karafka/web/tracking/consumers/contracts/subscription_group.rb
karafka-web-0.7.7 lib/karafka/web/tracking/consumers/contracts/subscription_group.rb
karafka-web-0.7.6 lib/karafka/web/tracking/consumers/contracts/subscription_group.rb
karafka-web-0.7.5 lib/karafka/web/tracking/consumers/contracts/subscription_group.rb
karafka-web-0.7.4 lib/karafka/web/tracking/consumers/contracts/subscription_group.rb
karafka-web-0.7.3 lib/karafka/web/tracking/consumers/contracts/subscription_group.rb
karafka-web-0.7.2 lib/karafka/web/tracking/consumers/contracts/subscription_group.rb
karafka-web-0.7.1 lib/karafka/web/tracking/consumers/contracts/subscription_group.rb
karafka-web-0.7.0 lib/karafka/web/tracking/consumers/contracts/subscription_group.rb