File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,11 +143,28 @@ def use_dummy_values(cls, v):
143143 return v
144144
145145 for alternate_id in v :
146- alternate_id ["thing_id" ] = - 1 # dummy value
147- return v
148-
146+ normalized : list = []
147+ for alternate_id in v :
148+ # If we already have a Pydantic model instance, set the attribute if possible.
149+ if isinstance (alternate_id , BaseModel ):
150+ if hasattr (alternate_id , "thing_id" ):
151+ setattr (alternate_id , "thing_id" , - 1 )
152+ normalized .append (alternate_id )
153+ else :
154+ data = alternate_id .model_dump ()
155+ data ["thing_id" ] = - 1
156+ normalized .append (data )
157+ # If it's a plain dict, add the dummy thing_id key.
158+ elif isinstance (alternate_id , dict ):
159+ data = dict (alternate_id )
160+ data ["thing_id" ] = - 1
161+ normalized .append (data )
162+ else :
163+ # For any unexpected type, leave as-is and let normal validation
164+ # handle potential errors.
165+ normalized .append (alternate_id )
149166
150- class CreateWell ( CreateBaseThing , ValidateWell ):
167+ return normalized
151168 """
152169 Schema for creating a well.
153170 """
You can’t perform that action at this time.
0 commit comments