(
self,
value: Any,
values: dict[str, Any] = {}, # noqa: B006
*,
loc: tuple[int | str, ...] = (),
)
| 171 | return self.field_info.get_default(call_default_factory=True) |
| 172 | |
| 173 | def validate( |
| 174 | self, |
| 175 | value: Any, |
| 176 | values: dict[str, Any] = {}, # noqa: B006 |
| 177 | *, |
| 178 | loc: tuple[int | str, ...] = (), |
| 179 | ) -> tuple[Any, list[dict[str, Any]]]: |
| 180 | try: |
| 181 | return ( |
| 182 | self._type_adapter.validate_python(value, from_attributes=True), |
| 183 | [], |
| 184 | ) |
| 185 | except ValidationError as exc: |
| 186 | return None, _regenerate_error_with_loc( |
| 187 | errors=exc.errors(include_url=False), loc_prefix=loc |
| 188 | ) |
| 189 | |
| 190 | def serialize( |
| 191 | self, |
no test coverage detected