Aude has uploaded a new change for review.

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

Change subject: Fix JSON entity keys in api results
......................................................................

Fix JSON entity keys in api results

Change-Id: I40b4a4e3e46e176b37ec250dba21da690f6d10e3
---
M composer.lock
M extensions/Wikibase/repo/includes/api/ResultBuilder.php
M extensions/Wikibase/repo/tests/phpunit/includes/api/ResultBuilderTest.php
M vendor/composer/installed.json
4 files changed, 124 insertions(+), 93 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikidata 
refs/changes/91/237091/1

diff --git a/composer.lock b/composer.lock
index 650fa88..0a7251d 100644
--- a/composer.lock
+++ b/composer.lock
@@ -1385,12 +1385,12 @@
             "source": {
                 "type": "git",
                 "url": 
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git";,
-                "reference": "3b6778162e94ce36fbb8d88ec3e663aa638fc83c"
+                "reference": "989623de470ec9017d2d1d1c50221162bd95be87"
             },
             "dist": {
                 "type": "zip",
-                "url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/3b6778162e94ce36fbb8d88ec3e663aa638fc83c";,
-                "reference": "3b6778162e94ce36fbb8d88ec3e663aa638fc83c",
+                "url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/989623de470ec9017d2d1d1c50221162bd95be87";,
+                "reference": "989623de470ec9017d2d1d1c50221162bd95be87",
                 "shasum": ""
             },
             "require": {
@@ -1459,7 +1459,7 @@
                 "wikibaserepo",
                 "wikidata"
             ],
-            "time": "2015-09-07 20:40:44"
+            "time": "2015-09-09 08:40:20"
         },
         {
             "name": "wikibase/wikimedia-badges",
@@ -1501,7 +1501,7 @@
             "support": {
                 "irc": "irc://irc.freenode.net/wikidata"
             },
-            "time": "2015-08-12 09:30:01"
+            "time": "2015-08-04 17:18:47"
         }
     ],
     "packages-dev": [],
diff --git a/extensions/Wikibase/repo/includes/api/ResultBuilder.php 
b/extensions/Wikibase/repo/includes/api/ResultBuilder.php
index 707aa8b..9b82c58 100644
--- a/extensions/Wikibase/repo/includes/api/ResultBuilder.php
+++ b/extensions/Wikibase/repo/includes/api/ResultBuilder.php
@@ -310,7 +310,13 @@
 
                $this->appendValue( array( 'entities' ), 
$sourceEntityIdSerialization, $record, 'entity' );
                if ( $this->addMetaData ) {
-                       $this->result->addArrayType( array( 'entities' ), 
'array' );
+                       $this->result->addArrayType( array( 'entities' ), 
'kvp', 'id' );
+                       $this->result->addValue(
+                               array( 'entities' ),
+                               ApiResult::META_KVP_MERGE,
+                               true,
+                               ApiResult::OVERRIDE
+                       );
                }
        }
 
@@ -1028,6 +1034,13 @@
 
                if ( $this->addMetaData ) {
                        $this->result->addIndexedTagName( 'entities', 'entity' 
);
+                       $this->result->addArrayType( array( 'entities' ), 
'kvp', 'id' );
+                       $this->result->addValue(
+                               array( 'entities' ),
+                               ApiResult::META_KVP_MERGE,
+                               true,
+                               ApiResult::OVERRIDE
+                       );
                }
 
                $this->missingEntityCounter--;
diff --git 
a/extensions/Wikibase/repo/tests/phpunit/includes/api/ResultBuilderTest.php 
b/extensions/Wikibase/repo/tests/phpunit/includes/api/ResultBuilderTest.php
index a69c3fa..035166a 100644
--- a/extensions/Wikibase/repo/tests/phpunit/includes/api/ResultBuilderTest.php
+++ b/extensions/Wikibase/repo/tests/phpunit/includes/api/ResultBuilderTest.php
@@ -329,7 +329,9 @@
                                        ),
                                ),
                                '_element' => 'entity',
-                               '_type' => 'array',
+                               '_type' => 'kvp',
+                               '_kvpkeyname' => 'id',
+                               '_kvpmerge' => true,
                        ),
                        '_type' => 'assoc',
                );
@@ -462,7 +464,9 @@
                                        ),
                                ),
                                '_element' => 'entity',
-                               '_type' => 'array',
+                               '_type' => 'kvp',
+                               '_kvpkeyname' => 'id',
+                               '_kvpmerge' => true,
                        ),
                        '_type' => 'assoc',
                );
@@ -645,7 +649,9 @@
                                        ),
                                ),
                                '_element' => 'entity',
-                               '_type' => 'array',
+                               '_type' => 'kvp',
+                               '_kvpkeyname' => 'id',
+                               '_kvpmerge' => true,
                        ),
                        '_type' => 'assoc',
                );
@@ -1286,6 +1292,9 @@
                                                        'missing' => '',
                                                ),
                                                '_element' => 'entity',
+                                               '_type' => 'kvp',
+                                               '_kvpkeyname' => 'id',
+                                               '_kvpmerge' => true,
                                        ),
                                        '_type' => 'assoc',
                                )
@@ -1301,6 +1310,9 @@
                                                        'missing' => '',
                                                ),
                                                '_element' => 'entity',
+                                               '_type' => 'kvp',
+                                               '_kvpkeyname' => 'id',
+                                               '_kvpmerge' => true,
                                        ),
                                        '_type' => 'assoc',
                                )
@@ -1316,6 +1328,9 @@
                                                        'missing' => '',
                                                ),
                                                '_element' => 'entity',
+                                               '_type' => 'kvp',
+                                               '_kvpkeyname' => 'id',
+                                               '_kvpmerge' => true,
                                        ),
                                        '_type' => 'assoc',
                                )
@@ -1338,6 +1353,9 @@
                                                        'missing' => '',
                                                ),
                                                '_element' => 'entity',
