Florianschmidtwelzow has uploaded a new change for review. https://gerrit.wikimedia.org/r/304863
Change subject: Upgrade justinrainbow/json-schema to ~3.0 ...................................................................... Upgrade justinrainbow/json-schema to ~3.0 The release between 1.6.1 and 3.0.0 has a huge amount of code maintenance changes, as well as internal optimization and some "visible" changes (as well as the one mentioned in the linked task). However, it's a version jump over 2 major versions, which is, by it's definition a major change ;). Nonetheless, the (for us) important api has changed marginally: Instead of using the JsonSchema\Uri\UriRetriever class to retrieve the schema, we now use the $ref keyword to reference the json schema file (which also is an internal optimization). In this way, we let the json-schema library decide, how to resolve a ref (and the schema) instead of relying on the UriRetriever api to be public and stable. The versions also include various bug fixes (which, as far as I know, doesn't apply to us). I tested this change with various combinations of valid and invalid extension.json schemas (version 2 as well as version 3). Given that there were no major changes to the schema interpretation itself, and the good test coverage of the library, there shouldn't be a high risk because of this change. The full list of changes can be found at: https://github.com/justinrainbow/json-schema/compare/1.6.1...3.0.0 as well as the changelogs of the single versions: https://github.com/justinrainbow/json-schema/releases Bug: T141281 Change-Id: Ie37e2ebc48684783abf8d99d2f775ee6a5988da7 --- M composer.json M tests/phpunit/structure/ExtensionJsonValidationTest.php 2 files changed, 3 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/63/304863/1 diff --git a/composer.json b/composer.json index 9bd0fa1..c8ed37e 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,7 @@ }, "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", - "justinrainbow/json-schema": "~1.6", + "justinrainbow/json-schema": "~3.0", "mediawiki/mediawiki-codesniffer": "0.7.2", "monolog/monolog": "~1.18.2", "nikic/php-parser": "1.4.1", diff --git a/tests/phpunit/structure/ExtensionJsonValidationTest.php b/tests/phpunit/structure/ExtensionJsonValidationTest.php index 275c0d1..711eab6 100644 --- a/tests/phpunit/structure/ExtensionJsonValidationTest.php +++ b/tests/phpunit/structure/ExtensionJsonValidationTest.php @@ -74,11 +74,9 @@ $version <= ExtensionRegistry::MANIFEST_VERSION, "$path is using a non-supported schema version" ); - $retriever = new JsonSchema\Uri\UriRetriever(); - $schema = $retriever->retrieve( 'file://' . $schemaPath ); - $validator = new JsonSchema\Validator(); - $validator->check( $data, $schema ); + $validator = new JsonSchema\Validator; + $validator->check( $data, (object) [ '$ref' => 'file://' . $schemaPath ] ); if ( $validator->isValid() ) { // All good. $this->assertTrue( true ); -- To view, visit https://gerrit.wikimedia.org/r/304863 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie37e2ebc48684783abf8d99d2f775ee6a5988da7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits