fix(storefront): repair the review and cart-item chains - #30
Merged
Merged
Conversation
Create a review sent no subject.
ReviewController resolves it with Utils::resolveSubject(), whose parameter is a
non-nullable string, so the request threw a TypeError as a 500. It now reviews
{{product_id}}, which Create Product already captures. The API side is fixed
separately so a missing subject is a 422 rather than a crash.
Retrieve a Store review and Delete a Review addressed /reviews/{id}.
Single braces are not a Postman variable, so both requested the literal string
"%7Bid%7D" and answered "Review resource not found." Nothing captured a review
id at all, so Create a review now sets {{review_id}} and both use it.
Add Item to Cart addressed /carts/{id}/{product_id}.
Same single-brace problem in two places. Both are now the variables the run
already has — {{cart_id}} from Retrieve or Create Cart, {{product_id}} from
Create Product.
Its body also sent "scheduled_at": "scheduled_at_value_here" and
"store_location": "store_location_value_here". Those are placeholder text, not
values; the endpoint treats them as a date and a store location id and rejects
them. Both fields are optional, so they are dropped rather than faked — the
request documents the required shape without inventing a schedule.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Four Storefront requests, two chains.
Reviews
Create a reviewsent no subject.ReviewControllerresolves it withUtils::resolveSubject(), whose parameter is a non-nullablestring, so the request threw a TypeError as a 500 — before the controller's ownif (!$subject)guard could run. It now reviews{{product_id}}, whichCreate Productalready captures. (The API side is fixed separately so a missing subject is a 422 rather than a crash: fleetbase/storefront@b23c029.)Retrieve a Store reviewandDelete a Reviewaddressed/reviews/{id}. Single braces are not a Postman variable, so both requested the literal%7Bid%7Dand answered "Review resource not found." Nothing captured a review id anywhere in the collection, soCreate a reviewnow sets{{review_id}}and both use it.Cart
Add Item to Cartaddressed/carts/{id}/{product_id}— the same single-brace problem in two places. Both are now variables the run already has:{{cart_id}}fromRetrieve or Create Cart,{{product_id}}fromCreate Product. This is the head of the cart chain, soUpdate item in CartandRemove item from cartcurrently fail behind it with "Invalid cart item provided to cart!".Its body also sent
"scheduled_at": "scheduled_at_value_here"and"store_location": "store_location_value_here"— placeholder text, which the endpoint reads as a date and a store location id and rejects. Both fields are optional, so they are dropped rather than faked. The request still documents the required shape; inventing a schedule or a location id would make the example wrong for readers.🤖 Generated with Claude Code