+                                               '_type' => 'kvp',
+                                               '_kvpkeyname' => 'id',
+                                               '_kvpmerge' => true,
                                        ),
                                        '_type' => 'assoc',
                                )
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index cb37e5f..c2b0c67 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -1272,90 +1272,6 @@
         ]
     },
     {
-        "name": "wikibase/wikibase",
-        "version": "dev-wmf/1.26wmf22",
-        "version_normalized": "dev-wmf/1.26wmf22",
-        "source": {
-            "type": "git",
-            "url": 
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git";,
-            "reference": "3b6778162e94ce36fbb8d88ec3e663aa638fc83c"
-        },
-        "dist": {
-            "type": "zip",
-            "url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/3b6778162e94ce36fbb8d88ec3e663aa638fc83c";,
-            "reference": "3b6778162e94ce36fbb8d88ec3e663aa638fc83c",
-            "shasum": ""
-        },
-        "require": {
-            "data-values/common": "~0.3.0",
-            "data-values/data-types": "~0.5.0",
-            "data-values/data-values": "~1.0",
-            "data-values/geo": "~1.0",
-            "data-values/interfaces": "~0.2.0|~0.1.5",
-            "data-values/javascript": "~0.6.0|~0.7.0",
-            "data-values/number": "~0.5.0",
-            "data-values/serialization": "~1.0",
-            "data-values/time": "~0.8.1",
-            "data-values/validators": "~0.1.0",
-            "data-values/value-view": "~0.15.3",
-            "diff/diff": "~2.0|~1.0",
-            "php": ">=5.3.2",
-            "wikibase/data-model": "~4.0",
-            "wikibase/data-model-javascript": "^1.0.2",
-            "wikibase/data-model-serialization": "~2.0",
-            "wikibase/data-model-services": "~2.0",
-            "wikibase/internal-serialization": "~2.0",
-            "wikibase/javascript-api": "~1.0",
-            "wikibase/serialization-javascript": "~2.0"
-        },
-        "conflict": {
-            "mediawiki/mediawiki": "<1.23"
-        },
-        "require-dev": {
-            "squizlabs/php_codesniffer": "~2.1"
-        },
-        "time": "2015-09-07 20:40:44",
-        "type": "mediawiki-extension",
-        "installation-source": "dist",
-        "autoload": {
-            "classmap": [
-                "client/includes/",
-                "client/WikibaseClient.hooks.php",
-                "client/tests/phpunit/",
-                "lib/includes/",
-                "lib/WikibaseLib.hooks.php",
-                "lib/tests/phpunit/",
-                "repo/includes/",
-                "repo/maintenance/",
-                "repo/tests/phpunit/",
-                "repo/Wikibase.hooks.php"
-            ],
-            "psr-4": {
-                "Wikibase\\View\\": "view/src",
-                "Wikimedia\\Purtle\\": "purtle/src",
-                "Wikimedia\\Purtle\\Tests\\": "purtle/tests/phpunit"
-            }
-        },
-        "notification-url": "https://packagist.org/downloads/";,
-        "license": [
-            "GPL-2.0+"
-        ],
-        "authors": [
-            {
-                "name": "The Wikidata team"
-            }
-        ],
-        "description": "Structured data repository for MediaWiki",
-        "homepage": "http://wikiba.se";,
-        "keywords": [
-            "wikibase",
-            "wikibaseclient",
-            "wikibaselib",
-            "wikibaserepo",
-            "wikidata"
-        ]
-    },
-    {
         "name": "wikibase/wikimedia-badges",
         "version": "dev-master",
         "version_normalized": "9999999-dev",
@@ -1549,5 +1465,89 @@
         "support": {
             "issues": "https://phabricator.wikimedia.org/project/profile/1202/";
         }
+    },
+    {
+        "name": "wikibase/wikibase",
+        "version": "dev-wmf/1.26wmf22",
+        "version_normalized": "dev-wmf/1.26wmf22",
+        "source": {
+            "type": "git",
+            "url": 
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git";,
+            "reference": "989623de470ec9017d2d1d1c50221162bd95be87"
+        },
+        "dist": {
+            "type": "zip",
+            "url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/989623de470ec9017d2d1d1c50221162bd95be87";,
+            "reference": "989623de470ec9017d2d1d1c50221162bd95be87",
+            "shasum": ""
+        },
+        "require": {
+            "data-values/common": "~0.3.0",
+            "data-values/data-types": "~0.5.0",
+            "data-values/data-values": "~1.0",
+            "data-values/geo": "~1.0",
+            "data-values/interfaces": "~0.2.0|~0.1.5",
+            "data-values/javascript": "~0.6.0|~0.7.0",
+            "data-values/number": "~0.5.0",
+            "data-values/serialization": "~1.0",
+            "data-values/time": "~0.8.1",
+            "data-values/validators": "~0.1.0",
+            "data-values/value-view": "~0.15.3",
+            "diff/diff": "~2.0|~1.0",
+            "php": ">=5.3.2",
+            "wikibase/data-model": "~4.0",
+            "wikibase/data-model-javascript": "^1.0.2",
+            "wikibase/data-model-serialization": "~2.0",
+            "wikibase/data-model-services": "~2.0",
+            "wikibase/internal-serialization": "~2.0",
+            "wikibase/javascript-api": "~1.0",
+            "wikibase/serialization-javascript": "~2.0"
+        },
+        "conflict": {
+            "mediawiki/mediawiki": "<1.23"
+        },
+        "require-dev": {
+            "squizlabs/php_codesniffer": "~2.1"
+        },
+        "time": "2015-09-09 08:40:20",
+        "type": "mediawiki-extension",
+        "installation-source": "dist",
+        "autoload": {
+            "classmap": [
+                "client/includes/",
+                "client/WikibaseClient.hooks.php",
+                "client/tests/phpunit/",
+                "lib/includes/",
+                "lib/WikibaseLib.hooks.php",
+                "lib/tests/phpunit/",
+                "repo/includes/",
+                "repo/maintenance/",
+                "repo/tests/phpunit/",
+                "repo/Wikibase.hooks.php"
+            ],
+            "psr-4": {
+                "Wikibase\\View\\": "view/src",
+                "Wikimedia\\Purtle\\": "purtle/src",
+                "Wikimedia\\Purtle\\Tests\\": "purtle/tests/phpunit"
+            }
+        },
+        "notification-url": "https://packagist.org/downloads/";,
+        "license": [
+            "GPL-2.0+"
+        ],
+        "authors": [
+            {
+                "name": "The Wikidata team"
+            }
+        ],
+        "description": "Structured data repository for MediaWiki",
+        "homepage": "http://wikiba.se";,
+        "keywords": [
+            "wikibase",
+            "wikibaseclient",
+            "wikibaselib",
+            "wikibaserepo",
+            "wikidata"
+        ]
     }
 ]

-- 
To view, visit https://gerrit.wikimedia.org/r/237091
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I40b4a4e3e46e176b37ec250dba21da690f6d10e3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikidata
Gerrit-Branch: wmf/1.26wmf22
Gerrit-Owner: Aude <aude.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to