@@ -230,38 +230,89 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[
230230 # Import from okta.models to ensure class identity consistency with lazy imports
231231 models = import_module ("okta.models" )
232232 if object_type == "AuthenticatorKeyCustomApp" :
233+ # Check if the discriminator maps to the same class to avoid infinite recursion
234+ if object_type == cls .__name__ :
235+ return cls .model_validate (obj )
233236 return models .AuthenticatorKeyCustomApp .from_dict (obj )
234237 if object_type == "AuthenticatorKeyDuo" :
238+ # Check if the discriminator maps to the same class to avoid infinite recursion
239+ if object_type == cls .__name__ :
240+ return cls .model_validate (obj )
235241 return models .AuthenticatorKeyDuo .from_dict (obj )
236242 if object_type == "AuthenticatorKeyExternalIdp" :
243+ # Check if the discriminator maps to the same class to avoid infinite recursion
244+ if object_type == cls .__name__ :
245+ return cls .model_validate (obj )
237246 return models .AuthenticatorKeyExternalIdp .from_dict (obj )
238247 if object_type == "AuthenticatorKeyGoogleOtp" :
248+ # Check if the discriminator maps to the same class to avoid infinite recursion
249+ if object_type == cls .__name__ :
250+ return cls .model_validate (obj )
239251 return models .AuthenticatorKeyGoogleOtp .from_dict (obj )
240252 if object_type == "AuthenticatorKeyEmail" :
253+ # Check if the discriminator maps to the same class to avoid infinite recursion
254+ if object_type == cls .__name__ :
255+ return cls .model_validate (obj )
241256 return models .AuthenticatorKeyEmail .from_dict (obj )
242257 if object_type == "AuthenticatorKeyPassword" :
258+ # Check if the discriminator maps to the same class to avoid infinite recursion
259+ if object_type == cls .__name__ :
260+ return cls .model_validate (obj )
243261 return models .AuthenticatorKeyPassword .from_dict (obj )
244262 if object_type == "AuthenticatorKeyOktaVerify" :
263+ # Check if the discriminator maps to the same class to avoid infinite recursion
264+ if object_type == cls .__name__ :
265+ return cls .model_validate (obj )
245266 return models .AuthenticatorKeyOktaVerify .from_dict (obj )
246267 if object_type == "AuthenticatorKeyOnprem" :
268+ # Check if the discriminator maps to the same class to avoid infinite recursion
269+ if object_type == cls .__name__ :
270+ return cls .model_validate (obj )
247271 return models .AuthenticatorKeyOnprem .from_dict (obj )
248272 if object_type == "AuthenticatorKeyPhone" :
273+ # Check if the discriminator maps to the same class to avoid infinite recursion
274+ if object_type == cls .__name__ :
275+ return cls .model_validate (obj )
249276 return models .AuthenticatorKeyPhone .from_dict (obj )
250277 if object_type == "AuthenticatorKeySecurityKey" :
278+ # Check if the discriminator maps to the same class to avoid infinite recursion
279+ if object_type == cls .__name__ :
280+ return cls .model_validate (obj )
251281 return models .AuthenticatorKeySecurityKey .from_dict (obj )
252282 if object_type == "AuthenticatorKeySecurityQuestion" :
283+ # Check if the discriminator maps to the same class to avoid infinite recursion
284+ if object_type == cls .__name__ :
285+ return cls .model_validate (obj )
253286 return models .AuthenticatorKeySecurityQuestion .from_dict (obj )
254287 if object_type == "AuthenticatorKeySmartCard" :
288+ # Check if the discriminator maps to the same class to avoid infinite recursion
289+ if object_type == cls .__name__ :
290+ return cls .model_validate (obj )
255291 return models .AuthenticatorKeySmartCard .from_dict (obj )
256292 if object_type == "AuthenticatorKeySymantecVip" :
293+ # Check if the discriminator maps to the same class to avoid infinite recursion
294+ if object_type == cls .__name__ :
295+ return cls .model_validate (obj )
257296 return models .AuthenticatorKeySymantecVip .from_dict (obj )
258297 if object_type == "AuthenticatorKeyTac" :
298+ # Check if the discriminator maps to the same class to avoid infinite recursion
299+ if object_type == cls .__name__ :
300+ return cls .model_validate (obj )
259301 return models .AuthenticatorKeyTac .from_dict (obj )
260302 if object_type == "AuthenticatorKeyWebauthn" :
303+ # Check if the discriminator maps to the same class to avoid infinite recursion
304+ if object_type == cls .__name__ :
305+ return cls .model_validate (obj )
261306 return models .AuthenticatorKeyWebauthn .from_dict (obj )
262307 if object_type == "AuthenticatorKeyYubikey" :
308+ # Check if the discriminator maps to the same class to avoid infinite recursion
309+ if object_type == cls .__name__ :
310+ return cls .model_validate (obj )
263311 return models .AuthenticatorKeyYubikey .from_dict (obj )
264312 if object_type == "AuthenticatorSimple" :
313+ # Check if the discriminator maps to the same class to avoid infinite recursion
314+ if object_type == cls .__name__ :
315+ return cls .model_validate (obj )
265316 return models .AuthenticatorSimple .from_dict (obj )
266317
267318 raise ValueError (
0 commit comments