Skip to content
Merged
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
8 changes: 6 additions & 2 deletions infisical_sdk/api_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dataclasses import dataclass, field
from dataclasses import dataclass, field, fields
from typing import Optional, List, Any, Dict
from enum import Enum
import json
Expand Down Expand Up @@ -34,7 +34,10 @@ def to_dict(self) -> Dict:
@classmethod
def from_dict(cls, data: Dict) -> 'BaseModel':
"""Create model from dictionary"""
return cls(**data)
# Get only the fields that exist in the dataclass
valid_fields = {f.name for f in fields(cls)}
filtered_data = {k: v for k, v in data.items() if k in valid_fields}
return cls(**filtered_data)

def to_json(self) -> str:
"""Convert model to JSON string"""
Expand Down Expand Up @@ -70,6 +73,7 @@ class BaseSecret(BaseModel):
secretComment: str
createdAt: str
updatedAt: str
secretMetadata: Optional[Dict[str, Any]] = None
secretReminderNote: Optional[str] = None
secretReminderRepeatDays: Optional[int] = None
skipMultilineEncoding: Optional[bool] = False
Expand Down
Loading