feat(vault): Phase 3 tools + batch citation/relation enrichment
This commit is contained in:
@@ -65,15 +65,22 @@ def validate_one(fp: Path) -> list[str]:
|
||||
errors.append("Missing 'wiki' in tags")
|
||||
|
||||
# type must exist and be valid
|
||||
# Convention: type can be scalar (e.g. 'concept') or list (e.g. ['entity', 'People', 'Author'])
|
||||
# When list, the FIRST element is the canonical type; subsequent are role/subtype annotations
|
||||
ptype = front.get("type")
|
||||
if not ptype:
|
||||
errors.append("Missing type")
|
||||
elif isinstance(ptype, str) and ptype not in VALID_TYPES:
|
||||
errors.append(f"Invalid type: '{ptype}' (valid: {', '.join(VALID_TYPES)})")
|
||||
elif isinstance(ptype, str):
|
||||
if ptype not in VALID_TYPES:
|
||||
errors.append(f"Invalid type: '{ptype}' (valid: {', '.join(VALID_TYPES)})")
|
||||
elif isinstance(ptype, list):
|
||||
for t in ptype:
|
||||
if t not in VALID_TYPES:
|
||||
errors.append(f"Invalid type in list: '{t}'")
|
||||
if not ptype:
|
||||
errors.append("type list is empty")
|
||||
else:
|
||||
primary = ptype[0]
|
||||
if primary not in VALID_TYPES:
|
||||
errors.append(f"Invalid primary type: '{primary}' (valid: {', '.join(VALID_TYPES)})")
|
||||
# Role/subtype annotations (2nd+ elements) are not validated against VALID_TYPES
|
||||
|
||||
# source must exist
|
||||
if not front.get("source"):
|
||||
|
||||
Reference in New Issue
Block a user