Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docling_core/types/doc/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading