Skip to content

Commit

Permalink
Add pydantic DirectoryPath type for repository.
Browse files Browse the repository at this point in the history
  • Loading branch information
eli64s committed Mar 4, 2024
1 parent c9caf92 commit a0f5ca5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions readmeai/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pathlib import Path
from typing import Optional, Union

from pydantic import BaseModel, Field, HttpUrl, validator
from pydantic import BaseModel, DirectoryPath, Field, HttpUrl, validator

from readmeai.config.validators import GitValidator
from readmeai.core.logger import Logger
Expand Down Expand Up @@ -41,7 +41,10 @@ class FileSettings(BaseModel):
class GitSettings(BaseModel):
"""User repository settings, sanitized and validated by Pydantic."""

repository: str = Field(..., description="The repository URL.")
repository: Union[HttpUrl, DirectoryPath] = Field(
...,
description="The URL or directory path to the repository.",
)
full_name: Optional[str] = Field(
None, description="The full name of the repository."
)
Expand Down

0 comments on commit a0f5ca5

Please sign in to comment.