| 2054 | |
| 2055 | @classmethod |
| 2056 | def model_validate( |
| 2057 | cls: type[Self], |
| 2058 | obj: dict[str, Any] | Any, |
| 2059 | *, |
| 2060 | strict: bool | None = None, |
| 2061 | from_attributes: bool | None = None, |
| 2062 | context: dict[str, Any] | None = None, |
| 2063 | ) -> Self: |
| 2064 | if isinstance(obj, dict): |
| 2065 | obj = cast(dict[str, Any], obj) |
| 2066 | extra_serializer_fields = { |
| 2067 | "_block_document_id", |
| 2068 | "_block_document_name", |
| 2069 | "_is_anonymous", |
| 2070 | }.intersection(obj.keys()) |
| 2071 | for field in extra_serializer_fields: |
| 2072 | obj.pop(field, None) |
| 2073 | |
| 2074 | return super().model_validate( |
| 2075 | obj, |
| 2076 | strict=strict, |
| 2077 | from_attributes=from_attributes, |
| 2078 | context=context, |
| 2079 | ) |
| 2080 | |
| 2081 | def model_dump( |
| 2082 | self, |