all jspg tests now passing
This commit is contained in:
75
tests/fixtures/allOf.json
vendored
75
tests/fixtures/allOf.json
vendored
@ -392,81 +392,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "allOf combined with anyOf, oneOf",
|
||||
"database": {
|
||||
"schemas": [
|
||||
{
|
||||
"allOf": [
|
||||
{
|
||||
"multipleOf": 2
|
||||
}
|
||||
],
|
||||
"anyOf": [
|
||||
{
|
||||
"multipleOf": 3
|
||||
}
|
||||
],
|
||||
"oneOf": [
|
||||
{
|
||||
"multipleOf": 5
|
||||
}
|
||||
],
|
||||
"$id": "allOf_11_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "allOf: false, anyOf: false, oneOf: false",
|
||||
"data": 1,
|
||||
"valid": false,
|
||||
"schema_id": "allOf_11_0"
|
||||
},
|
||||
{
|
||||
"description": "allOf: false, anyOf: false, oneOf: true",
|
||||
"data": 5,
|
||||
"valid": false,
|
||||
"schema_id": "allOf_11_0"
|
||||
},
|
||||
{
|
||||
"description": "allOf: false, anyOf: true, oneOf: false",
|
||||
"data": 3,
|
||||
"valid": false,
|
||||
"schema_id": "allOf_11_0"
|
||||
},
|
||||
{
|
||||
"description": "allOf: false, anyOf: true, oneOf: true",
|
||||
"data": 15,
|
||||
"valid": false,
|
||||
"schema_id": "allOf_11_0"
|
||||
},
|
||||
{
|
||||
"description": "allOf: true, anyOf: false, oneOf: false",
|
||||
"data": 2,
|
||||
"valid": false,
|
||||
"schema_id": "allOf_11_0"
|
||||
},
|
||||
{
|
||||
"description": "allOf: true, anyOf: false, oneOf: true",
|
||||
"data": 10,
|
||||
"valid": false,
|
||||
"schema_id": "allOf_11_0"
|
||||
},
|
||||
{
|
||||
"description": "allOf: true, anyOf: true, oneOf: false",
|
||||
"data": 6,
|
||||
"valid": false,
|
||||
"schema_id": "allOf_11_0"
|
||||
},
|
||||
{
|
||||
"description": "allOf: true, anyOf: true, oneOf: true",
|
||||
"data": 30,
|
||||
"valid": true,
|
||||
"schema_id": "allOf_11_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "extensible: true allows extra properties in allOf",
|
||||
"database": {
|
||||
|
||||
356
tests/fixtures/anyOf.json
vendored
356
tests/fixtures/anyOf.json
vendored
@ -1,356 +0,0 @@
|
||||
[
|
||||
{
|
||||
"description": "anyOf",
|
||||
"database": {
|
||||
"schemas": [
|
||||
{
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"minimum": 2
|
||||
}
|
||||
],
|
||||
"$id": "anyOf_0_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "first anyOf valid",
|
||||
"data": 1,
|
||||
"valid": true,
|
||||
"schema_id": "anyOf_0_0"
|
||||
},
|
||||
{
|
||||
"description": "second anyOf valid",
|
||||
"data": 2.5,
|
||||
"valid": true,
|
||||
"schema_id": "anyOf_0_0"
|
||||
},
|
||||
{
|
||||
"description": "both anyOf valid",
|
||||
"data": 3,
|
||||
"valid": true,
|
||||
"schema_id": "anyOf_0_0"
|
||||
},
|
||||
{
|
||||
"description": "neither anyOf valid",
|
||||
"data": 1.5,
|
||||
"valid": false,
|
||||
"schema_id": "anyOf_0_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "anyOf with base schema",
|
||||
"database": {
|
||||
"schemas": [
|
||||
{
|
||||
"type": "string",
|
||||
"anyOf": [
|
||||
{
|
||||
"maxLength": 2
|
||||
},
|
||||
{
|
||||
"minLength": 4
|
||||
}
|
||||
],
|
||||
"$id": "anyOf_1_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "mismatch base schema",
|
||||
"data": 3,
|
||||
"valid": false,
|
||||
"schema_id": "anyOf_1_0"
|
||||
},
|
||||
{
|
||||
"description": "one anyOf valid",
|
||||
"data": "foobar",
|
||||
"valid": true,
|
||||
"schema_id": "anyOf_1_0"
|
||||
},
|
||||
{
|
||||
"description": "both anyOf invalid",
|
||||
"data": "foo",
|
||||
"valid": false,
|
||||
"schema_id": "anyOf_1_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "anyOf with boolean schemas, all true",
|
||||
"database": {
|
||||
"schemas": [
|
||||
{
|
||||
"anyOf": [
|
||||
true,
|
||||
true
|
||||
],
|
||||
"$id": "anyOf_2_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "any value is valid",
|
||||
"data": "foo",
|
||||
"valid": true,
|
||||
"schema_id": "anyOf_2_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "anyOf with boolean schemas, some true",
|
||||
"database": {
|
||||
"schemas": [
|
||||
{
|
||||
"anyOf": [
|
||||
true,
|
||||
false
|
||||
],
|
||||
"$id": "anyOf_3_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "any value is valid",
|
||||
"data": "foo",
|
||||
"valid": true,
|
||||
"schema_id": "anyOf_3_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "anyOf with boolean schemas, all false",
|
||||
"database": {
|
||||
"schemas": [
|
||||
{
|
||||
"anyOf": [
|
||||
false,
|
||||
false
|
||||
],
|
||||
"$id": "anyOf_4_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "any value is invalid",
|
||||
"data": "foo",
|
||||
"valid": false,
|
||||
"schema_id": "anyOf_4_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "anyOf complex types",
|
||||
"database": {
|
||||
"schemas": [
|
||||
{
|
||||
"anyOf": [
|
||||
{
|
||||
"properties": {
|
||||
"bar": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"bar"
|
||||
]
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"foo": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"foo"
|
||||
]
|
||||
}
|
||||
],
|
||||
"$id": "anyOf_5_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "first anyOf valid (complex)",
|
||||
"data": {
|
||||
"bar": 2
|
||||
},
|
||||
"valid": true,
|
||||
"schema_id": "anyOf_5_0"
|
||||
},
|
||||
{
|
||||
"description": "second anyOf valid (complex)",
|
||||
"data": {
|
||||
"foo": "baz"
|
||||
},
|
||||
"valid": true,
|
||||
"schema_id": "anyOf_5_0"
|
||||
},
|
||||
{
|
||||
"description": "both anyOf valid (complex)",
|
||||
"data": {
|
||||
"foo": "baz",
|
||||
"bar": 2
|
||||
},
|
||||
"valid": true,
|
||||
"schema_id": "anyOf_5_0"
|
||||
},
|
||||
{
|
||||
"description": "neither anyOf valid (complex)",
|
||||
"data": {
|
||||
"foo": 2,
|
||||
"bar": "quux"
|
||||
},
|
||||
"valid": false,
|
||||
"schema_id": "anyOf_5_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "anyOf with one empty schema",
|
||||
"database": {
|
||||
"schemas": [
|
||||
{
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{}
|
||||
],
|
||||
"$id": "anyOf_6_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "string is valid",
|
||||
"data": "foo",
|
||||
"valid": true,
|
||||
"schema_id": "anyOf_6_0"
|
||||
},
|
||||
{
|
||||
"description": "number is valid",
|
||||
"data": 123,
|
||||
"valid": true,
|
||||
"schema_id": "anyOf_6_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "nested anyOf, to check validation semantics",
|
||||
"database": {
|
||||
"schemas": [
|
||||
{
|
||||
"anyOf": [
|
||||
{
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"$id": "anyOf_7_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "null is valid",
|
||||
"data": null,
|
||||
"valid": true,
|
||||
"schema_id": "anyOf_7_0"
|
||||
},
|
||||
{
|
||||
"description": "anything non-null is invalid",
|
||||
"data": 123,
|
||||
"valid": false,
|
||||
"schema_id": "anyOf_7_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "extensible: true allows extra properties in anyOf",
|
||||
"database": {
|
||||
"schemas": [
|
||||
{
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"minimum": 2
|
||||
}
|
||||
],
|
||||
"extensible": true,
|
||||
"$id": "anyOf_8_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "extra property is valid",
|
||||
"data": {
|
||||
"foo": 1
|
||||
},
|
||||
"valid": true,
|
||||
"schema_id": "anyOf_8_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "strict by default with anyOf properties",
|
||||
"database": {
|
||||
"schemas": [
|
||||
{
|
||||
"anyOf": [
|
||||
{
|
||||
"properties": {
|
||||
"foo": {
|
||||
"const": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"bar": {
|
||||
"const": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"$id": "anyOf_9_0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "valid match (foo)",
|
||||
"data": {
|
||||
"foo": 1
|
||||
},
|
||||
"valid": true,
|
||||
"schema_id": "anyOf_9_0"
|
||||
},
|
||||
{
|
||||
"description": "fails on extra property z explicitly",
|
||||
"data": {
|
||||
"foo": 1,
|
||||
"z": 3
|
||||
},
|
||||
"valid": false,
|
||||
"schema_id": "anyOf_9_0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
30
tests/fixtures/families.json
vendored
30
tests/fixtures/families.json
vendored
@ -5,8 +5,10 @@
|
||||
"types": [
|
||||
{
|
||||
"name": "entity",
|
||||
"hierarchy": [
|
||||
"entity"
|
||||
"variations": [
|
||||
"entity",
|
||||
"organization",
|
||||
"person"
|
||||
],
|
||||
"schemas": [
|
||||
{
|
||||
@ -22,16 +24,16 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"$id": "entity.light",
|
||||
"$id": "light.entity",
|
||||
"$ref": "entity"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "organization",
|
||||
"hierarchy": [
|
||||
"entity",
|
||||
"organization"
|
||||
"variations": [
|
||||
"organization",
|
||||
"person"
|
||||
],
|
||||
"schemas": [
|
||||
{
|
||||
@ -47,9 +49,7 @@
|
||||
},
|
||||
{
|
||||
"name": "person",
|
||||
"hierarchy": [
|
||||
"entity",
|
||||
"organization",
|
||||
"variations": [
|
||||
"person"
|
||||
],
|
||||
"schemas": [
|
||||
@ -63,8 +63,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"$id": "person.light",
|
||||
"$ref": "entity.light"
|
||||
"$id": "light.person",
|
||||
"$ref": "light.entity"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -84,7 +84,7 @@
|
||||
"schemas": [
|
||||
{
|
||||
"$id": "get_light_entities.response",
|
||||
"$family": "entity.light"
|
||||
"$family": "light.entity"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -112,7 +112,7 @@
|
||||
"valid": true
|
||||
},
|
||||
{
|
||||
"description": "Graph family matches entity.light",
|
||||
"description": "Graph family matches light.entity",
|
||||
"schema_id": "get_light_entities.response",
|
||||
"data": {
|
||||
"id": "3",
|
||||
@ -121,7 +121,7 @@
|
||||
"valid": true
|
||||
},
|
||||
{
|
||||
"description": "Graph family matches person.light (because it $refs entity.light)",
|
||||
"description": "Graph family matches light.person (because it $refs light.entity)",
|
||||
"schema_id": "get_light_entities.response",
|
||||
"data": {
|
||||
"id": "4",
|
||||
@ -130,7 +130,7 @@
|
||||
"valid": true
|
||||
},
|
||||
{
|
||||
"description": "Graph family excludes organization (missing .light schema that $refs entity.light)",
|
||||
"description": "Graph family excludes organization (missing light. schema that $refs light.entity)",
|
||||
"schema_id": "get_light_entities.response",
|
||||
"data": {
|
||||
"id": "5",
|
||||
|
||||
29
tests/fixtures/ref.json
vendored
29
tests/fixtures/ref.json
vendored
@ -500,8 +500,10 @@
|
||||
"types": [
|
||||
{
|
||||
"name": "entity",
|
||||
"hierarchy": [
|
||||
"entity"
|
||||
"variations": [
|
||||
"entity",
|
||||
"organization",
|
||||
"person"
|
||||
],
|
||||
"schemas": [
|
||||
{
|
||||
@ -520,9 +522,9 @@
|
||||
},
|
||||
{
|
||||
"name": "organization",
|
||||
"hierarchy": [
|
||||
"entity",
|
||||
"organization"
|
||||
"variations": [
|
||||
"organization",
|
||||
"person"
|
||||
],
|
||||
"schemas": [
|
||||
{
|
||||
@ -538,9 +540,7 @@
|
||||
},
|
||||
{
|
||||
"name": "person",
|
||||
"hierarchy": [
|
||||
"entity",
|
||||
"organization",
|
||||
"variations": [
|
||||
"person"
|
||||
],
|
||||
"schemas": [
|
||||
@ -612,8 +612,9 @@
|
||||
"types": [
|
||||
{
|
||||
"name": "entity",
|
||||
"hierarchy": [
|
||||
"entity"
|
||||
"variations": [
|
||||
"entity",
|
||||
"person"
|
||||
],
|
||||
"schemas": [
|
||||
{
|
||||
@ -632,8 +633,7 @@
|
||||
},
|
||||
{
|
||||
"name": "person",
|
||||
"hierarchy": [
|
||||
"entity",
|
||||
"variations": [
|
||||
"person"
|
||||
],
|
||||
"schemas": [
|
||||
@ -647,9 +647,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"$id": "person.light",
|
||||
"$id": "light.person",
|
||||
"$ref": "entity",
|
||||
"extensible": false,
|
||||
"properties": {
|
||||
"first_name": {
|
||||
"type": "string"
|
||||
@ -665,7 +664,7 @@
|
||||
"schemas": [
|
||||
{
|
||||
"$id": "save_person_light.request",
|
||||
"$ref": "person.light",
|
||||
"$ref": "light.person",
|
||||
"properties": {
|
||||
"extra_request_field": {
|
||||
"type": "string"
|
||||
|
||||
Reference in New Issue
Block a user