diff --git a/docling_core/types/doc/document.py b/docling_core/types/doc/document.py index 45d8611b..b678deb8 100644 --- a/docling_core/types/doc/document.py +++ b/docling_core/types/doc/document.py @@ -5529,17 +5529,18 @@ def check_version_is_compatible(cls, v: str) -> str: else: return CURRENT_VERSION - @model_validator(mode="after") # type: ignore - @classmethod - def validate_document(cls, d: "DoclingDocument"): + @model_validator(mode="after") + def validate_document(self) -> Self: """validate_document.""" with warnings.catch_warnings(): # ignore warning from deprecated furniture warnings.filterwarnings("ignore", category=DeprecationWarning) - if not d.validate_tree(d.body) or not d.validate_tree(d.furniture): + if not self.validate_tree(self.body) or not self.validate_tree( + self.furniture + ): raise ValueError("Document hierachy is inconsistent.") - return d + return self @model_validator(mode="after") def validate_misplaced_list_items(self):