Page MenuHomePhabricator

[ES-M2]: Investigate why the ‘type’ is not shown for EntitySchema-valued statements in the Lua Debug Console
Closed, ResolvedPublic

Description

Using the Lua Debug Console, loading an entity with an EntitySchema-valued statement works (e.g. mw.logObject(mw.wikibase.getEntity('P619'))), although the data value only has an id and not a type, which is unusual behaviour.

We must investigate why the type is not shown and whether that’s the correct behaviour.

Acceptance Criteria

  • Ensure there is no risk when using Lua functions for EntitySchemas when implementing the new patch from Product Platform

Notes
If the type can be added in less than one day of development we should move forward and implement it in this ticket

Event Timeline

Easy enough to fix:

diff --git a/src/Wikibase/Hooks/EntitySchemaValue.php b/src/Wikibase/Hooks/EntitySchemaValue.php
index ce125cc09e..14fa85bc05 100644
--- a/src/Wikibase/Hooks/EntitySchemaValue.php
+++ b/src/Wikibase/Hooks/EntitySchemaValue.php
@@ -39,7 +39,10 @@ public function getValue() {
 	}
 
 	public function getArrayValue(): array {
-		return [ 'id' => $this->id->getId() ];
+		return [
+			'id' => $this->id->getId(),
+			'type' => 'entityschema',
+		];
 	}
 
 	public function getSchemaId(): string {

I’ve squashed the above change into the Gerrit change that introduces the class; moving to peer review in case someone wants to take a look, but I don’t think it needs a lot more time spent on it :)