As a customer
I need to update the details of an item in my wishlist
So that I can ensure the product information is accurate
Details and Assumptions
Create a REST API endpoint to update an item in a specific wishlist.
Each wishlist contains a list of items, with each item having attributes such as product name, description and price
The client will provide the wishlist ID and the item ID in the URL path, and the updated item details in the request body.
When a PUT request is sent to /wishlists/{wishlist_id}/items/{item_id}, the update should be reflected in both view and database
If the wishlist or item ID does not exist, the system should return a 404 Not Found error.
If there is a conflict with existing data, (e.g., updating the item name to one that already exists in the wishlist), the system should return a 409 Conflict error.
The request body must include the item's name, description, and price.
The system should validate the input data to ensure all required fields are present and correctly formatted (e.g., price must be a positive number).
Acceptance Criteria
Scenario: Successfully update an existing item
Given a customer has an item in their wishlist
When they send a PUT request to "/wishlists/{wishlist_id}/items/{item_id}" with updated item details
Then the microservice should update the item and return the updated details with a 200 OK status
Scenario: Update an item in a non-existent wishlist
Given a customer wants to update an item in a wishlist
When they send a PUT request to "/wishlists/999/items/1" with valid updated item data
Then the system should return a 404 Not Found error with an appropriate error message
Scenario: Update a non-existent item in a wishlist
Given a customer wants to update a non-existent item in their wishlist
When they send a PUT request to "/wishlists/1/items/999" with valid updated item data
Then the system should return a 404 Not Found error with an appropriate error message
Scenario: Update an item with a name that already exists in the wishlist
Given a customer has an item named "Laptop" in their wishlist
And another item named "Headphones" in the same wishlist
When they send a PUT request to "/wishlists/1/items/2" with the name "Laptop"
Then the system should return a 409 Conflict error with an appropriate error message
Scenario: Update an item with invalid or incomplete data
Given a customer wants to update an item in their wishlist
When they send a PUT request to "/wishlists/1/items/1" with invalid or incomplete item data
Then the system should return a 400 Bad Request error with details about the validation errors
As a customer I need to update the details of an item in my wishlist So that I can ensure the product information is accurate
Details and Assumptions
404 Not Found
error.409 Conflict
error.The system should validate the input data to ensure all required fields are present and correctly formatted (e.g., price must be a positive number).
Acceptance Criteria
Scenario: Update an item in a non-existent wishlist Given a customer wants to update an item in a wishlist When they send a PUT request to "/wishlists/999/items/1" with valid updated item data Then the system should return a 404 Not Found error with an appropriate error message
Scenario: Update a non-existent item in a wishlist Given a customer wants to update a non-existent item in their wishlist When they send a PUT request to "/wishlists/1/items/999" with valid updated item data Then the system should return a 404 Not Found error with an appropriate error message
Scenario: Update an item with a name that already exists in the wishlist Given a customer has an item named "Laptop" in their wishlist And another item named "Headphones" in the same wishlist When they send a PUT request to "/wishlists/1/items/2" with the name "Laptop" Then the system should return a 409 Conflict error with an appropriate error message
Scenario: Update an item with invalid or incomplete data Given a customer wants to update an item in their wishlist When they send a PUT request to "/wishlists/1/items/1" with invalid or incomplete item data Then the system should return a 400 Bad Request error with details about the validation errors