Page MenuHomePhabricator

🟫 Reject statements that change the Statement ID
Closed, ResolvedPublic

Description

If the request contains id in the statement data, the API should respond with 400 (error code: invalid-operation-change-statement-id, error message: Cannot change the ID of the existing statement) unless the provided ID matches the the statement's ID in the request's path

Event Timeline

Jakob_WMDE renamed this task from Reject statements that change the Statement ID to 🟫 Reject statements that change the Statement ID.Aug 8 2022, 2:50 PM

Change 821701 had a related patch set uploaded (by Ollie Shotton; author: Ollie Shotton):

[mediawiki/extensions/Wikibase@master] REST: Reject statements that change Statement ID

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

Change 821704 had a related patch set uploaded (by Ollie Shotton; author: Ollie Shotton):

[mediawiki/extensions/Wikibase@master] REST: Reject statements that change Statement ID

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

Change 821701 abandoned by Ollie Shotton:

[mediawiki/extensions/Wikibase@master] REST: Reject statements that change Statement ID

Reason:

Abandoning in favour of I4552a8f62608f1fcb482a1eeb8875563278c77cd

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

Change 821704 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Reject statements that change Statement ID

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

Ended up doing use case validation as the alternative of catching exceptions thrown by the Data Model didn’t feel “right”.
We could raise an error in the Data Model as well as use case validation for a belt and braces approach; probably depends on how/where StatementList::replaceStatement() will be used in the future.

Change 825826 had a related patch set uploaded (by Ollie Shotton; author: Ollie Shotton):

[mediawiki/extensions/Wikibase@master] DM: Differentiate `replaceStatement()` exceptions

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

Change 825827 had a related patch set uploaded (by Ollie Shotton; author: Ollie Shotton):

[mediawiki/extensions/Wikibase@master] REST: Refactor Statement ID changed validation

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

Change 825826 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] DM: Differentiate `replaceStatement()` exceptions

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

Change 825827 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Refactor Statement ID changed validation

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