Module: I18nContextGenerator::Config::Validation

Included in:
I18nContextGenerator::Config
Defined in:
lib/i18n_context_generator/config/validation.rb

Overview

Validates the fully resolved configuration before extraction starts.

Constant Summary collapse

BOOLEAN_OPTIONS =
%i[
  no_cache dry_run write_back write_back_to_code include_file_paths
  include_translation_comments redact_prompts output_stdout print_config
].freeze
OPTIONAL_STRING_OPTIONS =
%i[
  model endpoint output_path diff_base diff_head start_key end_key platform
].freeze
TRANSLATION_DIFF_EXTENSIONS =
%w[.strings .xcstrings .xml].freeze

Instance Method Summary collapse

Instance Method Details

#validate!Object

Raises:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/i18n_context_generator/config/validation.rb', line 19

def validate!
  errors = []
  validate_collections(errors)
  validate_scalars(errors)
  validate_domains(errors)
  validate_provider_endpoint(errors)
  validate_configured_paths(errors)
  validate_output(errors)
  validate_cache(errors)
  validate_diff_support(errors)
  validate_write_back(errors)

  raise Error, "Invalid configuration: #{errors.join('; ')}" if errors.any?

  self
end