Skip to content

Commit 92a23d4

Browse files
committed
fix: Catch error when computing relative filepath for serialization
1 parent c52dd22 commit 92a23d4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/griffe/_internal/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,6 @@ def as_dict(self, *, full: bool = False, **kwargs: Any) -> dict[str, Any]:
12881288
{
12891289
"path": self.path,
12901290
"filepath": self.filepath,
1291-
"relative_filepath": self.relative_filepath,
12921291
"relative_package_filepath": self.relative_package_filepath,
12931292
"is_public": self.is_public,
12941293
"is_deprecated": self.is_deprecated,
@@ -1316,6 +1315,9 @@ def as_dict(self, *, full: bool = False, **kwargs: Any) -> dict[str, Any]:
13161315
},
13171316
)
13181317

1318+
with suppress(ValueError):
1319+
base["relative_filepath"] = self.relative_filepath
1320+
13191321
if "source_link" not in base and (source_link := self.source_link) is not None:
13201322
base["source_link"] = source_link
13211323

0 commit comments

Comments
 (0)