MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / validate_record

Function validate_record

examples/skills/data-collector/patterns.py:66–73  ·  view source on GitHub ↗
(rec: dict, schema: dict[str, type])

Source from the content-addressed store, hash-verified

64
65# --- 3. explicit schema validation: never write a malformed record to the store
66def validate_record(rec: dict, schema: dict[str, type]) -> list[str]:
67 errs = []
68 for field, typ in schema.items():
69 if field not in rec:
70 errs.append(f"missing '{field}'")
71 elif not isinstance(rec[field], typ):
72 errs.append(f"'{field}' is {type(rec[field]).__name__}, want {typ.__name__}")
73 return errs # empty list == valid
74
75
76# --- 4. dedup / entity key

Callers 1

patterns.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected