nirs4all.config.validator module
Configuration validation with JSON Schema for nirs4all.
Provides validation functions for pipeline and dataset configuration files, with detailed error messages including line numbers and suggestions.
- exception nirs4all.config.validator.ConfigValidationError(errors: List[str], config_path: str | None = None)[source]
Bases:
ExceptionException raised when configuration validation fails.
- errors
List of validation error messages.
- config_path
Path to the configuration file (if any).
- nirs4all.config.validator.get_validation_summary(is_valid: bool, errors: List[str], warnings: List[str], config_path: str | None = None) str[source]
Generate a human-readable validation summary.
- Parameters:
is_valid – Whether validation passed.
errors – List of error messages.
warnings – List of warning messages.
config_path – Optional path for context.
- Returns:
Formatted summary string.
- nirs4all.config.validator.validate_config_file(config_path: str, config_type: str | None = None, check_files: bool = True, check_class_paths: bool = False) Tuple[bool, List[str], List[str]][source]
Validate a configuration file, auto-detecting type if not specified.
- Parameters:
config_path – Path to the configuration file.
config_type – ‘pipeline’, ‘dataset’, or None for auto-detection.
check_files – For dataset configs, check if data files exist.
check_class_paths – For pipeline configs, verify class imports.
- Returns:
Tuple of (is_valid, errors, warnings).
- nirs4all.config.validator.validate_dataset_config(config_source: str | Dict[str, Any], check_files: bool = True) Tuple[bool, List[str], List[str]][source]
Validate a dataset configuration.
- Parameters:
config_source – Path to config file, or config dictionary.
check_files – If True, check that referenced data files exist.
- Returns:
Tuple of (is_valid, errors, warnings).
- nirs4all.config.validator.validate_pipeline_config(config_source: str | Dict[str, Any], check_class_paths: bool = False) Tuple[bool, List[str], List[str]][source]
Validate a pipeline configuration.
- Parameters:
config_source – Path to config file, or config dictionary.
check_class_paths – If True, verify that class paths are importable.
- Returns:
Tuple of (is_valid, errors, warnings).