test: change test schemas to draft-07

master
Evgeny Poberezkin 2017-12-02 18:31:03 +00:00
parent d25f31b1bb
commit 41074e8e6a
22 changed files with 126 additions and 167 deletions

View File

@ -1,4 +1,4 @@
{
"id": "http://localhost:1234/bar.json",
"$id": "http://localhost:1234/bar.json",
"type": "string"
}

View File

@ -1,5 +1,5 @@
{
"id": "http://localhost:1234/buu.json",
"$id": "http://localhost:1234/buu.json",
"definitions": {
"buu": {
"type": "object",

View File

@ -1,4 +1,4 @@
{
"id": "http://localhost:1234/first.json",
"$id": "http://localhost:1234/first.json",
"type": "string"
}

View File

@ -1,5 +1,5 @@
{
"id": "http://localhost:1234/foo.json",
"$id": "http://localhost:1234/foo.json",
"type": "object",
"properties": {
"bar": { "$ref": "bar.json" }

View File

@ -1,5 +1,5 @@
{
"id": "http://localhost:1234/node.json",
"$id": "http://localhost:1234/node.json",
"description": "node",
"type": "object",
"properties": {

View File

@ -1,8 +1,8 @@
{
"id": "http://localhost:1234/scope_change.json",
"$id": "http://localhost:1234/scope_change.json",
"definitions": {
"foo": {
"id": "http://localhost:1234/scope_foo.json",
"$id": "http://localhost:1234/scope_foo.json",
"definitions": {
"bar": {
"type": "string"
@ -10,7 +10,7 @@
}
},
"baz": {
"id": "folder/",
"$id": "folder/",
"type": "array",
"items": { "$ref": "folderInteger.json" },
"bar": {

View File

@ -1,5 +1,5 @@
{
"id": "http://localhost:1234/second.json",
"$id": "http://localhost:1234/second.json",
"type": "object",
"properties": {
"first": { "$ref": "first.json" }

View File

@ -1,5 +1,5 @@
{
"id": "http://localhost:1234/tree.json",
"$id": "http://localhost:1234/tree.json",
"description": "tree of nodes",
"type": "object",
"properties": {

View File

@ -6,7 +6,7 @@ var jsonSchemaTest = require('json-schema-test')
, suite = require('./browser_test_suite')
, after = require('./after_test');
var instances = getAjvInstances(options, {schemaId: 'auto', unknownFormats: ['allowedUnknown']});
var instances = getAjvInstances(options, {unknownFormats: ['allowedUnknown']});
var remoteRefs = {
'http://localhost:1234/integer.json': require('./JSON-Schema-Test-Suite/remotes/integer.json'),
@ -36,9 +36,7 @@ jsonSchemaTest(instances, {
? suite(require('./tests/{**/,}*.json', {mode: 'list'}))
: './tests/{**/,}*.json'
},
only: [
// 'schemas/complex', 'schemas/basic', 'schemas/advanced',
],
only: [],
assert: require('./chai').assert,
afterError: after.error,
afterEach: after.each,
@ -48,7 +46,6 @@ jsonSchemaTest(instances, {
function addRemoteRefs(ajv) {
ajv.addMetaSchema(require('../lib/refs/json-schema-draft-04.json'));
for (var id in remoteRefs) ajv.addSchema(remoteRefs[id], id);
ajv.addSchema(remoteRefsWithIds);
}

View File

@ -1,22 +1,13 @@
[
{
"description": "root ref in remote ref (#13)",
"schemas": [
{
"id": "http://localhost:1234/issue13_1",
"type": "object",
"properties": {
"name": { "$ref": "name.json#/definitions/orNull" }
}
},
{
"$id": "http://localhost:1234/issue13_2",
"type": "object",
"properties": {
"name": { "$ref": "name.json#/definitions/orNull" }
}
"schema": {
"$id": "http://localhost:1234/issue13",
"type": "object",
"properties": {
"name": { "$ref": "name.json#/definitions/orNull" }
}
],
},
"tests": [
{
"description": "string is valid",

View File

@ -1,18 +1,11 @@
[
{
"description": "ref in remote ref with ids",
"schemas": [
{
"id": "http://localhost:1234/issue14a_1.json",
"type": "array",
"items": { "$ref": "foo.json" }
},
{
"$id": "http://localhost:1234/issue14a_2.json",
"type": "array",
"items": { "$ref": "foo.json" }
}
],
"schema": {
"$id": "http://localhost:1234/issue14a.json",
"type": "array",
"items": { "$ref": "foo.json" }
},
"tests": [
{
"description": "string is valid",
@ -36,18 +29,11 @@
},
{
"description": "remote ref in definitions in remote ref with ids (#14)",
"schemas": [
{
"id": "http://localhost:1234/issue14b_1.json",
"type": "array",
"items": { "$ref": "buu.json#/definitions/buu" }
},
{
"$id": "http://localhost:1234/issue14b_2.json",
"type": "array",
"items": { "$ref": "buu.json#/definitions/buu" }
}
],
"schema": {
"$id": "http://localhost:1234/issue14b.json",
"type": "array",
"items": { "$ref": "buu.json#/definitions/buu" }
},
"tests": [
{
"description": "string is valid",

View File

@ -3,12 +3,12 @@
"description": "sibling property has id (#170)",
"schemas": [
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://example.com/base_object_1",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/base_object_1",
"type": "object",
"properties": {
"title": {
"id": "http://example.com/title",
"$id": "http://example.com/title",
"type": "string"
},
"file": { "$ref": "#/definitions/file-entry" }
@ -56,12 +56,12 @@
"description": "sibling item has id",
"schemas": [
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://example.com/base_array_1",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/base_array_1",
"type": "array",
"items": [
{
"id": "http://example.com/0",
"$id": "http://example.com/0",
"type": "string"
},
{ "$ref": "#/definitions/file-entry" }
@ -103,11 +103,11 @@
"description": "sibling schema in anyOf has id",
"schemas": [
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://example.com/base_anyof_1",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/base_anyof_1",
"anyOf": [
{
"id": "http://example.com/0",
"$id": "http://example.com/0",
"type": "number"
},
{ "$ref": "#/definitions/def" }
@ -153,11 +153,11 @@
"description": "sibling schema in oneOf has id",
"schemas": [
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://example.com/base_oneof_1",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/base_oneof_1",
"oneOf": [
{
"id": "http://example.com/0",
"$id": "http://example.com/0",
"type": "number"
},
{ "$ref": "#/definitions/def" }
@ -203,11 +203,11 @@
"description": "sibling schema in allOf has id",
"schemas": [
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://example.com/base_allof_1",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/base_allof_1",
"allOf": [
{
"id": "http://example.com/0",
"$id": "http://example.com/0",
"type": "string",
"maxLength": 3
},
@ -250,12 +250,12 @@
"description": "sibling schema in dependencies has id",
"schemas": [
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://example.com/base_dependencies_1",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/base_dependencies_1",
"type": "object",
"dependencies": {
"foo": {
"id": "http://example.com/foo",
"$id": "http://example.com/foo",
"required": [ "bar" ]
},
"bar": { "$ref": "#/definitions/def" }

View File

@ -5,7 +5,7 @@
{
"definitions": {
"int": {
"id": "#int",
"$id": "#int",
"type": "integer"
}
},
@ -30,10 +30,10 @@
"description": "IDs in refs with root id",
"schemas": [
{
"id": "http://example.com/int_1.json",
"$id": "http://example.com/int_1.json",
"definitions": {
"int": {
"id": "#int",
"$id": "#int",
"type": "integer"
}
},

View File

@ -3,7 +3,7 @@
"description": "JSON Schema for a standard RAML object (#27)",
"schema": {
"title": "A JSON Schema for a standard RAML object",
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": [
"title"

View File

@ -3,12 +3,12 @@
"description": "Recursive reference (#27)",
"schemas": [
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "testrec_1",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "testrec_1",
"type": "object",
"properties": {
"layout": {
"id": "layout",
"$id": "layout",
"type": "object",
"properties": {
"layout": { "type": "string" },

View File

@ -1,20 +1,12 @@
[
{
"description": "id property in referenced schema in object that is not a schema (#63)",
"schemas": [
{
"type" : "object",
"properties": {
"title": { "$ref": "http://json-schema.org/draft-04/schema#/properties/title" }
}
},
{
"type" : "object",
"properties": {
"title": { "$ref": "http://json-schema.org/draft-07/schema#/properties/title" }
}
"schema": {
"type" : "object",
"properties": {
"title": { "$ref": "http://json-schema.org/draft-07/schema#/properties/title" }
}
],
},
"tests": [
{
"description": "empty object is valid",

View File

@ -2,7 +2,7 @@
{
"description": "hash ref inside hash ref in remote ref (#70, was passing)",
"schema": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
"$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeIntegerDefault0"
},
"tests": [
{ "data": 1, "valid": true, "description": "positive integer is valid" },
@ -12,16 +12,10 @@
},
{
"description": "hash ref inside hash ref in remote ref with id (#70, was passing)",
"schemas": [
{
"id": "http://example.com/my_schema_1.json",
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
},
{
"$id": "http://example.com/my_schema_2.json",
"$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeIntegerDefault0"
}
],
"schema": {
"$id": "http://example.com/my_schema_2.json",
"$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeIntegerDefault0"
},
"tests": [
{ "data": 1, "valid": true, "description": "positive integer is valid" },
{ "data": 0, "valid": true, "description": "zero is valid" },
@ -32,7 +26,7 @@
"description": "local hash ref with remote hash ref without inner hash ref (#70, was passing)",
"schema": {
"definitions": {
"a": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" }
"a": { "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeIntegerDefault0" }
},
"properties": {
"b": { "$ref": "#/definitions/a" }
@ -48,7 +42,7 @@
"description": "local hash ref with remote hash ref that has inner hash ref (#70)",
"schema": {
"definitions": {
"a": { "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" }
"a": { "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeIntegerDefault0" }
},
"properties": {
"b": { "$ref": "#/definitions/a" }

View File

@ -3,8 +3,8 @@
"description": "Swagger api schema does not compile (#70)",
"schema": {
"title": "A JSON Schema for Swagger 2.0 API.",
"id": "http://swagger.io/v2/schema.json#",
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "http://swagger.io/v2/schema.json#",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": [
"swagger",
@ -935,58 +935,58 @@
"type": "string"
},
"title": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/title"
"$ref": "http://json-schema.org/draft-07/schema#/properties/title"
},
"description": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/description"
"$ref": "http://json-schema.org/draft-07/schema#/properties/description"
},
"default": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/default"
"$ref": "http://json-schema.org/draft-07/schema#/properties/default"
},
"multipleOf": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
"$ref": "http://json-schema.org/draft-07/schema#/properties/multipleOf"
},
"maximum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
"$ref": "http://json-schema.org/draft-07/schema#/properties/maximum"
},
"exclusiveMaximum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
"$ref": "http://json-schema.org/draft-07/schema#/properties/exclusiveMaximum"
},
"minimum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
"$ref": "http://json-schema.org/draft-07/schema#/properties/minimum"
},
"exclusiveMinimum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
"$ref": "http://json-schema.org/draft-07/schema#/properties/exclusiveMinimum"
},
"maxLength": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
"$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger"
},
"minLength": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
"$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeIntegerDefault0"
},
"pattern": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
"$ref": "http://json-schema.org/draft-07/schema#/properties/pattern"
},
"maxItems": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
"$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger"
},
"minItems": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
"$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeIntegerDefault0"
},
"uniqueItems": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
"$ref": "http://json-schema.org/draft-07/schema#/properties/uniqueItems"
},
"maxProperties": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
"$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger"
},
"minProperties": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
"$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeIntegerDefault0"
},
"required": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
"$ref": "http://json-schema.org/draft-07/schema#/definitions/stringArray"
},
"enum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
"$ref": "http://json-schema.org/draft-07/schema#/properties/enum"
},
"additionalProperties": {
"anyOf": [
@ -1000,7 +1000,7 @@
"default": {}
},
"type": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/type"
"$ref": "http://json-schema.org/draft-07/schema#/properties/type"
},
"items": {
"anyOf": [
@ -1064,16 +1064,16 @@
"type": "string"
},
"title": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/title"
"$ref": "http://json-schema.org/draft-07/schema#/properties/title"
},
"description": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/description"
"$ref": "http://json-schema.org/draft-07/schema#/properties/description"
},
"default": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/default"
"$ref": "http://json-schema.org/draft-07/schema#/properties/default"
},
"required": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
"$ref": "http://json-schema.org/draft-07/schema#/definitions/stringArray"
},
"type": {
"type": "string",
@ -1534,49 +1534,49 @@
"default": "csv"
},
"title": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/title"
"$ref": "http://json-schema.org/draft-07/schema#/properties/title"
},
"description": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/description"
"$ref": "http://json-schema.org/draft-07/schema#/properties/description"
},
"default": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/default"
"$ref": "http://json-schema.org/draft-07/schema#/properties/default"
},
"multipleOf": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
"$ref": "http://json-schema.org/draft-07/schema#/properties/multipleOf"
},
"maximum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
"$ref": "http://json-schema.org/draft-07/schema#/properties/maximum"
},
"exclusiveMaximum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
"$ref": "http://json-schema.org/draft-07/schema#/properties/exclusiveMaximum"
},
"minimum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
"$ref": "http://json-schema.org/draft-07/schema#/properties/minimum"
},
"exclusiveMinimum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
"$ref": "http://json-schema.org/draft-07/schema#/properties/exclusiveMinimum"
},
"maxLength": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
"$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger"
},
"minLength": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
"$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeIntegerDefault0"
},
"pattern": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
"$ref": "http://json-schema.org/draft-07/schema#/properties/pattern"
},
"maxItems": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
"$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger"
},
"minItems": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
"$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeIntegerDefault0"
},
"uniqueItems": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
"$ref": "http://json-schema.org/draft-07/schema#/properties/uniqueItems"
},
"enum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
"$ref": "http://json-schema.org/draft-07/schema#/properties/enum"
},
"jsonReference": {
"type": "object",

View File

@ -2,7 +2,7 @@
{
"description": "advanced schema from z-schema benchmark (https://github.com/zaggino/z-schema)",
"schema": {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"/": { "$ref": "#/definitions/entry" }
@ -14,7 +14,7 @@
"required": [ "/" ],
"definitions": {
"entry": {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "schema for an fstab entry",
"type": "object",
"required": [ "storage" ],

View File

@ -2,7 +2,7 @@
{
"description": "basic schema from z-schema benchmark (https://github.com/zaggino/z-schema)",
"schema": {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Product set",
"type": "array",
"items": {
@ -18,8 +18,7 @@
},
"price": {
"type": "number",
"minimum": 0,
"exclusiveMinimum": true
"exclusiveMinimum": 0
},
"tags": {
"type": "array",

View File

@ -7,17 +7,17 @@
"minItems": 1,
"definitions": {
"base58": {
"id": "#base58",
"$id": "#base58",
"type": "string",
"pattern": "^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+$"
},
"hex": {
"id": "#hex",
"$id": "#hex",
"type": "string",
"pattern": "^[0123456789A-Fa-f]+$"
},
"tx_id": {
"id": "#tx_id",
"$id": "#tx_id",
"allOf": [
{ "$ref": "#hex" },
{
@ -27,7 +27,7 @@
]
},
"address": {
"id": "#address",
"$id": "#address",
"allOf": [
{ "$ref": "#base58" },
{
@ -37,7 +37,7 @@
]
},
"signature": {
"id": "#signature",
"$id": "#signature",
"allOf": [
{ "$ref": "#hex" },
{
@ -47,7 +47,7 @@
]
},
"transaction": {
"id": "#transaction",
"$id": "#transaction",
"additionalProperties": false,
"required": [
"metadata",
@ -108,7 +108,7 @@
}
},
"input": {
"id": "#input",
"$id": "#input",
"type": "object",
"additionalProperties": false,
"required": [
@ -134,7 +134,7 @@
}
},
"output": {
"id": "#output",
"$id": "#output",
"type": "object",
"additionalProperties": false,
"required": [

View File

@ -2,23 +2,23 @@
{
"description": "complex schema from jsck benchmark (https://github.com/pandastrike/jsck)",
"schema": {
"id": "http://example.com/complex3.json",
"$id": "http://example.com/complex3.json",
"type": "array",
"items": { "$ref": "#transaction" },
"minItems": 1,
"definitions": {
"base58": {
"id": "#base58",
"$id": "#base58",
"type": "string",
"pattern": "^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+$"
},
"hex": {
"id": "#hex",
"$id": "#hex",
"type": "string",
"pattern": "^[0123456789A-Fa-f]+$"
},
"tx_id": {
"id": "#tx_id",
"$id": "#tx_id",
"allOf": [
{ "$ref": "#hex" },
{
@ -28,7 +28,7 @@
]
},
"address": {
"id": "#address",
"$id": "#address",
"allOf": [
{ "$ref": "#base58" },
{
@ -38,7 +38,7 @@
]
},
"signature": {
"id": "#signature",
"$id": "#signature",
"allOf": [
{ "$ref": "#hex" },
{
@ -48,7 +48,7 @@
]
},
"transaction": {
"id": "#transaction",
"$id": "#transaction",
"additionalProperties": false,
"required": [
"metadata",
@ -109,7 +109,7 @@
}
},
"input": {
"id": "#input",
"$id": "#input",
"type": "object",
"additionalProperties": false,
"required": [
@ -135,7 +135,7 @@
}
},
"output": {
"id": "#output",
"$id": "#output",
"type": "object",
"additionalProperties": false,
"required": [