all jspg tests now passing

This commit is contained in:
2026-03-04 01:02:32 -05:00
parent e7f20e2cb6
commit 566b599512
32 changed files with 531 additions and 1068 deletions

View File

@ -282,66 +282,6 @@ fn test_const_17() {
util::run_test_file_at_index(&path, 17).unwrap();
}
#[test]
fn test_any_of_0() {
let path = format!("{}/tests/fixtures/anyOf.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 0).unwrap();
}
#[test]
fn test_any_of_1() {
let path = format!("{}/tests/fixtures/anyOf.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 1).unwrap();
}
#[test]
fn test_any_of_2() {
let path = format!("{}/tests/fixtures/anyOf.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 2).unwrap();
}
#[test]
fn test_any_of_3() {
let path = format!("{}/tests/fixtures/anyOf.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 3).unwrap();
}
#[test]
fn test_any_of_4() {
let path = format!("{}/tests/fixtures/anyOf.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 4).unwrap();
}
#[test]
fn test_any_of_5() {
let path = format!("{}/tests/fixtures/anyOf.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 5).unwrap();
}
#[test]
fn test_any_of_6() {
let path = format!("{}/tests/fixtures/anyOf.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 6).unwrap();
}
#[test]
fn test_any_of_7() {
let path = format!("{}/tests/fixtures/anyOf.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 7).unwrap();
}
#[test]
fn test_any_of_8() {
let path = format!("{}/tests/fixtures/anyOf.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 8).unwrap();
}
#[test]
fn test_any_of_9() {
let path = format!("{}/tests/fixtures/anyOf.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 9).unwrap();
}
#[test]
fn test_families_0() {
let path = format!("{}/tests/fixtures/families.json", env!("CARGO_MANIFEST_DIR"));
@ -1392,12 +1332,6 @@ fn test_all_of_14() {
util::run_test_file_at_index(&path, 14).unwrap();
}
#[test]
fn test_all_of_15() {
let path = format!("{}/tests/fixtures/allOf.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 15).unwrap();
}
#[test]
fn test_format_0() {
let path = format!("{}/tests/fixtures/format.json", env!("CARGO_MANIFEST_DIR"));

View File

@ -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": {

View File

@ -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"
}
]
}
]

View File

@ -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",

View File

@ -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"