Treat @context as a set rather than array#29
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #29 +/- ##
==========================================
+ Coverage 95.05% 95.08% +0.02%
==========================================
Files 15 15
Lines 1051 1057 +6
==========================================
+ Hits 999 1005 +6
Misses 52 52 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors how extra JSON-LD context is handled throughout the codebase, standardizing it from a list of dicts to a single merged dict. This change simplifies the interface, improves consistency, and ensures that extra context entries are merged rather than appended. The update affects the core model, CLI parsing, and associated tests, with backward compatibility for older data formats.
Core model and serialization changes:
extra_contextattribute inTransparentResearchObjectis now a dict instead of a list of dicts, and the base context (_JSONLD_CONTEXT) is also a dict. Extra context entries are merged into the base context when serializing to JSON-LD, and extracted appropriately during deserialization, with backward compatibility for list-based contexts. [1] [2] [3] [4]CLI and facade changes:
--extra-contextnow produces a single dict (not a list of dicts), and theTROfacade merges extra context entries into the model instead of appending. [1] [2] [3]Test updates:
tests/test_extra_context.pyandtests/test_cli.pyare updated to expect and check for dict-based context structures, ensuring correct behavior and compatibility with the new format. [1] [2] [3] [4]