BaseDocTypeProtocol
Protocol defining the minimal interface for all DocTypes.
This is the core contract that all document types must satisfy.
MX packages can provide their own implementations with additional fields.
Required fields:
id: Unique identifier (UUID)
name: Human-readable identifier (optional)
creation: Creation timestamp
modified: Last modification timestamp
Example - Standard implementation:
class Todo(BaseDocType): # BaseDocType implements BaseDocTypeProtocol
title: str
is_completed: bool = False
Example - MX custom implementation:
class MongoDocType(BaseModel): # Custom base for MongoDB MX
id: UUID
name: str | None
creation: datetime
modified: datetime
_id: ObjectId # MongoDB-specific field
class Task(MongoDocType): # Satisfies BaseDocTypeProtocol
title: str
done: bool = False
Source: base_doctype.py