Skip to content

Properly serialize trp's extra_attributes#26

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

Properly serialize trp's extra_attributes#26
Xarthisius merged 1 commit into
mainfrom
extra_attrs

Conversation

@Xarthisius
Copy link
Copy Markdown
Contributor

This pull request adds support for storing and serializing extra custom attributes on TrustedResearchPerformance objects. These extra attributes can now be passed when adding a performance, are included in the JSON-LD output, and are preserved through save/load cycles. The changes also include a new test to verify this functionality.

Support for extra attributes on performances:

  • Added an extra_attributes field to the TrustedResearchPerformance model to store arbitrary custom key-value pairs.
  • Updated the to_jsonld method to include any extra_attributes in the serialized output.
  • Modified the deserialization logic to extract unknown (custom) keys from the JSON-LD data and store them in extra_attributes. [1] [2]
  • Updated the add_performance method in the TRO model to set extra_attributes directly on the performance object.

Testing:

  • Added a test (test_add_performance_extra_attrs) to ensure that extra attributes passed to add_performance are correctly included and persisted.

@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.78%. Comparing base (b24d0c2) to head (6b7bd10).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #26      +/-   ##
==========================================
+ Coverage   94.66%   94.78%   +0.12%     
==========================================
  Files          15       15              
  Lines        1030     1035       +5     
==========================================
+ Hits          975      981       +6     
+ Misses         55       54       -1     

☔ 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 62a93c0 into main Mar 28, 2026
8 checks passed
@Xarthisius Xarthisius deleted the extra_attrs branch March 28, 2026 13:28
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