fix(rest/nodejs): bump @ucp-js/sdk to 0.4.5 so quantity bounds hold at the schema boundary - #199
Open
vishkaty wants to merge 1 commit into
Open
Conversation
…t the schema boundary The pinned 0.4.3 generates LineItemCreateRequestSchema and LineItemUpdateRequestSchema with quantity as a bare z.number(), so a create or update carrying quantity 0, a negative quantity, or a fractional quantity crossed validation and was priced, producing negative checkout totals for negative quantities (Universal-Commerce-Protocol#194). 0.4.5 restores the line_item.json contract, integer with minimum 1, at both request schemas. The new tests pin the boundary: 0, -1 and 1.5 draw 422 on create, -1 draws 422 on update, and a positive integer still prices normally. Fixes Universal-Commerce-Protocol#194. 0.4.5 also types date-time fields as strings, so the one Date valued assignment moves to toISOString, same wire bytes, sound types.
damaz91
approved these changes
Aug 21, 2026
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.
What
The pinned @ucp-js/sdk 0.4.3 generates LineItemCreateRequestSchema and LineItemUpdateRequestSchema with quantity as a bare z.number(), so a create or update carrying quantity 0, a negative quantity, or a fractional quantity crosses validation and is priced; a negative quantity produces negative checkout totals (#194).
Fix
Bump to 0.4.5, which restores the line_item.json contract, integer with minimum 1, at both request schemas (js-sdk#53). One code touch rides along: 0.4.5 types date-time fields as strings, so the single Date valued assignment, the shipped event occurred_at, moves to toISOString, same wire bytes, sound types.
Testing
Fixes #194.