-
-
Notifications
You must be signed in to change notification settings - Fork 902
Expand file tree
/
Copy pathvalidate.py
More file actions
15 lines (11 loc) · 624 Bytes
/
validate.py
File metadata and controls
15 lines (11 loc) · 624 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# This file was generated with the assistance of an AI coding tool.
from __future__ import annotations
from typing import Any
import ifcopenshell
import ifcopenshell.validate
def validate(model: ifcopenshell.file, express_rules: bool = False) -> dict[str, Any]:
"""Validate the model and return a dict with 'valid' bool and 'issues' list."""
logger = ifcopenshell.validate.json_logger()
ifcopenshell.validate.validate(model, logger, express_rules=express_rules)
issues = [{"level": s["level"], "message": s["message"]} for s in logger.statements]
return {"valid": len(issues) == 0, "issues": issues}