We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b538597 commit f18979fCopy full SHA for f18979f
1 file changed
backend/schemas.py
@@ -1,7 +1,8 @@
1
-from pydantic import BaseModel
+from pydantic import BaseModel, ConfigDict
2
from datetime import datetime
3
from typing import Optional
4
5
+
6
class LogBase(BaseModel):
7
source_ip: str
8
destination_ip: str
@@ -10,19 +11,23 @@ class LogBase(BaseModel):
10
11
event_type: str
12
details: Optional[str] = None
13
14
15
class LogCreate(LogBase):
16
pass
17
18
19
class LogResponse(LogBase):
20
id: int
21
timestamp: datetime
22
- class Config:
- orm_mode = True
23
+ # Pydantic v2: use model_config instead of inner class Config
24
+ model_config = ConfigDict(from_attributes=True)
25
26
27
class PredictionRequest(LogBase):
28
29
30
31
class PredictionResponse(BaseModel):
32
is_anomaly: bool
33
anomaly_score: float
0 commit comments