concepts.trr379.de/patches/linkml_runtime_utils_yamlutils.diff
Michael Hanke ff4e51151d
Some checks failed
Codespell / Check for spelling errors (push) Successful in 17s
Model checks / lint (push) Failing after 1m11s
Validate examples and verify unmodified conversion / lint (push) Failing after 58s
Sync patch-set from datalad concepts
2025-09-02 14:05:34 +02:00

28 lines
1.3 KiB
Diff

This patch has been proposed for inclusion in linkml-runtime
in https://github.com/linkml/linkml-runtime/pull/392
fix type instantiation in _normalize_inlined
This commit fixes a problem that was discovered while
converting between TTL and JSON using the schema
https://concepts.inm7.de/s/simpleinput/unreleased.yaml
The original code used a dictionary as argument to
the constructor of a pydantic-class, when it should
have used the **-operator to cnvert the dictionary
into keyword arguments.
diff --git a/linkml_runtime/utils/yamlutils.py b/linkml_runtime/utils/yamlutils.py
index 8ca8b30..d309091 100644
--- a/linkml_runtime/utils/yamlutils.py
+++ b/linkml_runtime/utils/yamlutils.py
@@ -175,7 +175,7 @@
for lek, lev in items(list_entry):
if lek == key_name and not isinstance(lev, (list, dict, JsonObj)):
# key_name:value
- order_up(list_entry[lek], slot_type(list_entry))
+ order_up(list_entry[lek], slot_type(**list_entry))
break # Not strictly necessary, but
elif not isinstance(lev, (list, dict, JsonObj)):
# key: value --> slot_type(key, value)