Page MenuHomePhabricator

🏷️🐼 Validate type of the value field
Closed, ResolvedPublic

Description

The new value of labels to be patched must be a string. Currently, non-string label values cause a 500 error due to failed deserialization.

Instead, an InvalidFieldExceptionshould be thrown, resulting in http status code 422 with the following response :

{
"code": "patched-label-invalid"
"message": "Changed label for '{lang_code}' is not valid: '{label-text}'"
"context": {
  "language": <language_code>
  "value": <label>
}

Event Timeline

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

[mediawiki/extensions/Wikibase@master] REST: Handle non-string JSON Patch 'value' fields

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

Change 922817 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Handle non-string JSON Patch 'value' fields

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