浏览代码

Workaround for json schema bug, fixes #2726

Jordi Boggiano 11 年之前
父节点
当前提交
41afc8324e
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/Composer/Json/JsonFile.php

+ 3 - 1
src/Composer/Json/JsonFile.php

@@ -13,6 +13,7 @@
 namespace Composer\Json;
 namespace Composer\Json;
 
 
 use JsonSchema\Validator;
 use JsonSchema\Validator;
+use JsonSchema\Uri\UriRetriever;
 use Seld\JsonLint\JsonParser;
 use Seld\JsonLint\JsonParser;
 use Seld\JsonLint\ParsingException;
 use Seld\JsonLint\ParsingException;
 use Composer\Util\RemoteFilesystem;
 use Composer\Util\RemoteFilesystem;
@@ -153,7 +154,8 @@ class JsonFile
         $schemaData = json_decode(file_get_contents($schemaFile));
         $schemaData = json_decode(file_get_contents($schemaFile));
 
 
         if ($schema === self::LAX_SCHEMA) {
         if ($schema === self::LAX_SCHEMA) {
-            $schemaData->additionalProperties = true;
+            // TODO this should just be set to true, but this is a workaround for https://github.com/justinrainbow/json-schema/pull/94
+            $schemaData->additionalProperties = (object) array('type' => array('object', 'string', 'array', 'number', 'null', 'boolean'));
             $schemaData->properties->name->required = false;
             $schemaData->properties->name->required = false;
             $schemaData->properties->description->required = false;
             $schemaData->properties->description->required = false;
         }
         }