feat: pydantic schemas for all service message types
- shared/schemas/trading.py: OrderRequest, OrderResult, PositionInfo, AccountInfo, TradeSignal, TradeExecution, MarketSnapshot, SentimentContext - shared/schemas/news.py: RawArticle, ScoredArticle - shared/schemas/learning.py: TradeOutcomeSchema, WeightAdjustment - shared/schemas/auth.py: RegisterRequest, LoginRequest, TokenResponse - 49 schema tests covering validation constraints, serialization round-trips, required fields, and range checks
This commit is contained in:
parent
72cb1b6fe5
commit
c8277e301e
11 changed files with 889 additions and 0 deletions
27
shared/schemas/auth.py
Normal file
27
shared/schemas/auth.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
"""Authentication Pydantic schemas for API request/response payloads."""
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class RegisterRequest(BaseModel):
|
||||
"""Sent by the dashboard to begin passkey registration."""
|
||||
|
||||
username: str = Field(min_length=1, max_length=100)
|
||||
display_name: str | None = None
|
||||
|
||||
|
||||
class LoginRequest(BaseModel):
|
||||
"""Sent by the dashboard to begin passkey authentication."""
|
||||
|
||||
username: str = Field(min_length=1, max_length=100)
|
||||
|
||||
|
||||
class TokenResponse(BaseModel):
|
||||
"""Returned after successful authentication."""
|
||||
|
||||
access_token: str
|
||||
refresh_token: str
|
||||
token_type: str = "bearer"
|
||||
expires_in: int = Field(
|
||||
description="Access token lifetime in seconds", default=900
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue