Spaces:
Sleeping
Sleeping
| import json | |
| from typing import List, Dict, Any | |
| def load_documents(path: str) -> Dict[str, Any]: | |
| with open(path, "r", encoding="utf-8") as f: | |
| data = json.load(f) | |
| return data | |
| def validate_document(data: Dict[str, Any]) -> bool: | |
| required = ["doc_name", "structure"] | |
| for field in required: | |
| if field not in data: | |
| return False | |
| if not isinstance(data.get("structure"), list): | |
| return False | |
| return True | |