Fix Pydantic V2 and FastAPI deprecation warnings
Some checks failed
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Some checks failed
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
- Replace orm_mode with from_attributes in Pydantic Config classes (federated_learning.py, wallet.py, decentralized_memory.py, atomic_swap.py) - Replace regex with pattern in FastAPI Query parameters (staking.py)
This commit is contained in:
@@ -604,7 +604,7 @@ async def get_supported_agents(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_staking_stats(
|
||||
request: Request,
|
||||
period: str = Query(default="daily", regex="^(hourly|daily|weekly|monthly)$"),
|
||||
period: str = Query(default="daily", pattern="^(hourly|daily|weekly|monthly)$"),
|
||||
session: Session = Depends(get_session),
|
||||
staking_service: StakingService = Depends(get_staking_service)
|
||||
) -> StakingStatsResponse:
|
||||
@@ -622,8 +622,8 @@ async def get_staking_stats(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_staking_leaderboard(
|
||||
request: Request,
|
||||
period: str = Query(default="weekly", regex="^(daily|weekly|monthly)$"),
|
||||
metric: str = Query(default="total_staked", regex="^(total_staked|total_rewards|apy)$"),
|
||||
period: str = Query(default="weekly", pattern="^(daily|weekly|monthly)$"),
|
||||
metric: str = Query(default="total_staked", pattern="^(total_staked|total_rewards|apy)$"),
|
||||
limit: int = Query(default=50, ge=1, le=100),
|
||||
session: Session = Depends(get_session),
|
||||
staking_service: StakingService = Depends(get_staking_service)
|
||||
@@ -674,7 +674,7 @@ async def get_my_staking_positions(
|
||||
@rate_limit(rate=200, per=60)
|
||||
async def get_my_staking_rewards(
|
||||
request: Request,
|
||||
period: str = Query(default="monthly", regex="^(daily|weekly|monthly)$"),
|
||||
period: str = Query(default="monthly", pattern="^(daily|weekly|monthly)$"),
|
||||
session: Session = Depends(get_session),
|
||||
staking_service: StakingService = Depends(get_staking_service),
|
||||
current_user: dict = Depends(get_current_user)
|
||||
|
||||
@@ -37,7 +37,7 @@ class SwapResponse(BaseModel):
|
||||
target_timelock: int
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class SwapActionRequest(BaseModel):
|
||||
|
||||
@@ -24,7 +24,7 @@ class MemoryNodeResponse(BaseModel):
|
||||
tags: list[str]
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class MemoryQueryRequest(BaseModel):
|
||||
|
||||
@@ -27,7 +27,7 @@ class FederatedSessionResponse(BaseModel):
|
||||
global_model_cid: str | None
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class JoinSessionRequest(BaseModel):
|
||||
|
||||
@@ -19,7 +19,7 @@ class WalletResponse(BaseModel):
|
||||
is_active: bool
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class TransactionRequest(BaseModel):
|
||||
@@ -38,4 +38,4 @@ class TransactionResponse(BaseModel):
|
||||
status: TransactionStatus
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
from_attributes = True
|
||||
|
||||
Reference in New Issue
Block a user