diff --git a/kiota_abstractions/serialization/untyped_boolean.py b/kiota_abstractions/serialization/untyped_boolean.py index 06ddfd8..1179d3c 100644 --- a/kiota_abstractions/serialization/untyped_boolean.py +++ b/kiota_abstractions/serialization/untyped_boolean.py @@ -12,8 +12,10 @@ def __init__(self, value: bool) -> None: Args: value (bool): The boolean value associated with the node. """ + if not isinstance(value, bool): + raise TypeError("Value of UntypedBoolean must be of type bool") self.__value = value - + def get_value(self) -> bool: """ Gets the value associated with untyped boolean node. diff --git a/kiota_abstractions/serialization/untyped_dict.py b/kiota_abstractions/serialization/untyped_dict.py index 4070663..567e352 100644 --- a/kiota_abstractions/serialization/untyped_dict.py +++ b/kiota_abstractions/serialization/untyped_dict.py @@ -5,16 +5,22 @@ class UntypedDictionary(UntypedNode): Represents an untyped node with dictionary value. """ - def __init__(self, value: dict) -> None: + def __init__(self, value: dict[str:UntypedNode]) -> None: """ Creates a new instance of UntypedDictionary. Args: value (dict): The key-value pair associated with the node. """ + if not isinstance(value, dict): + if not all(isinstance(key, str) for key in value.keys()): + raise TypeError("Keys of UntypedDictionary must be of type str") + if not all(isinstance(value, UntypedNode) for value in value.values()): + raise TypeError("Values of UntypedDictionary must be of type UntypedNode") + raise TypeError("Value of UntypedDictionary must be of type dict") self.__value = value - def get_value(self) -> dict: + def get_value(self) -> dict[str:UntypedNode]: """ Gets the value associated with untyped dictionary node. diff --git a/kiota_abstractions/serialization/untyped_float.py b/kiota_abstractions/serialization/untyped_float.py index 1ba259a..2329df6 100644 --- a/kiota_abstractions/serialization/untyped_float.py +++ b/kiota_abstractions/serialization/untyped_float.py @@ -12,6 +12,8 @@ def __init__(self, value: float) -> None: Args: value (bool): The float value associated with the node. """ + if not isinstance(value, float): + raise TypeError("Value of UntypedFloat must be of type float") self.__value = value def get_value(self) -> float: diff --git a/kiota_abstractions/serialization/untyped_integer.py b/kiota_abstractions/serialization/untyped_integer.py index bc67b8c..11a72f6 100644 --- a/kiota_abstractions/serialization/untyped_integer.py +++ b/kiota_abstractions/serialization/untyped_integer.py @@ -12,6 +12,8 @@ def __init__(self, value: int) -> None: Args: value (bool): The integer value associated with the node. """ + if not isinstance(value, int): + raise TypeError("Value of UntypedInteger must be of type int") self.__value = value def get_value(self) -> int: diff --git a/kiota_abstractions/serialization/untyped_list.py b/kiota_abstractions/serialization/untyped_list.py index c356c66..c55f350 100644 --- a/kiota_abstractions/serialization/untyped_list.py +++ b/kiota_abstractions/serialization/untyped_list.py @@ -12,6 +12,10 @@ def __init__(self, value: list[UntypedNode]) -> None: Args: value (bool): The list value associated with the node. """ + if not isinstance(value, list): + if not all(isinstance(value, UntypedNode) for value in value): + raise TypeError("Values of UntypedList must be of type UntypedNode") + raise TypeError("Value of UntypedList must be of type list") self.__value = value def get_value(self) -> list[UntypedNode]: diff --git a/kiota_abstractions/serialization/untyped_string.py b/kiota_abstractions/serialization/untyped_string.py index a2b5b98..011cb6e 100644 --- a/kiota_abstractions/serialization/untyped_string.py +++ b/kiota_abstractions/serialization/untyped_string.py @@ -12,6 +12,8 @@ def __init__(self, value: str) -> None: Args: value (bool): The string value associated with the node. """ + if not isinstance(value, str): + raise TypeError("Value of UntypedStr must be of type str") self.__value = value def get_value(self) -> str: