jspg progress

This commit is contained in:
2026-02-17 21:46:10 -05:00
parent 32ed463df8
commit 623c34c0bc
20 changed files with 3566 additions and 1094 deletions

View File

@ -1,6 +1,6 @@
[
{
"description": "single dependency",
"description": "single dependency (STRICT)",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
@ -61,14 +61,19 @@
"valid": false
},
{
"description": "ignores arrays",
"description": "ignores arrays (invalid in strict mode)",
"data": [
"bar"
],
"valid": true
"valid": false,
"expect_errors": [
{
"code": "STRICT_ITEM_VIOLATION"
}
]
},
{
"description": "ignores strings",
"description": "ignores strings (invalid in strict mode - wait, strings are scalars, strict only checks obj/arr)",
"data": "foobar",
"valid": true
},
@ -79,6 +84,38 @@
}
]
},
{
"description": "single dependency (EXTENSIBLE)",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"foo": true,
"bar": true
},
"dependentSchemas": {
"bar": {
"properties": {
"foo": {
"type": "integer"
},
"bar": {
"type": "integer"
}
}
}
},
"extensible": true
},
"tests": [
{
"description": "ignores arrays (valid in extensible mode)",
"data": [
"bar"
],
"valid": true
}
]
},
{
"description": "boolean subschemas",
"schema": {
@ -135,7 +172,8 @@
},
"dependentSchemas": {
"foo\tbar": {
"minProperties": 4
"minProperties": 4,
"extensible": true
},
"foo'bar": {
"required": [
@ -182,7 +220,7 @@
]
},
{
"description": "dependent subschema incompatible with root",
"description": "dependent subschema incompatible with root (STRICT)",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
@ -193,8 +231,7 @@
"foo": {
"properties": {
"bar": {}
},
"additionalProperties": false
}
}
}
},
@ -207,11 +244,16 @@
"valid": false
},
{
"description": "matches dependency",
"description": "matches dependency (invalid in strict mode - bar not allowed if foo missing)",
"data": {
"bar": 1
},
"valid": true
"valid": false,
"expect_errors": [
{
"code": "STRICT_PROPERTY_VIOLATION"
}
]
},
{
"description": "matches both",
@ -229,5 +271,33 @@
"valid": true
}
]
},
{
"description": "dependent subschema incompatible with root (EXTENSIBLE)",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"foo": {},
"baz": true
},
"dependentSchemas": {
"foo": {
"properties": {
"bar": {}
},
"additionalProperties": false
}
},
"extensible": true
},
"tests": [
{
"description": "matches dependency (valid in extensible mode)",
"data": {
"bar": 1
},
"valid": true
}
]
}
]

View File

@ -641,8 +641,25 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "http://localhost:1234/draft2020-12/strict-tree.json",
"$dynamicAnchor": "node",
"$ref": "tree.json",
"unevaluatedProperties": false
"$ref": "#/$defs/tree",
"$defs": {
"tree": {
"description": "tree schema, extensible",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "http://localhost:1234/draft2020-12/tree.json",
"$dynamicAnchor": "node",
"type": "object",
"properties": {
"data": true,
"children": {
"type": "array",
"items": {
"$dynamicRef": "#node"
}
}
}
}
}
},
"tests": [
{
@ -674,7 +691,7 @@
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "http://localhost:1234/draft2020-12/strict-extendible.json",
"$ref": "extendible-dynamic-ref.json",
"$ref": "#/$defs/remote_extendible",
"$defs": {
"elements": {
"$dynamicAnchor": "elements",
@ -683,8 +700,29 @@
},
"required": [
"a"
]
},
"remote_extendible": {
"description": "extendible array",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "http://localhost:1234/draft2020-12/extendible-dynamic-ref.json",
"type": "object",
"properties": {
"elements": {
"type": "array",
"items": {
"$dynamicRef": "#elements"
}
}
},
"required": [
"elements"
],
"additionalProperties": false
"$defs": {
"elements": {
"$dynamicAnchor": "elements"
}
}
}
}
},
@ -725,9 +763,33 @@
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "http://localhost:1234/draft2020-12/strict-extendible-allof-defs-first.json",
"$defs": {
"remote_extendible": {
"description": "extendible array",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "http://localhost:1234/draft2020-12/extendible-dynamic-ref.json",
"type": "object",
"properties": {
"elements": {
"type": "array",
"items": {
"$dynamicRef": "#elements"
}
}
},
"required": [
"elements"
],
"$defs": {
"elements": {
"$dynamicAnchor": "elements"
}
}
}
},
"allOf": [
{
"$ref": "extendible-dynamic-ref.json"
"$ref": "#/$defs/remote_extendible"
},
{
"$defs": {
@ -782,6 +844,30 @@
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "http://localhost:1234/draft2020-12/strict-extendible-allof-ref-first.json",
"$defs": {
"remote_extendible": {
"description": "extendible array",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "http://localhost:1234/draft2020-12/extendible-dynamic-ref.json",
"type": "object",
"properties": {
"elements": {
"type": "array",
"items": {
"$dynamicRef": "#elements"
}
}
},
"required": [
"elements"
],
"$defs": {
"elements": {
"$dynamicAnchor": "elements"
}
}
}
},
"allOf": [
{
"$defs": {
@ -798,7 +884,7 @@
}
},
{
"$ref": "extendible-dynamic-ref.json"
"$ref": "#/$defs/remote_extendible"
}
]
},
@ -837,7 +923,22 @@
{
"description": "$ref to $dynamicRef finds detached $dynamicAnchor",
"schema": {
"$ref": "http://localhost:1234/draft2020-12/detached-dynamicref.json#/$defs/foo"
"$ref": "http://localhost:1234/draft2020-12/detached-dynamicref.json#/$defs/foo",
"$defs": {
"remote_detached": {
"$id": "http://localhost:1234/draft2020-12/detached-dynamicref.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"foo": {
"$dynamicRef": "#detached"
},
"detached": {
"$dynamicAnchor": "detached",
"type": "integer"
}
}
}
}
},
"tests": [
{

View File

@ -976,6 +976,51 @@
}
}
]
},
{
"name": "organization",
"hierarchy": [
"entity",
"organization"
],
"schemas": [
{
"$id": "organization",
"$ref": "entity",
"properties": {
"type": {
"const": "organization",
"override": true
},
"name": {
"type": "string"
}
}
}
]
},
{
"name": "person",
"hierarchy": [
"entity",
"organization",
"person"
],
"schemas": [
{
"$id": "person",
"$ref": "organization",
"properties": {
"type": {
"const": "person",
"override": true
},
"first_name": {
"type": "string"
}
}
}
]
}
],
"puncs": [

View File

@ -585,7 +585,7 @@
},
"bar": "a"
},
"valid": false
"valid": true
}
]
},
@ -676,7 +676,7 @@
},
"bar": "a"
},
"valid": false
"valid": true
}
]
},
@ -1479,12 +1479,12 @@
"valid": false
},
{
"description": "parent max age (20) is inherited (not masked)",
"description": "parent max age (20) is shadowed (replaced) by child definition",
"data": {
"type": "child",
"age": 21
},
"valid": false
"valid": true
}
]
}