Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions src/meshcore_api/api/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from datetime import datetime
from typing import List, Literal, Optional, Union

from pydantic import BaseModel, Field, ValidationInfo, field_validator
from pydantic import BaseModel, ConfigDict, Field, ValidationInfo, field_validator

# ============================================================================
# Common/Shared Schemas
Expand Down Expand Up @@ -41,8 +41,7 @@ class NodeResponse(BaseModel):
created_at: datetime
tags: dict = Field(default_factory=dict, description="Node tags as key-value pairs")

class Config:
from_attributes = True
model_config = ConfigDict(from_attributes=True)


class NodeListResponse(BaseModel):
Expand Down Expand Up @@ -75,8 +74,7 @@ class MessageResponse(BaseModel):
sender_timestamp: Optional[datetime] = None
received_at: datetime

class Config:
from_attributes = True
model_config = ConfigDict(from_attributes=True)


class MessageListResponse(BaseModel):
Expand Down Expand Up @@ -126,8 +124,7 @@ class AdvertisementResponse(BaseModel):
flags: Optional[int] = None
received_at: datetime

class Config:
from_attributes = True
model_config = ConfigDict(from_attributes=True)


class AdvertisementListResponse(BaseModel):
Expand Down Expand Up @@ -170,8 +167,7 @@ class TracePathResponse(BaseModel):
hop_count: Optional[int] = None
completed_at: datetime

class Config:
from_attributes = True
model_config = ConfigDict(from_attributes=True)


class TracePathListResponse(BaseModel):
Expand Down Expand Up @@ -203,8 +199,7 @@ class TelemetryResponse(BaseModel):
parsed_data: Optional[str] = None
received_at: datetime

class Config:
from_attributes = True
model_config = ConfigDict(from_attributes=True)


class TelemetryListResponse(BaseModel):
Expand Down Expand Up @@ -241,8 +236,7 @@ class SignalStrengthResponse(BaseModel):
trace_path_id: Optional[int] = None
recorded_at: datetime

class Config:
from_attributes = True
model_config = ConfigDict(from_attributes=True)


class SignalStrengthListResponse(BaseModel):
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/test_signal_strength.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,7 @@ def test_query_by_trace_path_id(self, db_engine):

with db_engine.session_scope() as session:
records = (
session.query(SignalStrength)
.filter(SignalStrength.trace_path_id == 100)
.all()
session.query(SignalStrength).filter(SignalStrength.trace_path_id == 100).all()
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This formatting change is unrelated to the PR's purpose of fixing Pydantic deprecation warnings. Additionally, it's inconsistent with the multi-line formatting used for similar queries elsewhere in this file (lines 150-154 and 185-189). Consider reverting this change to maintain consistency with the existing code style, or apply the formatting change consistently across all similar query patterns in the file.

Suggested change
session.query(SignalStrength).filter(SignalStrength.trace_path_id == 100).all()
session.query(SignalStrength)
.filter(SignalStrength.trace_path_id == 100)
.all()

Copilot uses AI. Check for mistakes.
)
assert len(records) == 2

Expand Down
Loading