docs(models): add docstrings for configuration and lock models

- Add detailed docstrings to configuration models, explaining attributes
- Improve clarity and maintainability of the codebase by documenting intent
- Ensure future developers understand the purpose of each model and field
This commit is contained in:
2025-07-23 13:38:59 +02:00
parent 45da0aba81
commit f34c5e7bcb
2 changed files with 27 additions and 0 deletions

View File

@@ -3,14 +3,31 @@ from pydantic import BaseModel, Field, HttpUrl
class UpstreamConfig(BaseModel):
"""Configuration for the upstream repository.
Attributes:
url (HttpUrl): Git URL of the upstream repository.
branch (str): Upstream branch to track (default: 'main').
"""
url: HttpUrl = Field(..., description="Git URL of the upstream repository")
branch: str = Field(default="main", description="Upstream branch to track (default: 'main')")
class PatchesConfig(BaseModel):
"""Configuration for the patch directory.
Attributes:
directory (str): Path to the patch directory.
"""
directory: str = Field(default="./patches", description="Path to patch directory")
class PatchmanConfig(BaseModel):
"""Main configuration for the Patchman application.
Attributes:
upstream (UpstreamConfig): Configuration for the upstream repository.
patches (PatchesConfig): Configuration for the patch directory.
"""
upstream: UpstreamConfig
patches: PatchesConfig

View File

@@ -3,9 +3,19 @@ from typing import Literal
class UpstreamLock(BaseModel):
"""Represents the lock state of the upstream repository.
Attributes:
last_commit (str): Commit hash of the last processed upstream repository.
"""
last_commit: str = Field(..., min_length=40, max_length=40, pattern="^[0-9a-f]{40}$",
description="Commit hash of the last processed upstream repository")
class PatchmanLock(BaseModel):
"""Represents the lock state of the Patchman application.
Attributes:
upstream (UpstreamLock): Lock state of the upstream repository.
"""
upstream: UpstreamLock