Skip to content

Commit 7881981

Browse files
committed
Adds support for relative paths for custom files
1 parent c83b5eb commit 7881981

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

RATapi/models.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,13 @@ class CustomFile(RATModel):
304304
filename: str = ""
305305
function_name: str = ""
306306
language: Languages = Languages.Python
307-
path: pathlib.Path = pathlib.Path(".")
307+
path: pathlib.Path = pathlib.Path(".").resolve()
308+
309+
@field_validator("path")
310+
@classmethod
311+
def resolve_relative_paths(cls, path: pathlib.Path) -> pathlib.Path:
312+
"""Return the absolute path of the given path."""
313+
return path.resolve()
308314

309315
def model_post_init(self, __context: Any) -> None:
310316
"""Autogenerate the function name from the filename if not set.

0 commit comments

Comments
 (0)