Fix JSON schema decode error

This commit is contained in:
Thibaud Fabre
2016-05-17 23:17:10 +02:00
parent 0be170e3f6
commit d924a8aad5
4 changed files with 51 additions and 35 deletions

View File

@@ -66,7 +66,7 @@
"ircmaxell/random-lib": "~1.0", "ircmaxell/random-lib": "~1.0",
"jms/serializer": "~0.10", "jms/serializer": "~0.10",
"jms/translation-bundle": "dev-rebase-2015-10-20", "jms/translation-bundle": "dev-rebase-2015-10-20",
"justinrainbow/json-schema": "~1.3", "justinrainbow/json-schema": "2.0.3 as 1.6.1",
"league/flysystem": "^1.0", "league/flysystem": "^1.0",
"league/flysystem-aws-s3-v2": "^1.0", "league/flysystem-aws-s3-v2": "^1.0",
"media-alchemyst/media-alchemyst": "^0.5", "media-alchemyst/media-alchemyst": "^0.5",

75
composer.lock generated
View File

@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "8db2333764b17b4b04f474a6b9fc2c49", "hash": "c98d08093630862a0d52ee8602c6e6a9",
"content-hash": "2961cef34c7a94f9afb11b859781cb65", "content-hash": "1269d6d77008c7eb964b2e9c76d02b4f",
"packages": [ "packages": [
{ {
"name": "alchemy-fr/tcpdf-clone", "name": "alchemy-fr/tcpdf-clone",
@@ -15,6 +15,12 @@
"url": "https://github.com/alchemy-fr/tcpdf-clone.git", "url": "https://github.com/alchemy-fr/tcpdf-clone.git",
"reference": "2ba0248a7187f1626df6c128750650416267f0e7" "reference": "2ba0248a7187f1626df6c128750650416267f0e7"
}, },
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/tcpdf-clone/zipball/2ba0248a7187f1626df6c128750650416267f0e7",
"reference": "2ba0248a7187f1626df6c128750650416267f0e7",
"shasum": ""
},
"require": { "require": {
"php": ">=5.3.0" "php": ">=5.3.0"
}, },
@@ -61,6 +67,10 @@
"qrcode", "qrcode",
"tcpdf" "tcpdf"
], ],
"support": {
"source": "https://github.com/alchemy-fr/tcpdf-clone/tree/6.0.039",
"issues": "https://github.com/alchemy-fr/tcpdf-clone/issues"
},
"time": "2013-10-13 16:11:17" "time": "2013-10-13 16:11:17"
}, },
{ {
@@ -583,7 +593,7 @@
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/task-manager/zipball/cefd59cad3ac9b26243f551e704e7142fca79522", "url": "https://api.github.com/repos/alchemy-fr/task-manager/zipball/2b199e842551a1137640c822f433751a9f402099",
"reference": "cefd59cad3ac9b26243f551e704e7142fca79522", "reference": "cefd59cad3ac9b26243f551e704e7142fca79522",
"shasum": "" "shasum": ""
}, },
@@ -1785,12 +1795,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/igorw/evenement.git", "url": "https://github.com/igorw/evenement.git",
"reference": "v1.0.0" "reference": "fa966683e7df3e5dd5929d984a44abfbd6bafe8d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/igorw/evenement/zipball/v1.0.0", "url": "https://api.github.com/repos/igorw/evenement/zipball/fa966683e7df3e5dd5929d984a44abfbd6bafe8d",
"reference": "v1.0.0", "reference": "fa966683e7df3e5dd5929d984a44abfbd6bafe8d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1817,7 +1827,7 @@
"keywords": [ "keywords": [
"event-dispatcher" "event-dispatcher"
], ],
"time": "2012-05-30 08:01:08" "time": "2012-05-30 15:01:08"
}, },
{ {
"name": "facebook/php-sdk", "name": "facebook/php-sdk",
@@ -1863,7 +1873,6 @@
"facebook", "facebook",
"sdk" "sdk"
], ],
"abandoned": "facebook/php-sdk-v4",
"time": "2013-11-19 23:11:14" "time": "2013-11-19 23:11:14"
}, },
{ {
@@ -2709,7 +2718,7 @@
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/hoaproject/Stream/zipball/011ab91d942f1d7096deade4c8a10fe57d51c5b3", "url": "https://api.github.com/repos/hoaproject/Stream/zipball/3bc446bc00849bf51166adc415d77aa375d48d8c",
"reference": "011ab91d942f1d7096deade4c8a10fe57d51c5b3", "reference": "011ab91d942f1d7096deade4c8a10fe57d51c5b3",
"shasum": "" "shasum": ""
}, },
@@ -3347,25 +3356,25 @@
}, },
{ {
"name": "justinrainbow/json-schema", "name": "justinrainbow/json-schema",
"version": "v1.6.0", "version": "dev-master",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/justinrainbow/json-schema.git", "url": "https://github.com/justinrainbow/json-schema.git",
"reference": "f9e27c3e202faf14fd581ef41355d83bb4b7eb7d" "reference": "6dad7bf4a76954a4798197810d6425ec0b145fa3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/f9e27c3e202faf14fd581ef41355d83bb4b7eb7d", "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/6dad7bf4a76954a4798197810d6425ec0b145fa3",
"reference": "f9e27c3e202faf14fd581ef41355d83bb4b7eb7d", "reference": "6dad7bf4a76954a4798197810d6425ec0b145fa3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.2" "php": ">=5.3.3"
}, },
"require-dev": { "require-dev": {
"json-schema/json-schema-test-suite": "1.1.0", "json-schema/json-schema-test-suite": "1.2.0",
"phpdocumentor/phpdocumentor": "~2", "phpdocumentor/phpdocumentor": "~2",
"phpunit/phpunit": "~3.7" "phpunit/phpunit": "^4.8.22"
}, },
"bin": [ "bin": [
"bin/validate-json" "bin/validate-json"
@@ -3373,7 +3382,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.4.x-dev" "dev-master": "2.0.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -3383,7 +3392,7 @@
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"BSD-3-Clause" "MIT"
], ],
"authors": [ "authors": [
{ {
@@ -3409,7 +3418,7 @@
"json", "json",
"schema" "schema"
], ],
"time": "2016-01-06 14:37:04" "time": "2016-05-11 21:39:50"
}, },
{ {
"name": "league/flysystem", "name": "league/flysystem",
@@ -3786,7 +3795,7 @@
], ],
"authors": [ "authors": [
{ {
"name": "Stephen Clay", "name": "Steve Clay",
"email": "steve@mrclay.org", "email": "steve@mrclay.org",
"homepage": "http://www.mrclay.org/", "homepage": "http://www.mrclay.org/",
"role": "Developer" "role": "Developer"
@@ -3972,21 +3981,21 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/romainneutron/Imagine-Silex-Service-Provider.git", "url": "https://github.com/romainneutron/Imagine-Silex-Service-Provider.git",
"reference": "0.1.2" "reference": "a8a7862ae90419f2b23746cd8436c2310e4eb084"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/romainneutron/Imagine-Silex-Service-Provider/zipball/0.1.2", "url": "https://api.github.com/repos/romainneutron/Imagine-Silex-Service-Provider/zipball/a8a7862ae90419f2b23746cd8436c2310e4eb084",
"reference": "0.1.2", "reference": "a8a7862ae90419f2b23746cd8436c2310e4eb084",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"imagine/imagine": "*", "imagine/imagine": "*",
"php": ">=5.3.3", "php": ">=5.3.3",
"silex/silex": ">=1.0,<2.0" "silex/silex": "~1.0"
}, },
"require-dev": { "require-dev": {
"symfony/browser-kit": ">=2.0,<3.0" "symfony/browser-kit": "~2.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@@ -4603,7 +4612,9 @@
"authors": [ "authors": [
{ {
"name": "Fabien Potencier", "name": "Fabien Potencier",
"email": "fabien@symfony.com" "email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
} }
], ],
"description": "Pimple is a simple Dependency Injection Container for PHP 5.3", "description": "Pimple is a simple Dependency Injection Container for PHP 5.3",
@@ -5342,7 +5353,7 @@
}, },
{ {
"name": "Phraseanet Team", "name": "Phraseanet Team",
"email": "support@alchemy.fr", "email": "info@alchemy.fr",
"homepage": "http://www.phraseanet.com/" "homepage": "http://www.phraseanet.com/"
} }
], ],
@@ -7386,12 +7397,20 @@
"time": "2015-06-21 13:59:46" "time": "2015-06-21 13:59:46"
} }
], ],
"aliases": [], "aliases": [
{
"alias": "1.6.1",
"alias_normalized": "1.6.1.0",
"version": "9999999-dev",
"package": "justinrainbow/json-schema"
}
],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": { "stability-flags": {
"alchemy/task-manager": 20, "alchemy/task-manager": 20,
"imagine/imagine": 20, "imagine/imagine": 20,
"jms/translation-bundle": 20, "jms/translation-bundle": 20,
"justinrainbow/json-schema": 20,
"neutron/process-manager": 20, "neutron/process-manager": 20,
"roave/security-advisories": 20, "roave/security-advisories": 20,
"willdurand/negotiation": 15 "willdurand/negotiation": 15

