Sha256: dad1a7360a91ceb58289621f806b3ddbc0cea3d9f7a55797827b7cc507260e32

Contents?: true

Size: 1.07 KB

Versions: 43

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module Karafka
  module Routing
    module Features
      class Declaratives < Base
        # This feature validation contracts
        module Contracts
          # Basic validation of the Kafka expected config details
          class Topic < Karafka::Contracts::Base
            configure do |config|
              config.error_messages = YAML.safe_load(
                File.read(
                  File.join(Karafka.gem_root, 'config', 'locales', 'errors.yml')
                )
              ).fetch('en').fetch('validations').fetch('topic')
            end

            nested :declaratives do
              required(:active) { |val| [true, false].include?(val) }
              required(:partitions) { |val| val.is_a?(Integer) && val.positive? }
              required(:replication_factor) { |val| val.is_a?(Integer) && val.positive? }
              required(:details) do |val|
                val.is_a?(Hash) &&
                  val.keys.all? { |key| key.is_a?(Symbol) }
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
karafka-2.4.17 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.16 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.15 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.14 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.13 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.12 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.11 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.10 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.9 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.8 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.7 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.6 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.5 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.4 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.3 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.0 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.0.rc1 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.3.4 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.0.beta2 lib/karafka/routing/features/declaratives/contracts/topic.rb
karafka-2.4.0.beta1 lib/karafka/routing/features/declaratives/contracts/topic.rb