Sha256: 7dec005c25ff702bc0af890dd593b08efc7220f2d2a967c43d7454edf1209878
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
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(:redis).maybe do schema do required(:url).filled(:str?) end end optional(:inline_processing).filled(:bool?) # If inline_processing is true, redis should be filled rule(redis_presence: %i[redis inline_processing]) do |redis, inline_processing| inline_processing.false?.then(redis.filled?) end optional(:connection_pool).schema do required(:size).filled optional(:timeout).filled(:int?) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
karafka-0.6.0.rc1 | lib/karafka/schemas/config.rb |