Page MenuHomePhabricator

Handle illegal type modifications of the root element in PATCH requests
Closed, ResolvedPublicBUG REPORT

Description

In https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/967138 we are handling an error case for PATCH Item/Property aliases (T337371 and T342982), when the user tries to replace the entire aliases list with a new value of invalid type (e.g. string).

The same attempt will fail with a "500 unexpected-error" on all other PATCH endpoints:

  • PATCH /entities/items/{item_id}/labels
  • PATCH /entities/properties/{property_id}/labels
  • PATCH /entities/items/{item_id}/descriptions
  • PATCH /entities/properties/{property_id}/descriptions
  • PATCH /entities/items/{item_id}/statements/{statement_id}
  • PATCH /entities/properties/{property_id}/statements/{statement_id}
  • PATCH /statements/{statement_id}

We should handle these error cases and return a patch-result-invalid-value error

Event Timeline

@Silvan_WMDE isn't this all being covered by the 422 patch-invalid-field error? If I'm missing something lmk, else I'll archive this ticket

This will be covered by the new generalized version of this error

Jakob_WMDE subscribed.

These bugs still exist, so this task shouldn't have been closed. These error cases fall under the patch-result-invalid-value category, but we never handled them to begin with, which is why we also didn't catch them when changing to the generalized error responses.

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

[mediawiki/extensions/Wikibase@master] REST: Fix alias validation

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

Change #1064809 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Fix alias validation

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

Change #1069209 had a related patch set uploaded (by Dima koushha; author: Dima koushha):

[mediawiki/extensions/Wikibase@master] REST: Fix "Patch Item/Property Statement" errors

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

Change #1069209 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Fix "Patch Item/Property Statement" errors

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

Change #1070029 had a related patch set uploaded (by Dima koushha; author: Dima koushha):

[mediawiki/extensions/Wikibase@master] REST: Fix "Patch Item/Property Descriptions" errors

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

Change #1070029 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Fix "Patch Item/Property Descriptions" errors

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

Change #1070198 had a related patch set uploaded (by Dima koushha; author: Dima koushha):

[mediawiki/extensions/Wikibase@master] REST: Fix `Patch Item/Property Labels` errors

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

Change #1070198 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Fix `Patch Item/Property Labels` errors

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