Skip to content

Commit 8da7d9b

Browse files
committed
updated test suite
1 parent 972863c commit 8da7d9b

File tree

1 file changed

+176
-2
lines changed

1 file changed

+176
-2
lines changed

tests/Resources/json-schema-test-suite/tests/draft2020-12/dynamicRef.json

Lines changed: 176 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,14 @@
362362
"title": "any type of node",
363363
"$id": "anyLeafNode",
364364
"$dynamicAnchor": "foo",
365-
"$ref": "main#/$defs/inner"
365+
"$ref": "inner"
366366
},
367367
"else": {
368368
"title": "integer node",
369369
"$id": "integerNode",
370370
"$dynamicAnchor": "foo",
371371
"type": [ "object", "integer" ],
372-
"$ref": "main#/$defs/inner"
372+
"$ref": "inner"
373373
}
374374
},
375375
"tests": [
@@ -441,5 +441,179 @@
441441
"valid": true
442442
}
443443
]
444+
},
445+
{
446+
"description": "strict-tree schema, guards against misspelled properties",
447+
"schema": {
448+
"$id": "http://localhost:1234/strict-tree.json",
449+
"$dynamicAnchor": "node",
450+
451+
"$ref": "tree.json",
452+
"unevaluatedProperties": false
453+
},
454+
"tests": [
455+
{
456+
"description": "instance with misspelled field",
457+
"data": {
458+
"children": [{
459+
"daat": 1
460+
}]
461+
},
462+
"valid": false
463+
},
464+
{
465+
"description": "instance with correct field",
466+
"data": {
467+
"children": [{
468+
"data": 1
469+
}]
470+
},
471+
"valid": true
472+
}
473+
]
474+
},
475+
{
476+
"description": "tests for implementation dynamic anchor and reference link",
477+
"schema": {
478+
"$id": "http://localhost:1234/strict-extendible.json",
479+
"$ref": "extendible-dynamic-ref.json",
480+
"$defs": {
481+
"elements": {
482+
"$dynamicAnchor": "elements",
483+
"properties": {
484+
"a": true
485+
},
486+
"required": ["a"],
487+
"additionalProperties": false
488+
}
489+
}
490+
},
491+
"tests": [
492+
{
493+
"description": "incorrect parent schema",
494+
"data": {
495+
"a": true
496+
},
497+
"valid": false
498+
},
499+
{
500+
"description": "incorrect extended schema",
501+
"data": {
502+
"elements": [
503+
{ "b": 1 }
504+
]
505+
},
506+
"valid": false
507+
},
508+
{
509+
"description": "correct extended schema",
510+
"data": {
511+
"elements": [
512+
{ "a": 1 }
513+
]
514+
},
515+
"valid": true
516+
}
517+
]
518+
},
519+
{
520+
"description": "Tests for implementation dynamic anchor and reference link. Reference should be independent of any possible ordering.",
521+
"schema": {
522+
"$id": "http://localhost:1234/strict-extendible-allof-defs-first.json",
523+
"allOf": [
524+
{
525+
"$ref": "extendible-dynamic-ref.json"
526+
},
527+
{
528+
"$defs": {
529+
"elements": {
530+
"$dynamicAnchor": "elements",
531+
"properties": {
532+
"a": true
533+
},
534+
"required": ["a"],
535+
"additionalProperties": false
536+
}
537+
}
538+
}
539+
]
540+
},
541+
"tests": [
542+
{
543+
"description": "incorrect parent schema",
544+
"data": {
545+
"a": true
546+
},
547+
"valid": false
548+
},
549+
{
550+
"description": "incorrect extended schema",
551+
"data": {
552+
"elements": [
553+
{ "b": 1 }
554+
]
555+
},
556+
"valid": false
557+
},
558+
{
559+
"description": "correct extended schema",
560+
"data": {
561+
"elements": [
562+
{ "a": 1 }
563+
]
564+
},
565+
"valid": true
566+
}
567+
]
568+
},
569+
{
570+
"description": "Tests for implementation dynamic anchor and reference link. Reference should be independent of any possible ordering.",
571+
"schema": {
572+
"$id": "http://localhost:1234/strict-extendible-allof-ref-first.json",
573+
"allOf": [
574+
{
575+
"$defs": {
576+
"elements": {
577+
"$dynamicAnchor": "elements",
578+
"properties": {
579+
"a": true
580+
},
581+
"required": ["a"],
582+
"additionalProperties": false
583+
}
584+
}
585+
},
586+
{
587+
"$ref": "extendible-dynamic-ref.json"
588+
}
589+
]
590+
},
591+
"tests": [
592+
{
593+
"description": "incorrect parent schema",
594+
"data": {
595+
"a": true
596+
},
597+
"valid": false
598+
},
599+
{
600+
"description": "incorrect extended schema",
601+
"data": {
602+
"elements": [
603+
{ "b": 1 }
604+
]
605+
},
606+
"valid": false
607+
},
608+
{
609+
"description": "correct extended schema",
610+
"data": {
611+
"elements": [
612+
{ "a": 1 }
613+
]
614+
},
615+
"valid": true
616+
}
617+
]
444618
}
445619
]

0 commit comments

Comments
 (0)