jenkins-bot has submitted this change and it was merged. Change subject: Re add JSON entity keys ......................................................................
Re add JSON entity keys This broke due to: https://gerrit.wikimedia.org/r/#/c/227686 This is a similar sort of thing that we ran into with sitelinks and terms. Integration tests have been added in a followup Change-Id: I16cff8a7392a67a2292cb9e53cbd97ad53b16632 --- M repo/includes/api/ResultBuilder.php M repo/tests/phpunit/includes/api/ResultBuilderTest.php 2 files changed, 35 insertions(+), 4 deletions(-) Approvals: John Vandenberg: Looks good to me, but someone else must approve Ricordisamoa: Looks good to me, but someone else must approve Bene: Looks good to me, approved jenkins-bot: Verified diff --git a/repo/includes/api/ResultBuilder.php b/repo/includes/api/ResultBuilder.php index 6a0f4c0..a9f6385 100644 --- a/repo/includes/api/ResultBuilder.php +++ b/repo/includes/api/ResultBuilder.php @@ -311,7 +311,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 + ); } } @@ -1041,6 +1047,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/repo/tests/phpunit/includes/api/ResultBuilderTest.php b/repo/tests/phpunit/includes/api/ResultBuilderTest.php index a69c3fa..035166a 100644 --- a/repo/tests/phpunit/includes/api/ResultBuilderTest.php +++ b/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', ) -- To view, visit https://gerrit.wikimedia.org/r/237048 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I16cff8a7392a67a2292cb9e53cbd97ad53b16632 Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Addshore <[email protected]> Gerrit-Reviewer: Addshore <[email protected]> Gerrit-Reviewer: Aude <[email protected]> Gerrit-Reviewer: Bene <[email protected]> Gerrit-Reviewer: John Vandenberg <[email protected]> Gerrit-Reviewer: Ricordisamoa <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
