Page MenuHomePhabricator

🏷️ Create rest route for retrieving an item's labels
Closed, ResolvedPublic

Description

Route: GET /entities/items/{item_id}/labels

Event Timeline

🏷️ Task breakdown notes:

  • add the GET /entities/items/{item_id}/labels route to our OpenAPI definition (@Silvan_WMDE creates task)
  • implement ItemLabelsRetriever using a TermLookup (TermLookupLabelsRetriever) (@Muhammad_Yasser_Jazirahly_WMDE creates task)
    • create a ItemLabelsRetriever interface with a getLabels( ItemId $itemId ): ?TermList; method
  • use case (GetItemLabels) happy path (@Jakob_WMDE creates task)
    • create and return success response using the data from the ItemLabelsRetriever, and revision metadata
  • create a LabelsSerializer (we don't need a dedicated presenter) (@Silvan_WMDE creates task)
    • extract from ItemDataSerializer
    • use in ItemDataSerializer once done
  • route handler (happy path only) (@Ollie.Shotton_WMDE creates task)
    • same middlewares as GetItemRouteHandler
    • calls json_encode on the serializer result
    • e2e tests
  • validate request and error if item id is invalid (just uses the existing ItemIdValidator but still create a dedicated use case validator) (@Muhammad_Yasser_Jazirahly_WMDE creates task)
    • use case + route handler
    • e2e tests
  • return appropriate response if the item is a redirect or does not exist (@Jakob_WMDE creates task)
    • use case + route handler
    • e2e tests
  • spec tests (@Silvan_WMDE creates task)
  • create a read model for labels (get rid of any TermList usage) (@Ollie.Shotton_WMDE creates task)
Jakob_WMDE renamed this task from Create rest route for retrieving an item's labels to 🏷️ Create rest route for retrieving an item's labels.Dec 20 2022, 3:26 PM

Change 889947 had a related patch set uploaded (by Jakob; author: Jakob):

[mediawiki/extensions/Wikibase@master] REST: Mark GET labels as production ready

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

Change 889947 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Mark GET labels as production ready

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