diff --git a/pydantic/types.py b/pydantic/types.py index ba13a2a..c448aa8 100644 --- a/pydantic/types.py +++ b/pydantic/types.py @@ -329,6 +329,7 @@ class FilePath(Path): yield path_exists_validator yield cls.validate + @classmethod def validate(cls, value: Path) -> Path: if not value.is_file(): raise errors.PathNotAFileError(path=value) @@ -343,6 +344,7 @@ class DirectoryPath(Path): yield path_exists_validator yield cls.validate + @classmethod def validate(cls, value: Path) -> Path: if not value.is_dir(): raise errors.PathNotADirectoryError(path=value)