Serde: extend deserializer to accept anything

This commit is contained in:
Johannes Kirschbauer
2024-08-15 15:03:52 +02:00
parent ce560e05cd
commit 4940767fcc
3 changed files with 37 additions and 12 deletions

View File

@@ -116,10 +116,10 @@ class WebExecutor(GObject.Object):
# Introspect the function and create the expected dataclass from dict dynamically
# Depending on the introspected argument_type
arg_class = self.jschema_api.get_method_argtype(method_name, k)
if dataclasses.is_dataclass(arg_class):
reconciled_arguments[k] = from_dict(arg_class, v)
else:
reconciled_arguments[k] = v
# TODO: rename from_dict into something like construct_checked_value
# from_dict really takes Anything and returns an instance of the type/class
reconciled_arguments[k] = from_dict(arg_class, v)
GLib.idle_add(fn_instance._async_run, reconciled_arguments)