jsonlint模式不validation

我想了解一下json。 我使用npm安装了jsonlint。 我完全从本网站复制架构和文件。 他们如下:

test.json:

[ { "id": 2, "name": "An ice sculpture", "price": 12.50, "tags": ["cold", "ice"], "dimensions": { "length": 7.0, "width": 12.0, "height": 9.5 }, "warehouseLocation": { "latitude": -78.75, "longitude": 20.4 } }, { "id": 3, "name": "A blue mouse", "price": 25.50, "dimensions": { "length": 3.1, "width": 1.0, "height": 1.0 }, "warehouseLocation": { "latitude": 54.4, "longitude": -32.7 } } ] 

schema.json:

 { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Product set", "type": "array", "items": { "title": "Product", "type": "object", "properties": { "id": { "description": "The unique identifier for a product", "type": "number" }, "name": { "type": "string" }, "price": { "type": "number", "minimum": 0, "exclusiveMinimum": true }, "tags": { "type": "array", "items": { "type": "string" }, "minItems": 1, "uniqueItems": true }, "dimensions": { "type": "object", "properties": { "length": {"type": "number"}, "width": {"type": "number"}, "height": {"type": "number"} }, "required": ["length", "width", "height"] }, "warehouseLocation": { "description": "Coordinates of the warehouse with the product", "$ref": "http://json-schema.org/geo" } }, "required": ["id", "name", "price"] } } 

我有这两个文件保存在同一个目录中。 我input了以下命令。

 jsonlint test.json --validate schema.json 

并收到以下输出:

validation错误:

 Instance is not a required type uri: urn:uuid:67449791-6ef0-4a5f-8ee1-d9ae1c806249#/items schemaUri: http://json-schema.org/draft-03/hyper-schema#/properties/items attribute: type details: ["http://json-schema.org/draft-03/hyper-schema#","array"] 

当我input完全相同的代码到本网站的validation器中时,它已经检查出有效。

当我故意通过删除一个ID(这是必需的)我打破了我的JSON文件我收到完全相同的输出。

为什么会这样呢? 我该如何解决?

对于其中的一个依赖关系(JSV)来说,似乎是没有参考04版草案的问题

jsonlint目前无法针对草案-04架构进行validation。 您必须使用draft-03创build一个模式

看看这里的工具,validation草案04: http : //json-schema.org/implementations.html