Sha256: 1853ccbf3965488dc7d44d8e5bf9b8e3510fc291e087d54275642592838d5e13

Contents?: true

Size: 850 Bytes

Versions: 5

Compression:

Stored size: 850 Bytes

Contents

# frozen_string_literal: true

module Karafka
  # Namespace for all the validation schemas that we use to check input
  module Schemas
    # Regexp for validating format of groups and topics
    TOPIC_REGEXP = /\A(\w|\-|\.)+\z/

    # Schema with validation rules for Karafka configuration details
    # @note There are many more configuration options inside of the
    #   Karafka::Setup::Config model, but we don't validate them here as they are
    #   validated per each route (topic + consumer_group) because they can be overwritten,
    #   so we validate all of that once all the routes are defined and ready
    Config = Dry::Validation.Schema do
      required(:client_id).filled(:str?, format?: Karafka::Schemas::TOPIC_REGEXP)
      required(:consumer_mapper)
      required(:topic_mapper)
      optional(:backend).filled
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
karafka-1.1.2 lib/karafka/schemas/config.rb
karafka-1.1.1 lib/karafka/schemas/config.rb
karafka-1.1.0 lib/karafka/schemas/config.rb
karafka-1.1.0.alpha2 lib/karafka/schemas/config.rb
karafka-1.1.0.alpha1 lib/karafka/schemas/config.rb