Coverage for backend/django/diagnostics/schemas.py: 100%
18 statements
« prev ^ index » next coverage.py v7.10.7, created at 2026-06-23 21:51 +0000
« prev ^ index » next coverage.py v7.10.7, created at 2026-06-23 21:51 +0000
1"""
2Shared Pydantic schemas for the diagnostics module.
4These models define the JSON finding shapes we return to the frontend.
5Keeping them here avoids drifting "finding" definitions across:
6- rules engine output (RuleFinding)
7"""
9from __future__ import annotations
11from typing import Literal
13from pydantic import BaseModel, JsonValue
14from diagnostics.models.DiagnosticsResult import Severity
18class DiagnosticsFinding(BaseModel):
19 """
20 A single diagnostics finding in the shape the UI expects.
22 Notes:
23 - This is intentionally permissive: different finding sources attach different
25 """
27 id: str | None = None
28 severity: Severity = "info"
29 title: str
30 description: str
31 ruleReference: str | None = None
33 componentName: str | None = None
34 componentId: int | None = None
35 propertyKey: str | None = None
36 propertyId: int | None = None
38 suggestedFix: str | None = None
39 suggestedValue: float | None = None
40 fixAction: JsonValue | None = None
42 ignored: bool | None = None