@@ -75,6 +75,9 @@ def composed_model_input_classes(cls):
7575 This function returns a list of the possible models that can be accepted as
7676 inputs.
7777 """
78+ # Handle list types (e.g., [str], [float])
79+ if isinstance(cls, list):
80+ return [cls]
7881 if issubclass(cls, ModelSimple) or cls in PRIMITIVE_TYPES:
7982 return [cls]
8083 elif issubclass(cls, ModelNormal):
@@ -1557,17 +1560,43 @@ def get_oneof_instance(cls, model_kwargs, constant_kwargs, model_arg=None):
15571560 # Empty data
15581561 oneof_instances.append(list_oneof_instance)
15591562 continue
1560- for arg in model_arg:
1561- if constant_kwargs.get("_spec_property_naming"):
1562- oneof_instance = oneof_class(
1563- **change_keys_js_to_python(arg, oneof_class), **constant_kwargs
1563+
1564+ # Check if inner type is primitive - treat same as lines 1590-1599
1565+ if oneof_class in PRIMITIVE_TYPES:
1566+ # Handle list of primitives (e.g., [str], [float])
1567+ for arg in model_arg:
1568+ oneof_instance = validate_and_convert_types(
1569+ arg,
1570+ (oneof_class,),
1571+ constant_kwargs.get("_path_to_item", ()),
1572+ constant_kwargs.get("_spec_property_naming", False),
1573+ constant_kwargs.get("_check_type", True),
1574+ configuration=constant_kwargs.get("_configuration"),
15641575 )
1565- else:
1566- oneof_instance = oneof_class(**arg, **constant_kwargs)
1567- if not oneof_instance._unparsed:
15681576 list_oneof_instance.append(oneof_instance)
1569- if list_oneof_instance:
1570- oneof_instances.append(list_oneof_instance)
1577+ if list_oneof_instance:
1578+ oneof_instances.append(list_oneof_instance)
1579+ elif inspect.isclass(oneof_class) and issubclass(oneof_class, ModelSimple):
1580+ # Handle list of ModelSimple
1581+ for arg in model_arg:
1582+ oneof_instance = oneof_class(arg, **constant_kwargs)
1583+ if not oneof_instance._unparsed:
1584+ list_oneof_instance.append(oneof_instance)
1585+ if list_oneof_instance:
1586+ oneof_instances.append(list_oneof_instance)
1587+ else:
1588+ # Handle list of complex objects (ModelNormal, ModelComposed)
1589+ for arg in model_arg:
1590+ if constant_kwargs.get("_spec_property_naming"):
1591+ oneof_instance = oneof_class(
1592+ **change_keys_js_to_python(arg, oneof_class), **constant_kwargs
1593+ )
1594+ else:
1595+ oneof_instance = oneof_class(**arg, **constant_kwargs)
1596+ if not oneof_instance._unparsed:
1597+ list_oneof_instance.append(oneof_instance)
1598+ if list_oneof_instance:
1599+ oneof_instances.append(list_oneof_instance)
15711600 elif issubclass(oneof_class, ModelSimple):
15721601 if model_arg is not None:
15731602 oneof_instance = oneof_class(model_arg, **constant_kwargs)
0 commit comments