jenkins-bot has submitted this change and it was merged. Change subject: Update justinrainbow/json-schema from v3.0.0 to v3.0.1 ......................................................................
Update justinrainbow/json-schema from v3.0.0 to v3.0.1 https://github.com/justinrainbow/json-schema/compare/3.0.0...3.0.1 Change-Id: I61fda77bda1b747f81103ca0747d00f2458fe526 --- M autoload.php M composer.json M composer.lock M composer/installed.json M justinrainbow/json-schema/composer.json M justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php M justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php 7 files changed, 100 insertions(+), 92 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/autoload.php b/autoload.php index a5957bd..9bcfa9f 100644 --- a/autoload.php +++ b/autoload.php @@ -2,6 +2,6 @@ // autoload.php @generated by Composer -require_once __DIR__ . '/composer/autoload_real.php'; +require_once __DIR__ . '/composer' . '/autoload_real.php'; return ComposerAutoloaderInit_mediawiki_vendor::getLoader(); diff --git a/composer.json b/composer.json index 433f119..3ddb223 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "composer/semver": "1.4.2", "cssjanus/cssjanus": "1.1.2", "firebase/php-jwt": "3.0.0", - "justinrainbow/json-schema": "3.0.0", + "justinrainbow/json-schema": "3.0.1", "liuggio/statsd-php-client": "1.0.18", "mediawiki/at-ease": "1.1.0", "monolog/monolog": "1.18.2", diff --git a/composer.lock b/composer.lock index 58ca9d1..efd8472 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "618ad555cbfed305fa164e3b3cfd3e50", + "hash": "a0be8dca46b0487f79cc777d78940f4a", + "content-hash": "50416a3515ff05a598d0a6cfdf4fac9d", "packages": [ { "name": "composer/semver", @@ -148,16 +149,16 @@ }, { "name": "justinrainbow/json-schema", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "12965831120bb18852e9865804a6089906323b8e" + "reference": "2128f9de8be4600c3394d94c3918faf67157b76b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/12965831120bb18852e9865804a6089906323b8e", - "reference": "12965831120bb18852e9865804a6089906323b8e", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/2128f9de8be4600c3394d94c3918faf67157b76b", + "reference": "2128f9de8be4600c3394d94c3918faf67157b76b", "shasum": "" }, "require": { @@ -174,7 +175,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -210,7 +211,7 @@ "json", "schema" ], - "time": "2016-08-15 16:39:11" + "time": "2016-08-26 12:45:49" }, { "name": "liuggio/statsd-php-client", diff --git a/composer/installed.json b/composer/installed.json index 994e5c8..033371b 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -1668,74 +1668,6 @@ "homepage": "https://www.mediawiki.org/wiki/WrappedString" }, { - "name": "justinrainbow/json-schema", - "version": "3.0.0", - "version_normalized": "3.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "12965831120bb18852e9865804a6089906323b8e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/12965831120bb18852e9865804a6089906323b8e", - "reference": "12965831120bb18852e9865804a6089906323b8e", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "json-schema/json-schema-test-suite": "1.2.0", - "phpdocumentor/phpdocumentor": "~2", - "phpunit/phpunit": "^4.8.22" - }, - "time": "2016-08-15 16:39:11", - "bin": [ - "bin/validate-json" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "JsonSchema\\": "src/JsonSchema/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bruno Prieto Reis", - "email": "[email protected]" - }, - { - "name": "Justin Rainbow", - "email": "[email protected]" - }, - { - "name": "Igor Wiedler", - "email": "[email protected]" - }, - { - "name": "Robert Schönthal", - "email": "[email protected]" - } - ], - "description": "A library to validate a json schema.", - "homepage": "https://github.com/justinrainbow/json-schema", - "keywords": [ - "json", - "schema" - ] - }, - { "name": "oojs/oojs-ui", "version": "v0.17.9", "version_normalized": "0.17.9.0", @@ -1967,5 +1899,73 @@ "validation", "versioning" ] + }, + { + "name": "justinrainbow/json-schema", + "version": "3.0.1", + "version_normalized": "3.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/justinrainbow/json-schema.git", + "reference": "2128f9de8be4600c3394d94c3918faf67157b76b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/2128f9de8be4600c3394d94c3918faf67157b76b", + "reference": "2128f9de8be4600c3394d94c3918faf67157b76b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "json-schema/json-schema-test-suite": "1.2.0", + "phpdocumentor/phpdocumentor": "~2", + "phpunit/phpunit": "^4.8.22" + }, + "time": "2016-08-26 12:45:49", + "bin": [ + "bin/validate-json" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bruno Prieto Reis", + "email": "[email protected]" + }, + { + "name": "Justin Rainbow", + "email": "[email protected]" + }, + { + "name": "Igor Wiedler", + "email": "[email protected]" + }, + { + "name": "Robert Schönthal", + "email": "[email protected]" + } + ], + "description": "A library to validate a json schema.", + "homepage": "https://github.com/justinrainbow/json-schema", + "keywords": [ + "json", + "schema" + ] } ] diff --git a/justinrainbow/json-schema/composer.json b/justinrainbow/json-schema/composer.json index a6d7b42..537faa7 100644 --- a/justinrainbow/json-schema/composer.json +++ b/justinrainbow/json-schema/composer.json @@ -52,7 +52,7 @@ "bin": ["bin/validate-json"], "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } } } diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php b/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php index bb12ece..83355c5 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php +++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php @@ -23,7 +23,7 @@ * @var SchemaStorage */ protected $schemaStorage; - + /** * @var UriRetriever $uriRetriever */ @@ -57,6 +57,11 @@ ); /** + * @var array<ConstraintInterface> + */ + private $instanceCache = array(); + + /** * @param SchemaStorage $schemaStorage * @param UriRetrieverInterface $uriRetriever * @param int $checkMode @@ -78,7 +83,7 @@ { return $this->uriRetriever; } - + public function getSchemaStorage() { return $this->schemaStorage; @@ -124,12 +129,15 @@ public function createInstanceFor($constraintName) { if (array_key_exists($constraintName, $this->constraintMap)) { - return new $this->constraintMap[$constraintName]( - $this->checkMode, - $this->schemaStorage, - $this->uriRetriever, - $this - ); + if (!isset($this->instanceCache[$constraintName])) { + $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]( + $this->checkMode, + $this->schemaStorage, + $this->uriRetriever, + $this + ); + } + return clone $this->instanceCache[$constraintName]; } throw new InvalidArgumentException('Unknown constraint ' . $constraintName); } diff --git a/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php b/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php index 5a12b87..df8d808 100644 --- a/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php +++ b/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php @@ -105,11 +105,6 @@ $this->addError($path, "The presence of the property " . $i . " requires that " . $require . " also be present", 'requires'); } - if (!$definition) { - // normal property verification - $this->checkUndefined($value, new \stdClass(), $path, $i); - } - $property = $this->getProperty($element, $i, new UndefinedConstraint()); if (is_object($property)) { $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path); @@ -129,7 +124,11 @@ foreach ($objectDefinition as $i => $value) { $property = $this->getProperty($element, $i, $this->getFactory()->createInstanceFor('undefined')); $definition = $this->getProperty($objectDefinition, $i); - $this->checkUndefined($property, $definition, $path, $i); + + if (is_object($definition)) { + // Undefined constraint will check for is_object() and quit if is not - so why pass it? + $this->checkUndefined($property, $definition, $path, $i); + } } } -- To view, visit https://gerrit.wikimedia.org/r/313662 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I61fda77bda1b747f81103ca0747d00f2458fe526 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/vendor Gerrit-Branch: master Gerrit-Owner: Reedy <[email protected]> Gerrit-Reviewer: Legoktm <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
