Page MenuHomePhabricator

Simplify the structure of sitelinks in item data in Wikibase REST API
Closed, ResolvedPublic3 Estimated Story Points

Description

As a Wikidata data reuser I want to get sitelink data in a simple format so that I can access the necessary data easily
As a Wikidata data reuser I want to get sitelink data without redundant data so that I do not need to process unnecessary data.

Current structure of sitelinks in the Wikibase REST API responses, "inherited" from "Action API's" "serialization" duplicates the information about the "site". This information could be skipped in REST API response without API clients losing data.

Example of a current structure

...
"sitelinks": {
  "dewiki": {
    "site": "dewiki",
    "title": "Artikel",
    "badges": []
  },
  "enwiki": {
    "site": "enwiki",
    "title": "Article Title",
    "badges": ["Q123"]
  }
  ...
}
...

Above example using the intended representation omitting redundant information

...
"sitelinks": {
  "dewiki": {
    "title": "Artikel",
    "badges": []
  },
  "enwiki": {
    "title": "Article Title",
    "badges": ["Q123"]
  }
  ...
}

Acceptance criteria:

  • GET /entities/items/{item_id} responses contain sitelink data using the intended structure, omitting redundant site field

Event Timeline

Silvan_WMDE set the point value for this task to 3.Oct 26 2022, 12:59 PM

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

[mediawiki/extensions/Wikibase@master] REST: Simplify sitelinks structure in item data

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

Change 861804 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Simplify sitelinks structure in item data

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

It’s sometimes useful to have a little redundancy when coding, from experience. These changes might break some code when the coder only has access to the object sitelinks. When this is the case for a reason on another, you’re pretty happy to have the « key » of the mapping available in the object.

Not having it might need to rewrite some code that make the assumption that the information is available in the object value. For example if all you have available at some point is a list of sitelinks (or statements in the other ticket)

@TomT0m you're right, in theory/principle. I wonder however if there is a known software/code that would actually process "site link object" without knowing where it comes from. Some logic might need to be changed/adjusted, yes. Yet, the code swapping Action API to REST API would need to undergo some adjustments any way. It immediately does not seem like the biggest of the challenges to face when adapting the new API.

I think this ticket can be closed as completed?