tmt icon indicating copy to clipboard operation
tmt copied to clipboard

Add schema enforcement for user-modifiable data using Pydantic

Open AthreyVinay opened this issue 4 months ago • 2 comments

Some parts of the code loads user-modifiable JSON or config files directly using json.loads() without any schema validation. This can lead to runtime errors if files are empty, malformed, or missing required fields.

Suggestion: we might be better off to use some sort of data validation library (Im suggesting pydantic).

AthreyVinay avatar Nov 12 '25 10:11 AthreyVinay

It would be nice to collect the individual cases, maybe as subissues. IIRC the initial culprit was the reboot request file, there surely may be more offenders.

happz avatar Nov 12 '25 10:11 happz

It would be nice to collect the individual cases, maybe as subissues.

Agree - there are a handful (5) of them currently.

IIRC the initial culprit was the reboot request file

Yep, I had included the link in the description.

AthreyVinay avatar Nov 12 '25 11:11 AthreyVinay