44
55from __future__ import annotations
66
7- from pydantic import BaseModel , Field
7+ from pydantic import BaseModel , Field , ConfigDict
88from typing import Annotated , List , Literal , Optional
99
1010
1111class Item (BaseModel ):
1212 """
1313 Represents a 1Password item.
1414 """
15+ model_config = ConfigDict (populate_by_name = True )
1516
1617 id : str
1718 """
@@ -25,7 +26,7 @@ class Item(BaseModel):
2526 """
2627 The item's category
2728 """
28- vault_id : Annotated [str , Field (serialization_alias = "vaultId" )]
29+ vault_id : Annotated [str , Field (alias = "vaultId" )]
2930 """
3031 The ID of the vault where the item is saved
3132 """
@@ -72,11 +73,13 @@ class Item(BaseModel):
7273
7374
7475class ItemCreateParams (BaseModel ):
76+ model_config = ConfigDict (populate_by_name = True )
77+
7578 category : ItemCategory
7679 """
7780 The item's category
7881 """
79- vault_id : Annotated [str , Field (serialization_alias = "vaultId" )]
82+ vault_id : Annotated [str , Field (alias = "vaultId" )]
8083 """
8184 The ID of the vault where the item is saved
8285 """
@@ -95,6 +98,7 @@ class ItemCreateParams(BaseModel):
9598
9699
97100class ItemField (BaseModel ):
101+ model_config = ConfigDict (populate_by_name = True )
98102 """
99103 Represents a field within an item.
100104 """
@@ -107,11 +111,11 @@ class ItemField(BaseModel):
107111 """
108112 The field's title
109113 """
110- section_id : Annotated [Optional [str ], Field (serialization_alias = "sectionId" )]
114+ section_id : Annotated [Optional [str ], Field (alias = "sectionId" )]
111115 """
112116 The ID of the section containing the field. Built-in fields such as usernames and passwords don't require a section.
113117 """
114- field_type : Annotated [ItemFieldType , Field (serialization_alias = "fieldType" )]
118+ field_type : Annotated [ItemFieldType , Field (alias = "fieldType" )]
115119 """
116120 The field's type
117121 """
@@ -141,6 +145,7 @@ class ItemFieldDetailsOtp(BaseModel):
141145
142146
143147class ItemOverview (BaseModel ):
148+ model_config = ConfigDict (populate_by_name = True )
144149 """
145150 Represents a decrypted 1Password item.
146151 """
@@ -157,7 +162,7 @@ class ItemOverview(BaseModel):
157162 """
158163 The item's category
159164 """
160- vault_id : Annotated [str , Field (serialization_alias = "vaultId" )]
165+ vault_id : Annotated [str , Field (alias = "vaultId" )]
161166 """
162167 The ID of the vault where the item is saved
163168 """
@@ -179,6 +184,7 @@ class ItemSection(BaseModel):
179184
180185
181186class OtpFieldDetails (BaseModel ):
187+ model_config = ConfigDict (populate_by_name = True )
182188 """
183189 Additional attributes for OTP fields.
184190 """
@@ -187,7 +193,7 @@ class OtpFieldDetails(BaseModel):
187193 """
188194 The OTP code, if successfully computed
189195 """
190- error_message : Annotated [Optional [str ], Field (serialization_alias = "errorMessage" )]
196+ error_message : Annotated [Optional [str ], Field (alias = "errorMessage" )]
191197 """
192198 The error message, if the OTP code could not be computed
193199 """
0 commit comments