Page MenuHomePhabricator

🕷️ Remove item's description in a given language
Closed, ResolvedPublic5 Estimated Story Points

Description

As a tool developer I want to be able to remove old or incorrect description of an item in a given language.
DELETE /entities/items/{item_id}/descriptions/{lang_code}

Acceptance criteria:

  • On the successful removal, API should respond with 200 and "description deleted" as a response body.
    • 200 response should also contain Content-Language header with "en" as a value
  • Following error cases have to be considered:
HTTP response coderesponse payload
Invalid item ID400"code": "invalid-item-id"
"message": "Not a valid item ID: <ITEM_ID>"
Invalid language code400"code": "invalid-language-code"
"message": "Not a valid language code : <language code>"
Invalid edit tag400"code": "invalid-edit-tag"
"message": "Invalid MediaWiki tag: {tag}"
Comment too long400"code": "comment-too-long"
"message": "Comment must not be longer than <LIMIT> characters"
Item does not have description in given language404"code": "description-not-defined"
"message": "Item with the ID <ITEM ID> does not have a description in the language: <LANGUAGE CODE>"
Item does not exist404"code": "item-not-found"
"message": "Could not find an item with the ID: {item_id}"
Item redirect 409"code": "redirected-item"
"message": "Item {item_id} has been merged into {other_id}"

Notes:

  • "Automated edit summary" related to the edit to be of form: /* wbsetdescription-remove:1|{language_code} */ DESCRIPTION-TEXT
  • client can provide additional edit metadata: mediawiki tags, edit summary text to append to the automated summary, and a bot edit flag, like in DELETE /entities/items/{item_id}/statements/{statement_id}
  • Allow empty request body.
  • Handle HTTP conditional request headers as in DELETE /entities/item/{item_id}/statements/{statement_id}
  • Handle user authentication/authorization like in DELETE /entities/items/{item_id}/statements/{statement_id}

Task breakdown notes:

  • Add the new route to OAS.
  • happy path (with empty edit summary)
    • ETag and Last-Modified
  • Implement use case validation and deserialization
  • Add the "remove description" edit summary
  • Respond 404/409 if item not found/redirect or item does not have a description in requested language
  • Authorization
  • Use the usual middlewares and add the route handler to RouteHandlersTest
  • Add spec tests.
  • Mark as production ready.

Event Timeline

WMDE-leszek set the point value for this task to 5.Sep 28 2023, 10:12 AM
Ollie.Shotton_WMDE renamed this task from Remove item's description in a given language to 🕷️ Remove item's description in a given language.Nov 1 2023, 12:32 PM
Ollie.Shotton_WMDE removed Ollie.Shotton_WMDE as the assignee of this task.
Ollie.Shotton_WMDE subscribed.

@Ollie.Shotton_WMDE everything looks good but the comment and tag errors don't really fit here, right? Since we're not sending any information to be updated/added.

Deleting a description is still an edit that can have edit metadata. See the screenshots below of me providing a tag and comment that appears in the revision history.

image.png (318×1 px, 45 KB)

image.png (370×1 px, 79 KB)

Also, have a look at the other DELETE endpoints such as https://doc.wikimedia.org/Wikibase/master/js/rest-api/#operations-aliases-addItemAliasesInLanguage

Ah damn, thank you. Just checked and all good. Can go on to the next step