Class: Appom::Configuration::ConfigSchema

Inherits:
Object
  • Object
show all
Defined in:
lib/appom/configuration.rb

Overview

Configuration validation schema

Constant Summary collapse

REQUIRED_KEYS =
%w[appom appium].freeze
APPOM_SCHEMA =
{
  'max_wait_time' => { type: Numeric, min: 1, max: 300 },
  'log_level' => { type: String, values: %w[debug info warn error fatal] },
  'screenshot.directory' => { type: String },
  'screenshot.format' => { type: String, values: %w[png jpg jpeg] },
  'screenshot.auto_timestamp' => { type: [TrueClass, FalseClass] },
  'cache.enabled' => { type: [TrueClass, FalseClass] },
  'cache.max_size' => { type: Integer, min: 1, max: 1000 },
  'cache.ttl' => { type: Numeric, min: 1, max: 3600 },
}.freeze

Instance Method Summary collapse

Instance Method Details

#validate(config_data) ⇒ Object



316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/appom/configuration.rb', line 316

def validate(config_data)
  errors = []

  # Check required top-level keys
  REQUIRED_KEYS.each do |key|
    errors << "Missing required configuration section: #{key}" unless config_data.key?(key)
  end

  # Validate appom configuration
  errors.concat(validate_appom_config(config_data['appom'])) if config_data['appom']

  errors
end