Bug: Settings service doesn't validate JSON schema #21

Closed
opened 2026-03-10 03:48:21 +00:00 by Mark · 1 comment
Owner

Issue

Settings loaded from repositories are not validated against any schema, potentially causing runtime errors.

Location

  • services/api/app/services/settings.py
  • _parse_settings_file() method

Current Implementation

def _parse_settings_file(self, file_path: Path) -> dict[str, Any]:
    content = file_path.read_text(encoding="utf-8")
    if not content.strip():
        return {}
    suffix = file_path.suffix.lower()
    if suffix == ".json":
        return json.loads(content)
    # ... YAML parsing

Risk

  • Invalid settings cause runtime errors
  • Type mismatches not caught early
  • No error messages for malformed settings

Proposed Solution

  1. Define JSON Schema for settings
  2. Validate against schema on load
  3. Provide helpful error messages
  4. Log validation warnings

Acceptance Criteria

  • Create JSON Schema for settings
  • Add validation to load_from_repo()
  • Return detailed validation errors
  • Log warnings for invalid settings
  • Tests for schema validation
  • Documentation of settings format

Priority: Low
Type: Bug / Enhancement

## Issue Settings loaded from repositories are not validated against any schema, potentially causing runtime errors. ## Location - `services/api/app/services/settings.py` - `_parse_settings_file()` method ## Current Implementation ```python def _parse_settings_file(self, file_path: Path) -> dict[str, Any]: content = file_path.read_text(encoding="utf-8") if not content.strip(): return {} suffix = file_path.suffix.lower() if suffix == ".json": return json.loads(content) # ... YAML parsing ``` ## Risk - Invalid settings cause runtime errors - Type mismatches not caught early - No error messages for malformed settings ## Proposed Solution 1. Define JSON Schema for settings 2. Validate against schema on load 3. Provide helpful error messages 4. Log validation warnings ## Acceptance Criteria - [ ] Create JSON Schema for settings - [ ] Add validation to `load_from_repo()` - [ ] Return detailed validation errors - [ ] Log warnings for invalid settings - [ ] Tests for schema validation - [ ] Documentation of settings format **Priority:** Low **Type:** Bug / Enhancement
Author
Owner

Feature gap — adding jsonschema validation to settings loading. Needs schema definition + validation step.

Feature gap — adding jsonschema validation to settings loading. Needs schema definition + validation step.
Mark 2026-05-28 01:00:39 +00:00
Sign in to join this conversation.
No description provided.