52 lines
2.4 KiB
Python
52 lines
2.4 KiB
Python
"""Pydantic models for application configuration."""
|
|
from pydantic import BaseModel
|
|
from typing import Optional, Dict, Literal
|
|
|
|
# These models were previously in config/manager.py, moved here for better organization.
|
|
|
|
class APICallerConfig(BaseModel):
|
|
default_timeout: int = 30
|
|
default_headers: Optional[Dict[str, str]] = None
|
|
# Add other API caller specific configs: e.g., retry_attempts, backoff_factor
|
|
|
|
class JSONSchemaValidatorConfig(BaseModel):
|
|
default_draft_version: Optional[str] = None # e.g., "draft7", "draft2020-12"
|
|
# Add other schema validator specific configs
|
|
|
|
class RuleStorageConfig(BaseModel):
|
|
type: Literal["filesystem", "database", "in_memory"] = "filesystem"
|
|
path: Optional[str] = "./rules" # For filesystem adapter: path to rules directory
|
|
connection_string: Optional[str] = None # For database adapter
|
|
# Add other storage specific configs, e.g., for filesystem: file_pattern = "*.json"
|
|
|
|
class RuleRepositoryConfig(BaseModel):
|
|
storage: RuleStorageConfig = RuleStorageConfig()
|
|
default_version_strategy: Literal["latest_enabled", "latest_stable", "exact"] = "latest_enabled"
|
|
preload_rules: bool = False
|
|
# Add other rule repository specific configs
|
|
|
|
class LoggingConfig(BaseModel):
|
|
level: Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] = "INFO"
|
|
format: str = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
|
# file_path: Optional[str] = None # Optional: if logging to a file
|
|
|
|
class TestExecutorConfig(BaseModel):
|
|
# Add configurations specific to the Test Executor
|
|
# For example, default behavior for failing a test step, etc.
|
|
stop_on_first_failure: bool = False
|
|
|
|
class ReportGeneratorConfig(BaseModel):
|
|
# Add configurations specific to the Report Generator
|
|
output_format: Literal["json", "html", "xml"] = "json"
|
|
output_path: str = "./reports"
|
|
|
|
class AppConfig(BaseModel):
|
|
app_name: str = "DDMS Compliance Suite"
|
|
logging: LoggingConfig = LoggingConfig()
|
|
api_caller: APICallerConfig = APICallerConfig()
|
|
json_schema_validator: JSONSchemaValidatorConfig = JSONSchemaValidatorConfig()
|
|
rule_repository: RuleRepositoryConfig = RuleRepositoryConfig()
|
|
test_executor: TestExecutorConfig = TestExecutorConfig()
|
|
report_generator: ReportGeneratorConfig = ReportGeneratorConfig()
|
|
# input_parser: ... # Config for input parser if needed
|
|
# assertion_engine: ... # Config for assertion engine if needed |