| 56 | self._error_cache: Optional[List[&class="cm">#x27;ErrorDict']] = None |
| 57 | |
| 58 | def errors(self) -> List[&class="cm">#x27;ErrorDict']: |
| 59 | if self._error_cache is None: |
| 60 | try: |
| 61 | config = self.model.__config__ class="cm"># type: ignore |
| 62 | except AttributeError: |
| 63 | config = self.model.__pydantic_model__.__config__ class="cm"># type: ignore |
| 64 | self._error_cache = list(flatten_errors(self.raw_errors, config)) |
| 65 | return self._error_cache |
| 66 | |
| 67 | def json(self, *, indent: Union[None, int, str] = 2) -> str: |
| 68 | return json.dumps(self.errors(), indent=indent, default=pydantic_encoder) |