chore(release): harden nick contract for v0.1.2

This commit is contained in:
2026-08-15 23:46:57 +09:00
parent e6a90800ec
commit c292df0a4b
8 changed files with 97 additions and 22 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ if env_file.exists():
class Settings(BaseSettings):
app_name: str = "PortfolioHub"
app_version: str = "0.1.1"
app_version: str = "0.1.2"
environment: str = "development"
allowed_origins_raw: str = Field(default="http://localhost:3000", validation_alias="PORTFOLIOHUB_ALLOWED_ORIGINS")
bootstrap_username: str = Field(default="", validation_alias="PORTFOLIOHUB_BOOTSTRAP_USERNAME")
+21 -1
View File
@@ -6,7 +6,7 @@ from datetime import date, datetime
from decimal import Decimal
from typing import Any, Literal
from pydantic import BaseModel, ConfigDict, Field, model_validator
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
# ---------------------------------------------------------------------------
@@ -322,6 +322,16 @@ class StrategyCreateRequest(BaseModel):
config: dict[str, Any] = Field(default_factory=dict)
status: StrategyStatus = "active"
@field_validator("nick")
@classmethod
def normalize_nick(cls, value: str | None) -> str | None:
if value is None:
return None
normalized = value.strip()
if not normalized:
raise ValueError("nick must not be blank")
return normalized
class StrategyUpdateRequest(BaseModel):
model_config = ConfigDict(extra="forbid")
@@ -331,6 +341,16 @@ class StrategyUpdateRequest(BaseModel):
config: dict[str, Any] | None = None
status: StrategyStatus | None = None
@field_validator("nick")
@classmethod
def normalize_nick(cls, value: str | None) -> str | None:
if value is None:
return None
normalized = value.strip()
if not normalized:
raise ValueError("nick must not be blank")
return normalized
@model_validator(mode="after")
def require_change(self) -> "StrategyUpdateRequest":
if not self.model_fields_set: