Skip to content

Commit 1d7a05b

Browse files
committed
feat: tighten up schema
- Tighten up schema - Add tests to validate tigher schema Signed-off-by: Michael Dawson <[email protected]>
1 parent 4326205 commit 1d7a05b

File tree

9 files changed

+84
-1
lines changed

9 files changed

+84
-1
lines changed

schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
}]
3535
},
3636
"backing": { "$ref": "#SupportBacking" }
37-
}
37+
},
38+
"additionalProperties": false
3839
},
3940

4041
"SemVerRange": {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
validate
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Error in support JSON
2+
ADDTIONAL PROPERTY should NOT have additional properties
3+
4+
> 1 | {"versions":[{"version":"*","target":{"node":"supported"},"response":{"type":"best-effort"},"Xbacking":{"hobby":"https://github.com/pkgjs/support"}}]}
5+
| ^^^^^^^^^^ 😲 Xbacking is not expected to be here!
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"versions": [
3+
{
4+
"version": "*",
5+
"target": {
6+
"node": "supported"
7+
},
8+
"response": {
9+
"type": "best-effort"
10+
},
11+
"Xbacking": {
12+
"hobby": "https://github.com/pkgjs/support"
13+
}
14+
}
15+
]
16+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "@pkgjs/support-show-local",
3+
"version": "0.0.1",
4+
"support": true,
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/pkgjs/support.git"
8+
}
9+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
validate
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Error in support JSON
2+
TYPE should be array
3+
4+
> 1 | {"versions":[{"version":"*","target":{"node":"supported"},"response":{"type":"Xbest-effort"},"backing":{"hobby":"https://github.com/pkgjs/support"}}]}
5+
| ^^^^^^^^^^^^^^^^^^^^^^^ 👈🏽 type should be array
6+
7+
ONEOF should match exactly one schema in oneOf
8+
9+
> 1 | {"versions":[{"version":"*","target":{"node":"supported"},"response":{"type":"Xbest-effort"},"backing":{"hobby":"https://github.com/pkgjs/support"}}]}
10+
| ^^^^^^^^^^^^^^^^^^^^^^^ 👈🏽 oneOf should match exactly one schema in oneOf
11+
12+
ENUM should be equal to one of the allowed values
13+
14+
> 1 | {"versions":[{"version":"*","target":{"node":"supported"},"response":{"type":"Xbest-effort"},"backing":{"hobby":"https://github.com/pkgjs/support"}}]}
15+
| ^^^^^^^^^^^^^^ 👈🏽 enum should be equal to one of the allowed values
16+
17+
PATTERN should match pattern "regular-[1-7]"
18+
19+
> 1 | {"versions":[{"version":"*","target":{"node":"supported"},"response":{"type":"Xbest-effort"},"backing":{"hobby":"https://github.com/pkgjs/support"}}]}
20+
| ^^^^^^^^^^^^^^ 👈🏽 pattern should match pattern "regular-[1-7]"
21+
22+
ONEOF should match exactly one schema in oneOf
23+
24+
> 1 | {"versions":[{"version":"*","target":{"node":"supported"},"response":{"type":"Xbest-effort"},"backing":{"hobby":"https://github.com/pkgjs/support"}}]}
25+
| ^^^^^^^^^^^^^^ 👈🏽 oneOf should match exactly one schema in oneOf
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"versions": [
3+
{
4+
"version": "*",
5+
"target": {
6+
"node": "supported"
7+
},
8+
"response": {
9+
"type": "Xbest-effort"
10+
},
11+
"backing": {
12+
"hobby": "https://github.com/pkgjs/support"
13+
}
14+
}
15+
]
16+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "@pkgjs/support-show-local",
3+
"version": "0.0.1",
4+
"support": true,
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/pkgjs/support.git"
8+
}
9+
}

0 commit comments

Comments
 (0)