302 lines
7.0 KiB
JSON
302 lines
7.0 KiB
JSON
[
|
|
{
|
|
"description": "sibling property has id (#170)",
|
|
"schemas": [
|
|
{
|
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
"id": "http://example.com/base_object_1",
|
|
"type": "object",
|
|
"properties": {
|
|
"title": {
|
|
"id": "http://example.com/title",
|
|
"type": "string"
|
|
},
|
|
"file": { "$ref": "#/definitions/file-entry" }
|
|
},
|
|
"definitions": {
|
|
"file-entry": { "type": "string" }
|
|
}
|
|
},
|
|
{
|
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
"$id": "http://example.com/base_object_2",
|
|
"type": "object",
|
|
"properties": {
|
|
"title": {
|
|
"$id": "http://example.com/title",
|
|
"type": "string"
|
|
},
|
|
"file": { "$ref": "#/definitions/file-entry" }
|
|
},
|
|
"definitions": {
|
|
"file-entry": { "type": "string" }
|
|
}
|
|
}
|
|
],
|
|
"tests": [
|
|
{
|
|
"description": "valid object",
|
|
"data": {
|
|
"title": "foo",
|
|
"file": "bar"
|
|
},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "invalid object",
|
|
"data": {
|
|
"title": "foo",
|
|
"file": 2
|
|
},
|
|
"valid": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "sibling item has id",
|
|
"schemas": [
|
|
{
|
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
"id": "http://example.com/base_array_1",
|
|
"type": "array",
|
|
"items": [
|
|
{
|
|
"id": "http://example.com/0",
|
|
"type": "string"
|
|
},
|
|
{ "$ref": "#/definitions/file-entry" }
|
|
],
|
|
"definitions": {
|
|
"file-entry": { "type": "string" }
|
|
}
|
|
},
|
|
{
|
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
"$id": "http://example.com/base_array_2",
|
|
"type": "array",
|
|
"items": [
|
|
{
|
|
"$id": "http://example.com/0",
|
|
"type": "string"
|
|
},
|
|
{ "$ref": "#/definitions/file-entry" }
|
|
],
|
|
"definitions": {
|
|
"file-entry": { "type": "string" }
|
|
}
|
|
}
|
|
],
|
|
"tests": [
|
|
{
|
|
"description": "valid array",
|
|
"data": [ "foo", "bar" ],
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "invalid array",
|
|
"data": [ "foo", 2 ],
|
|
"valid": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "sibling schema in anyOf has id",
|
|
"schemas": [
|
|
{
|
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
"id": "http://example.com/base_anyof_1",
|
|
"anyOf": [
|
|
{
|
|
"id": "http://example.com/0",
|
|
"type": "number"
|
|
},
|
|
{ "$ref": "#/definitions/def" }
|
|
],
|
|
"definitions": {
|
|
"def": { "type": "string" }
|
|
}
|
|
},
|
|
{
|
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
"$id": "http://example.com/base_anyof_2",
|
|
"anyOf": [
|
|
{
|
|
"$id": "http://example.com/0",
|
|
"type": "number"
|
|
},
|
|
{ "$ref": "#/definitions/def" }
|
|
],
|
|
"definitions": {
|
|
"def": { "type": "string" }
|
|
}
|
|
}
|
|
],
|
|
"tests": [
|
|
{
|
|
"description": "valid string",
|
|
"data": "foo",
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "valid number",
|
|
"data": 1,
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "invalid object",
|
|
"data": {},
|
|
"valid": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "sibling schema in oneOf has id",
|
|
"schemas": [
|
|
{
|
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
"id": "http://example.com/base_oneof_1",
|
|
"oneOf": [
|
|
{
|
|
"id": "http://example.com/0",
|
|
"type": "number"
|
|
},
|
|
{ "$ref": "#/definitions/def" }
|
|
],
|
|
"definitions": {
|
|
"def": { "type": "string" }
|
|
}
|
|
},
|
|
{
|
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
"$id": "http://example.com/base_oneof_2",
|
|
"oneOf": [
|
|
{
|
|
"$id": "http://example.com/0",
|
|
"type": "number"
|
|
},
|
|
{ "$ref": "#/definitions/def" }
|
|
],
|
|
"definitions": {
|
|
"def": { "type": "string" }
|
|
}
|
|
}
|
|
],
|
|
"tests": [
|
|
{
|
|
"description": "valid string",
|
|
"data": "foo",
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "valid number",
|
|
"data": 1,
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "invalid object",
|
|
"data": {},
|
|
"valid": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "sibling schema in allOf has id",
|
|
"schemas": [
|
|
{
|
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
"id": "http://example.com/base_allof_1",
|
|
"allOf": [
|
|
{
|
|
"id": "http://example.com/0",
|
|
"type": "string",
|
|
"maxLength": 3
|
|
},
|
|
{ "$ref": "#/definitions/def" }
|
|
],
|
|
"definitions": {
|
|
"def": { "type": "string" }
|
|
}
|
|
},
|
|
{
|
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
"$id": "http://example.com/base_allof_2",
|
|
"allOf": [
|
|
{
|
|
"$id": "http://example.com/0",
|
|
"type": "string",
|
|
"maxLength": 3
|
|
},
|
|
{ "$ref": "#/definitions/def" }
|
|
],
|
|
"definitions": {
|
|
"def": { "type": "string" }
|
|
}
|
|
}
|
|
],
|
|
"tests": [
|
|
{
|
|
"description": "valid string",
|
|
"data": "foo",
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "invalid string",
|
|
"data": "quux",
|
|
"valid": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "sibling schema in dependencies has id",
|
|
"schemas": [
|
|
{
|
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
"id": "http://example.com/base_dependencies_1",
|
|
"type": "object",
|
|
"dependencies": {
|
|
"foo": {
|
|
"id": "http://example.com/foo",
|
|
"required": [ "bar" ]
|
|
},
|
|
"bar": { "$ref": "#/definitions/def" }
|
|
},
|
|
"definitions": {
|
|
"def": { "required": [ "baz" ] }
|
|
}
|
|
},
|
|
{
|
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
"$id": "http://example.com/base_dependencies_2",
|
|
"type": "object",
|
|
"dependencies": {
|
|
"foo": {
|
|
"$id": "http://example.com/foo",
|
|
"required": [ "bar" ]
|
|
},
|
|
"bar": { "$ref": "#/definitions/def" }
|
|
},
|
|
"definitions": {
|
|
"def": { "required": [ "baz" ] }
|
|
}
|
|
}
|
|
],
|
|
"tests": [
|
|
{
|
|
"description": "valid object",
|
|
"data": { "foo": 1, "bar": 2, "baz": 3 },
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "invalid object 2",
|
|
"data": { "foo": 1 },
|
|
"valid": false
|
|
},
|
|
{
|
|
"description": "invalid object 2",
|
|
"data": { "foo": 1, "bar": 2 },
|
|
"valid": false
|
|
}
|
|
]
|
|
}
|
|
]
|