View File

@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Core\Provider;
use Alchemy\Phrasea\Helper\JsonBodyHelper; use Alchemy\Phrasea\Helper\JsonBodyHelper;
use JsonSchema\RefResolver; use JsonSchema\RefResolver;
use JsonSchema\Uri\UriResolver;
use JsonSchema\Uri\UriRetriever; use JsonSchema\Uri\UriRetriever;
use JsonSchema\Validator; use JsonSchema\Validator;
use Silex\Application; use Silex\Application;
@@ -31,7 +32,7 @@ class JsonSchemaServiceProvider implements ServiceProviderInterface
}); });
$app['json-schema.ref_resolver'] = $app->share(function (Application $app) { $app['json-schema.ref_resolver'] = $app->share(function (Application $app) {
return new RefResolver($app['json-schema.retriever']); return new RefResolver($app['json-schema.retriever'], new UriResolver());
}); });
$app['json-schema.validator'] = $app->share(function (Application $app) { $app['json-schema.validator'] = $app->share(function (Application $app) {

View File

@@ -52,11 +52,7 @@ class JsonBodyHelper
*/ */
public function retrieveSchema($schemaUri) public function retrieveSchema($schemaUri)
{ {
$schema = $this->uriRetriever->retrieve($schemaUri, $this->baseUri); return $this->refResolver->resolve($this->baseUri . $schemaUri);
$this->refResolver->resolve($schema);
return $schema;
} }
/** /**