Fix object instantiation in _normalize_inlined()#392
Fix object instantiation in _normalize_inlined()#392christian-monch wants to merge 3 commits intolinkml:mainfrom
_normalize_inlined()#392Conversation
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:
|
| # 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.
can you remove this line? not sure why it is in here
| 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.
Can you add a test that demonstrates the correctness of the fix?
|
@christian-monch I have moved the work on this PR into the repo branch https://github.com/linkml/linkml-runtime/tree/fix-normalize-inlined . If you would like to continue this work please re-open the PR on the mono-repo after the merge from that branch. We'll lift it over for you so it should take less effort. |
This commit fixes a problem that was discovered when using
linkml-convertto 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.