Skip to content

Allow to add entries to context#27

Merged
Xarthisius merged 1 commit into
mainfrom
extra_context
Mar 28, 2026
Merged

Allow to add entries to context#27
Xarthisius merged 1 commit into
mainfrom
extra_context

Conversation

@Xarthisius
Copy link
Copy Markdown
Contributor

This pull request adds support for specifying extra JSON-LD vocabulary mappings (prefixes) via the --extra-context CLI option and corresponding programmatic APIs. It introduces new tests to ensure correct handling, serialization, round-tripping, and CLI integration of these extra context entries. The changes ensure that extra context mappings are always appended to the base context, are preserved across save/load operations, and are accessible both via the CLI and the Python interface.

CLI and API support for extra context:

  • Added a new --extra-context (-c) CLI option to allow users to specify additional JSON-LD prefix-to-URI mappings (e.g., ex=http://example.org/), with validation to ensure correct format. This is integrated into the main CLI and relevant subcommands, and is also available via the TRO Python API. [1] [2] [3] [4] [5] [6] [7] [8]

Model and serialization changes:

  • Extended the TransparentResearchObject model to include an extra_context field, ensuring that extra context entries are appended to the base @context during JSON-LD serialization, and are properly extracted when loading from JSON-LD. [1] [2] [3] [4]

Testing improvements:

  • Added comprehensive tests for both the CLI and Python APIs to verify correct parsing, serialization, round-tripping, and help text for the new extra context functionality. Tests also ensure that the base context is always present and that multiple extra contexts are handled correctly. [1] [2]

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.86%. Comparing base (62a93c0) to head (302a66c).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #27      +/-   ##
==========================================
+ Coverage   94.78%   94.86%   +0.07%     
==========================================
  Files          15       15              
  Lines        1035     1051      +16     
==========================================
+ Hits          981      997      +16     
  Misses         54       54              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Xarthisius Xarthisius merged commit 567c995 into main Mar 28, 2026
8 checks passed
@Xarthisius Xarthisius deleted the extra_context branch March 28, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant