Skip to content

Commit

Permalink
fix: Fix dumping filepath to a dict when it is a list
Browse files Browse the repository at this point in the history
  • Loading branch information
davfsa authored Sep 9, 2023
1 parent c1476d0 commit 066a4a7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/griffe/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 066a4a7

Please # to comment.