Page MenuHomePhabricator

🐐️ Provide data of a statement on a property
Closed, ResolvedPublic8 Estimated Story Points

Description

GET /entities/properties/{property_id}/statements/{statement_id}

  • respond 404 property-not-found if property does not exist

GET /statements/{statement_id}

  • no new error cases

Technical notes:

  • refactor the GetItemStatement use case to GetStatement, generalizing the "subject id" to work for both Properties and Items
  • write an ADR about the approach

Event Timeline

Ollie.Shotton_WMDE renamed this task from Provide data of a statements on a property to Provide data of a statement on a property.Jun 9 2023, 8:28 AM
Jakob_WMDE set the point value for this task to 8.

Task Breakdown Notes

  • refactor the GetItemStatement use case to GetStatement
    1. rename the retriever interface and create a new metadata retriever for the statement (@Ollie.Shotton_WMDE creates ticket)
      • EntityRevisionLookup works for both Items and Properties
    2. create a new use case step GetLatestStatementSubjectRevisionMetadata (@Silvan_WMDE creates ticket)
      • avoid throwing item or property specific use case errors, use "subject" instead
    3. rename use case and its related classes (@WMDE_Norman creates ticket)
      • use an EntityIdParser to replace the $itemId with $subjectId
      • use newly created retriever and use case step
  • make GetStatement work with statements on properties (@Muhammad_Yasser_Jazirahly_WMDE creates ticket)
    • allow property IDs in the validator
    • create a new statement retriever implementation, that works for both Item and Property statements
  • add the new long route for GETting a property specific statement (@Ollie.Shotton_WMDE creates ticket)
    • find a smart way to make e2e tests on statements work (short/long routes on item/property statements)
  • mark the new property statement (long) route as production ready (@WMDE_Norman creates ticket)
Silvan_WMDE renamed this task from Provide data of a statement on a property to 🐐️ Provide data of a statement on a property.Jun 14 2023, 11:01 AM

I've added a new sub-task to this story:
🐐️Making GetStatement item/property agnostic
https://phabricator.wikimedia.org/T339933

Writing a longer comment to see if I followed the "process" properly:

  • Chose to test on P224272: https://wikidata.beta.wmflabs.org/wiki/Property:P224272
  • Tested on insomnia with GET /entities/properties/P224272/statements to get the statement ids. Expected result: See the details of all the listed properties. Actual result matched this.
  • Picked P694s id and then did GET /entities/properties/P224272/statements/P224272$636e7d00-4240-de8b-322f-dad8027c4824. Expected result: Only see information for that particular statement of the property. Actual result matched this
  • Tested error case with P2 and got the error as described in the ticket
  • Lastly tested GET /statements/P224272$636e7d00-4240-de8b-322f-dad8027c4824 and got the data only for that particular statement of the property (as in the 3rd point). Removed a few numbers to check for invalid statement id error

I assume this suffices but someone better correct me before I move the ticket to Done

Confirming. I've checked the conditional HTTP headers and authentication response header. Seems all good. Thanks!