Page MenuHomePhabricator

🟦 Create a 400 HTTP response for invalid item IDs
Closed, ResolvedPublic

Description

BDD
WHEN I request GET /entities/items/{item_id} with a text which is not an item ID
THEN I get 400 HTTP response
AND it contains a invalid-item-id code and a message "Not a valid item ID: {item_id}"
AND a HTTP header Content-Language set to en

Task breakdown notes:

  • create a Validator on the "use case level" that will check the item ID from the request and return a ValidatioResult object
  • if the ValdationResult has violations, an error result (with isSuccessful() == false) will be returned from the GetItem use case
  • the RouteHandler will create an error response (set http status, code, message) based on the GetItemResult

Event Timeline

Change 771951 had a related patch set uploaded (by Silvan Heintze; author: Silvan Heintze):

[mediawiki/extensions/Wikibase@master] REST: Implement 400 response for invalid item IDs

https://gerrit.wikimedia.org/r/771951

Change 771951 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Implement 400 response for invalid item IDs

https://gerrit.wikimedia.org/r/771951

WMDE-leszek claimed this task.