Skip to content

Commit 8300b12

Browse files
authored
feat: support booleanish schemas & represent additional{Items,Properties} (#31)
BREAKING CHANGE: additionalProperties/additionalItems keywords are now processed as schemas BREAKING CHANGE: true/false schemas are now represented
1 parent 44abda7 commit 8300b12

28 files changed

+317
-59
lines changed

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module.exports = {
22
rootDir: process.cwd(),
33
testEnvironment: 'node',
4+
roots: ['<rootDir>/src'],
45
setupFilesAfterEnv: ['./setupTests.ts'],
56
testMatch: ['<rootDir>/src/**/__tests__/*.(ts|js)?(x)'],
67
transform: {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "array",
3+
"additionalItems": {}
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "array",
3+
"additionalItems": false
4+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"type": "array",
3+
"additionalItems": {
4+
"type": "object",
5+
"properties": {
6+
"baz": {
7+
"type": "number"
8+
}
9+
}
10+
}
11+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "array",
3+
"additionalItems": true
4+
}

src/__tests__/__fixtures__/arrays/with-multiple-arrayish-items.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
"type": "string"
1818
}
1919
},
20-
"required": [
21-
"code",
22-
"msg"
23-
]
20+
"required": ["code", "msg"]
2421
}
2522
]
2623
}

src/__tests__/__fixtures__/arrays/with-single-arrayish-items.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
"type": "string"
1515
}
1616
},
17-
"required": [
18-
"code",
19-
"msg"
20-
]
17+
"required": ["code", "msg"]
2118
}
2219
]
2320
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "object",
3+
"additionalProperties": {}
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "object",
3+
"additionalProperties": false
4+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"type": "object",
3+
"additionalProperties": {
4+
"type": "object",
5+
"properties": {
6+
"baz": {
7+
"type": "number"
8+
}
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)