Page MenuHomePhabricator

When editing Lexeme with wbeditentity API action, response should not contain fields not relevant for Lexemes
Closed, ResolvedPublic

Description

When editing Lexeme entity using wbeditentity API action, API response after successful edit contains (empty) fields with labels, descriptions and aliases.

wbeditentity should be either adjusted so it returns fields relevant to the edited entity (ie. labels, descriptions and aliases when Item is edited, and lemmas, language and lexical category when Lexeme entity is edited), or not return changed entity data at all.

Decision on which way to choose depends on whether data returned in the API response is actually used anywhere, I believe.

Event Timeline

WMDE-leszek created this task.

I checked the source code, it seems that EditEntity::buildResult is hard-coded to output traditional parts. ResultBuilder also needs to change to become injectable. More refactoring, yay.

WMDE-leszek lowered the priority of this task from Medium to Low.Mar 16 2017, 9:08 AM

@Ladsgroup: thanks for looking at this. Note that it has not been yet decided whether we want to make it possible to inject "custom" fields there. It could be that we rather decide not to return any changed field in this action's response.
So it might not be worth refactoring this code now that we then decided to remove the whole feature.

Just ran into this. Did we make up our mind about this, @WMDE-leszek?
I am pro returning the entity as it is possible to send patch requests (i.e. containing only parts of the information) and the consumer would need to send another request to get to the server state of the entity.

Apparently mind was not made up just yet. A possible field of activity for the future.

Change 658601 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/core@master] Allow replacing ApiResult value with same value

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

Change 658602 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] Make wbeditentity return full entity data

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

Change 658603 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] Test that wbeditentity returns full entity data

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

Change 658601 merged by jenkins-bot:
[mediawiki/core@master] Allow replacing ApiResult value with same value

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

Change 658602 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Make wbeditentity return full entity data

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

Change 658603 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Test that wbeditentity returns full entity data

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

Lucas_Werkmeister_WMDE claimed this task.

Resolved with the recently announced wbeditentity changes (T271105), I reckon: the response now includes all the relevant fields and no irrelevant ones.