Docling Core is a Python library for defining, validating, and structuring data types and schemas. It's designed to align with the Docling specification, offering robust data validation capabilities. Currently at version 2.73.0, it undergoes frequent updates, often with daily or weekly releases in its 2.x series.
pip install docling-coreVerified import paths — ran on the pinned version, not inferred.
This example defines a `User` data type with `Field` validators for name, age, and email. It demonstrates how to instantiate a `DataType` with valid data and handles validation errors for invalid input.
Migrate all `Type` usages to `DataType`. E.g., `from docling_core import DataType`.
Update exception handling: `except ValidationErrors as e:` instead of `except ValidationError as e:`.
Change `class MyData(DataType, description="...")` to `class MyData(DataType, _description="...")`.
Review `format` usage. Ensure it's one of the supported strings or a callable. Custom format validation might need a separate callable validator.
To allow extra fields, define the DataType with `class MyData(DataType, allow_extra_fields=True):`.
No dependency data recorded yet.