-
Notifications
You must be signed in to change notification settings - Fork 33
Fix object instantiation in _normalize_inlined()
#392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #392 +/- ##
=======================================
Coverage 63.79% 63.79%
=======================================
Files 63 63
Lines 8938 8938
Branches 2584 2584
=======================================
Hits 5702 5702
Misses 2629 2629
Partials 607 607 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -169,7 +169,7 @@ def form_1(entries: dict[Any, Optional[Union[dict, JsonObj]]]) -> None: | |||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you remove this line? not sure why it is in here
@@ -169,7 +169,7 @@ def form_1(entries: dict[Any, Optional[Union[dict, JsonObj]]]) -> None: | |||
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test that demonstrates the correctness of the fix?
This commit fixes a problem that was discovered when using
linkml-convert
to convert JSON to TTL using the schema: https://concepts.inm7.de/s/simpleinput/unreleased.yamlThe original code used a dictionary as the argument to the constructor of a Pydantic class, but should have used the
**
-operator to convert the dictionary into keyword arguments.