Skip to content

Commit 57617f2

Browse files
authored
Merge pull request json-schema-org#726 from Era-cell/main
adding specification enhancement for additionalProperties 2020-12
2 parents 604f5f9 + 51fc69c commit 57617f2

File tree

2 files changed

+71
-2
lines changed

2 files changed

+71
-2
lines changed

test-schema.json

+63
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,69 @@
2727
"type": "array",
2828
"items": { "$ref": "#/$defs/test" },
2929
"minItems": 1
30+
},
31+
"specification":{
32+
"description": "A reference to a specification document which defines the behavior tested by this test case. Typically this should be a JSON Schema specification document, though in cases where the JSON Schema specification points to another RFC it should contain *both* the portion of the JSON Schema specification which indicates what RFC (and section) to follow as *well* as information on where in that specification the behavior is specified.",
33+
34+
"type": "array",
35+
"minItems": 1,
36+
"uniqueItems": true,
37+
"items":{
38+
"properties": {
39+
"core": {
40+
"description": "A section in official JSON Schema core drafts",
41+
"url": "https://json-schema.org/specification-links",
42+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
43+
"type":"string"
44+
},
45+
"validation": {
46+
"description": "A section in official JSON Schema validation drafts",
47+
"url": "https://json-schema.org/specification-links",
48+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
49+
"type":"string"
50+
},
51+
"ecma262": {
52+
"description": "A section in official ECMA 262 specification for defining regular expressions",
53+
"url": "https://262.ecma-international.org/",
54+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
55+
"type":"string"
56+
},
57+
"perl5": {
58+
"description": "A section name in Perl documentation for defining regular expressions",
59+
"url": "https://perldoc.perl.org/perlre",
60+
"type":"string"
61+
},
62+
"quote": {
63+
"description": "Quote describing the test case",
64+
"type":"string"
65+
}
66+
},
67+
"patternProperties": {
68+
"^rfc\\d+$": {
69+
"description": "A section in official RFC for the given rfc number",
70+
"url": "https://www.rfc-editor.org/",
71+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
72+
"type":"string"
73+
},
74+
"^iso\\d+$": {
75+
"description": "A section in official ISO for the given iso number",
76+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
77+
"type": "string"
78+
}
79+
},
80+
"additionalProperties": { "type": "string" },
81+
"minProperties": 1,
82+
"propertyNames": {
83+
"oneOf": [
84+
{
85+
"pattern": "^((iso)|(rfc))[0-9]+$"
86+
},
87+
{
88+
"enum": [ "core", "validation", "ecma262", "perl5", "quote" ]
89+
}
90+
]
91+
}
92+
}
3093
}
3194
},
3295
"additionalProperties": false

tests/draft2020-12/additionalProperties.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{
33
"description":
44
"additionalProperties being false does not allow other properties",
5+
"specification": [ { "core":"10.3.2.3", "quote": "The value of \"additionalProperties\" MUST be a valid JSON Schema. Boolean \"false\" forbids everything." } ],
56
"schema": {
67
"$schema": "https://json-schema.org/draft/2020-12/schema",
78
"properties": {"foo": {}, "bar": {}},
@@ -43,6 +44,7 @@
4344
},
4445
{
4546
"description": "non-ASCII pattern with additionalProperties",
47+
"specification": [ { "core":"10.3.2.3"} ],
4648
"schema": {
4749
"$schema": "https://json-schema.org/draft/2020-12/schema",
4850
"patternProperties": {"^á": {}},
@@ -63,6 +65,7 @@
6365
},
6466
{
6567
"description": "additionalProperties with schema",
68+
"specification": [ { "core":"10.3.2.3", "quote": "The value of \"additionalProperties\" MUST be a valid JSON Schema." } ],
6669
"schema": {
6770
"$schema": "https://json-schema.org/draft/2020-12/schema",
6871
"properties": {"foo": {}, "bar": {}},
@@ -87,8 +90,8 @@
8790
]
8891
},
8992
{
90-
"description":
91-
"additionalProperties can exist by itself",
93+
"description": "additionalProperties can exist by itself",
94+
"specification": [ { "core":"10.3.2.3", "quote": "With no other applicator applying to object instances. This validates all the instance values irrespective of their property names" } ],
9295
"schema": {
9396
"$schema": "https://json-schema.org/draft/2020-12/schema",
9497
"additionalProperties": {"type": "boolean"}
@@ -108,6 +111,7 @@
108111
},
109112
{
110113
"description": "additionalProperties are allowed by default",
114+
"specification": [ { "core":"10.3.2.3", "quote": "Omitting this keyword has the same assertion behavior as an empty schema." } ],
111115
"schema": {
112116
"$schema": "https://json-schema.org/draft/2020-12/schema",
113117
"properties": {"foo": {}, "bar": {}}
@@ -122,6 +126,7 @@
122126
},
123127
{
124128
"description": "additionalProperties does not look in applicators",
129+
"specification":[ { "core": "10.2", "quote": "Subschemas of applicator keywords evaluate the instance completely independently such that the results of one such subschema MUST NOT impact the results of sibling subschemas." } ],
125130
"schema": {
126131
"$schema": "https://json-schema.org/draft/2020-12/schema",
127132
"allOf": [
@@ -139,6 +144,7 @@
139144
},
140145
{
141146
"description": "additionalProperties with null valued instance properties",
147+
"specification": [ { "core":"10.3.2.3" } ],
142148
"schema": {
143149
"$schema": "https://json-schema.org/draft/2020-12/schema",
144150
"additionalProperties": {

0 commit comments

Comments
 (0)