Lucas_Werkmeister_WMDE created this task.
Lucas_Werkmeister_WMDE added projects: Wikidata, Lexicographical data.

TASK DESCRIPTION

As a Wikidata editor, I rely on Wikibase to enforce that certain invalid edits cannot be made.

Problem:
Currently, the language and lexical category of a lexeme and the grammatical features of a form can be set to nonexisting items via the API. For the lexeme features, this is visible in the following code:

new LexicalCategoryChangeOpDeserializer(
	new CompositeValidator( [] ), // FIXME: What does belong here?
	$wikibaseRepo->getStringNormalizer()
),
new LanguageChangeOpDeserializer(
	new CompositeValidator( [] ), // FIXME: What does belong here?
	$wikibaseRepo->getStringNormalizer()
),

Those CompositeValidators are supposed to contain at least one validator which checks that the item ID exists. For form grammatical features, I don’t even see a place where such validators are currently wired up, so that probably needs to be added somewhere (most likely in EditFormChangeOpDeserializer).

This is not a critical problem because Wikibase and WikibaseLexeme can deal with such entities (the item IDs are displayed like deleted items), but still, we should probably prevent this.

Example:
testwikidata:L:L132 was created with the following JSON:

{
  "lemmas": {
    "en": { "language": "en", "value": "test lexeme with non-existing items" }
  },
  "language": "Q99999999",
  "lexicalCategory": "Q99999999",
  "forms": [
    {
      "add": 1,
      "representations": {
        "en": { "language": "en", "value": "test form with non-existing item" }
      },
      "grammaticalFeatures": ["Q99999999"]
    }
  ]
}

BDD
GIVEN The item Q99999999 does not exist
WHEN I try to create a lexeme with the language Q99999999
OR I try to create a lexeme with the lexical category Q99999999
OR I try to create a form with the grammatical feature Q99999999
OR I try to edit an existing entity in such a fashion
THEN the API returns an error
AND no edit is performed

Acceptance criteria:

  • The API does not permit edits referring to nonexisting item IDs
  • The UI does not permit them either (it already doesn’t, but just to make sure)

TASK DETAIL
https://phabricator.wikimedia.org/T208953

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE
Cc: Lucas_Werkmeister_WMDE, Nandana, Mringgaard, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, Wikidata-bugs, aude, Darkdadaah, Mbch331
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to