Class: Boechat::Core::Config::SchemaValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/boechat/core/config/schema_validator.rb

Overview

Class responsible for validate the schema of the boechat.yml configuration file

Constant Summary collapse

CONFIG_SCHEMA =
Dry::Validation.Schema do
  required('services').each do
    schema do
      required('name').filled(:str?)
      required('base_url').filled(:str?)
      optional('status_endpoint').filled(:str?)
      optional('http_verb').filled(included_in?: %w[get post])
    end
  end
end

Class Method Summary collapse

Class Method Details

.call(config) ⇒ Object



21
22
23
# File 'lib/boechat/core/config/schema_validator.rb', line 21

def self.call(config)
  CONFIG_SCHEMA.call(YAML.safe_load(config))
end