add weights to items of a collection and delete activityWeights in ac… - #113
Conversation
🦋 Changeset detectedLatest commit: c3f9ca2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughReplaces collection item arrays of strongRefs with item objects that include Changes
Sequence Diagram(s)(omitted — changes are schema/refactor-only and do not introduce multi-component control flow) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 1 warning)
✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lexicons/org/hypercerts/claim/collection.json (1)
50-80: Add item object documentation to SCHEMAS.mdSCHEMAS.md documents the collection's
itemsfield but lacks the nesteditemobject structure. Add a section documenting theitemobject properties (itemIdentifieras required strongRef,itemWeightas optional string) to clarify the new array structure. ERD.puml could also be enhanced to show the itemWeight field for completeness.The changeset file properly documents the breaking change.
🤖 Fix all issues with AI agents
In @.changeset/refactor-collection-items-array.md:
- Around line 5-16: Update the changeset to also document the breaking change
that removes activityWeights from the activity claim: state that the
`org.hypercerts.claim.activity` schema no longer includes the `activityWeights`
field (remove references to it), and add migration guidance instructing
consumers to migrate existing `activityWeights` data (e.g., convert it to the
new per-item `itemWeight` in collections or drop/transform values as
appropriate), referencing the new `org.hypercerts.claim.collection#item`
structure and `itemIdentifier`/`itemWeight` keys so integrators know how to map
old activityWeights to the new format.
🧹 Nitpick comments (1)
lexicons/org/hypercerts/claim/collection.json (1)
75-78: Consider validatingitemWeightas a positive numeric string.Right now any string is accepted. If you want schema-level validation, add a regex pattern (and optionally
minLength) to prevent empty/negative values.♻️ Example schema tightening
"itemWeight": { "type": "string", + "minLength": 1, + "pattern": "^(?:0|[1-9]\\d*)(?:\\.\\d+)?$", "description": "Optional weight for this item (positive numeric value stored as string). Weights do not need to sum to a specific total; normalization can be performed by the consuming application as needed." }
c34eecf to
214d71a
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lexicons/org/hypercerts/claim/collection.json (1)
1-81: Update README.md and ERD.puml documentation to reflect the new item object structure with weights.The README.md examples (lines 194–280) show outdated code where
itemsis an array of direct references withuriandcidfields. The actual schema now requiresitemsto be an array ofitemobjects, each with:
itemIdentifier(strongRef to activity or collection)itemWeight(optional string for weighting items)Additionally,
itemWeightis not documented anywhere in README.md, and ERD.puml does not reflect theitemobject wrapper around these fields. Update both files to match the current schema definition in collection.json.
🧹 Nitpick comments (1)
lexicons/org/hypercerts/claim/collection.json (1)
66-79: Consider adding a pattern constraint foritemWeightvalidation.The description states
itemWeightshould be a "positive numeric value stored as string", but there's nopatternconstraint to enforce this. Without validation, invalid values like"abc"or"-5"could be stored.♻️ Suggested pattern constraint
"itemWeight": { "type": "string", - "description": "Optional weight for this item (positive numeric value stored as string). Weights do not need to sum to a specific total; normalization can be performed by the consuming application as needed." + "description": "Optional weight for this item (positive numeric value stored as string). Weights do not need to sum to a specific total; normalization can be performed by the consuming application as needed.", + "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]+)?$" }If validation is intentionally left to consuming applications, this can be ignored.
214d71a to
c3f9ca2
Compare
…tivity claim
Summary by CodeRabbit
Breaking Changes
New Features
✏️ Tip: You can customize this high-level summary in your review settings.