Page MenuHomePhabricator

Missleading error message when using wbcreateclaim with "novalue" and non existing property ID
Open, Needs TriagePublic

Description

A request such as this on test wikidata

/w/api.php?action=wbcreateclaim&format=json&entity=Q42&snaktype=novalue&property=P999999

Where the property does not exist, results in a miss leading error message.

{
    "error": {
        "code": "invalid-snak",
        "info": "Invalid snak data.",
        "messages": [
            {
                "name": "wikibase-api-invalid-snak",
                "parameters": [],
                "html": {
                    "*": "Invalid snak data."
                }
            }
        ],
        "*": "See https://test.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
    },
    "servedby": "mw1342"
}

This is about introducing additional code logic and a seperate error message.
In the API module the property parameter should be checked and the property should exist.
If the property does not exist then a new error message should be returned stating that fact.

Event Timeline

Addshore created this task.Nov 15 2019, 2:35 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 15 2019, 2:35 PM

@Addshore: As a new contributor, I assume this is about editing the line "wikibase-api-invalid-snak": "Invalid snak data.", in the file repo/i18n/en.json in the repository mediawiki/extensions/Wikibase? Or is this about introducing additional code logic and an additional, separate error message?

This is about introducing additional code logic and a seperate error message.
In the API module the property parameter should be checked and the property should exist.
If the property does not exist then a new error message should be returned stating that fact.

Addshore updated the task description. (Show Details)Nov 19 2019, 4:04 PM

@Addshore As a new contributor, I am wondering how to reproduce this error locally and if the needed code changes should go here: https://github.com/wikimedia/mediawiki-extensions-Wikibase/blob/master/repo/includes/Api/CreateClaim.php? :) Some more getting started steps will be a helpful addition to this task description, IMO.