Page MenuHomePhabricator

Missleading error message when using wbcreateclaim with "novalue" and non existing property ID
Closed, ResolvedPublic

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: 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 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.

Change 645452 had a related patch set uploaded (by Shubham656jain; owner: Shubham656jain):
[mediawiki/extensions/Wikibase@master] Correct Missleading error message when using wbcreateclaim with non-existing property ID

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

Change 645452 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Fix Missleading error when using wbcreateclaim with non-existing property

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

Lydia_Pintscher added a subscriber: Lydia_Pintscher.

Thank you for the patch! :)