diff --git a/src/griffe/dataclasses.py b/src/griffe/dataclasses.py index 6ecc568a..afc7ec5b 100644 --- a/src/griffe/dataclasses.py +++ b/src/griffe/dataclasses.py @@ -1300,7 +1300,12 @@ def as_dict(self, **kwargs: Any) -> dict[str, Any]: A dictionary. """ base = super().as_dict(**kwargs) - base["filepath"] = str(self._filepath) if self._filepath else None + if isinstance(self._filepath, list): + base["filepath"] = [str(path) for path in self._filepath] + elif self._filepath: + base["filepath"] = str(self._filepath) + else: + base["filepath"] = None return base