Skip to content

Commit 4f5fd13

Browse files
committed
doc: update samples
1 parent cd2e57f commit 4f5fd13

35 files changed

+2875
-230
lines changed

doc/samples/README.md

Lines changed: 58 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -18,59 +18,64 @@ Based on JSON Schema Test Suite for `draft2019-09`.
1818

1919
## Results
2020

21-
| Name | Total | Failed to compile | Warnings | Misclassified |
22-
|-------------------------------------------------------------------|-------|-------------------|----------|---------------|
23-
| [additionalItems](./additionalItems.md) | 8 | - | 3 | - |
24-
| [additionalProperties](./additionalProperties.md) | 6 | - | - | - |
25-
| [allOf](./allOf.md) | 12 | - | - | - |
26-
| [anchor](./anchor.md) | 5 | - | - | - |
27-
| [anyOf](./anyOf.md) | 8 | - | 3 | - |
28-
| [boolean_schema](./boolean_schema.md) | 2 | - | - | - |
29-
| [const](./const.md) | 15 | - | - | - |
30-
| [contains](./contains.md) | 6 | - | - | - |
31-
| [default](./default.md) | 3 | - | - | - |
32-
| [defs](./defs.md) | 1 | - | - | - |
33-
| [dependentRequired](./dependentRequired.md) | 4 | - | - | - |
34-
| [dependentSchemas](./dependentSchemas.md) | 3 | - | - | - |
35-
| [enum](./enum.md) | 10 | - | - | - |
36-
| [exclusiveMaximum](./exclusiveMaximum.md) | 1 | - | - | - |
37-
| [exclusiveMinimum](./exclusiveMinimum.md) | 1 | - | - | - |
38-
| [format](./format.md) | 19 | 4 | - | - |
39-
| [id](./id.md) | 4 | - | - | - |
40-
| [if-then-else](./if-then-else.md) | 10 | - | 6 | - |
41-
| [infinite-loop-detection](./infinite-loop-detection.md) | 1 | - | - | - |
42-
| [items](./items.md) | 7 | - | - | - |
43-
| [maxContains](./maxContains.md) | 3 | - | 1 | - |
44-
| [maxItems](./maxItems.md) | 1 | - | - | - |
45-
| [maxLength](./maxLength.md) | 1 | - | - | - |
46-
| [maxProperties](./maxProperties.md) | 2 | - | - | - |
47-
| [maximum](./maximum.md) | 2 | - | - | - |
48-
| [minContains](./minContains.md) | 7 | - | 2 | - |
49-
| [minItems](./minItems.md) | 1 | - | - | - |
50-
| [minLength](./minLength.md) | 1 | - | - | - |
51-
| [minProperties](./minProperties.md) | 1 | - | - | - |
52-
| [minimum](./minimum.md) | 2 | - | - | - |
53-
| [multipleOf](./multipleOf.md) | 4 | - | - | - |
54-
| [not](./not.md) | 6 | - | 1 | - |
55-
| [oneOf](./oneOf.md) | 11 | - | 3 | - |
56-
| [pattern](./pattern.md) | 2 | - | - | - |
57-
| [patternProperties](./patternProperties.md) | 4 | - | - | - |
58-
| [properties](./properties.md) | 4 | - | - | - |
59-
| [propertyNames](./propertyNames.md) | 4 | - | - | - |
60-
| [recursiveRef](./recursiveRef.md) | 9 | - | 4 | - |
61-
| [ref](./ref.md) | 18 | - | - | - |
62-
| [refRemote](./refRemote.md) | 8 | - | - | - |
63-
| [required](./required.md) | 4 | - | - | - |
64-
| [type](./type.md) | 11 | - | - | - |
65-
| [unevaluatedItems](./unevaluatedItems.md) | 17 | - | - | - |
66-
| [unevaluatedProperties](./unevaluatedProperties.md) | 32 | - | 3 | - |
67-
| [uniqueItems](./uniqueItems.md) | 6 | - | - | - |
68-
| [unknownKeyword](./unknownKeyword.md) | 1 | - | 1 | - |
69-
| [optional/bignum](./optional-bignum.md) | 7 | - | - | - |
70-
| [optional/ecmascript-regex](./optional-ecmascript-regex.md) | 20 | - | - | - |
71-
| [optional/float-overflow](./optional-float-overflow.md) | 1 | - | - | - |
72-
| [optional/non-bmp-regex](./optional-non-bmp-regex.md) | 2 | - | - | - |
73-
| [optional/refOfUnknownKeyword](./optional-refOfUnknownKeyword.md) | 2 | - | 2 | - |
21+
| Name | Total | Failed to compile | Warnings | Misclassified |
22+
|---------------------------------------------------------------------------------|-------|-------------------|----------|---------------|
23+
| [additionalItems](./additionalItems.md) | 9 | - | 4 | - |
24+
| [additionalProperties](./additionalProperties.md) | 7 | - | - | - |
25+
| [allOf](./allOf.md) | 12 | - | - | - |
26+
| [anchor](./anchor.md) | 7 | - | - | - |
27+
| [anyOf](./anyOf.md) | 8 | - | 3 | - |
28+
| [boolean_schema](./boolean_schema.md) | 2 | - | - | - |
29+
| [const](./const.md) | 15 | - | - | - |
30+
| [contains](./contains.md) | 7 | - | - | - |
31+
| [content](./content.md) | 4 | - | 4 | - |
32+
| [default](./default.md) | 3 | - | - | - |
33+
| [defs](./defs.md) | 1 | - | - | - |
34+
| [dependentRequired](./dependentRequired.md) | 4 | - | - | - |
35+
| [dependentSchemas](./dependentSchemas.md) | 3 | - | - | - |
36+
| [enum](./enum.md) | 10 | - | - | - |
37+
| [exclusiveMaximum](./exclusiveMaximum.md) | 1 | - | - | - |
38+
| [exclusiveMinimum](./exclusiveMinimum.md) | 1 | - | - | - |
39+
| [format](./format.md) | 19 | 4 | - | - |
40+
| [id](./id.md) | 5 | - | - | - |
41+
| [if-then-else](./if-then-else.md) | 10 | - | 6 | - |
42+
| [infinite-loop-detection](./infinite-loop-detection.md) | 1 | - | - | - |
43+
| [items](./items.md) | 9 | - | - | - |
44+
| [maxContains](./maxContains.md) | 4 | - | 1 | - |
45+
| [maxItems](./maxItems.md) | 2 | - | - | - |
46+
| [maxLength](./maxLength.md) | 2 | - | - | - |
47+
| [maxProperties](./maxProperties.md) | 3 | - | - | - |
48+
| [maximum](./maximum.md) | 2 | - | - | - |
49+
| [minContains](./minContains.md) | 8 | - | 2 | - |
50+
| [minItems](./minItems.md) | 2 | - | - | - |
51+
| [minLength](./minLength.md) | 2 | - | - | - |
52+
| [minProperties](./minProperties.md) | 2 | - | - | - |
53+
| [minimum](./minimum.md) | 2 | - | - | - |
54+
| [multipleOf](./multipleOf.md) | 4 | - | - | - |
55+
| [not](./not.md) | 6 | - | 1 | - |
56+
| [oneOf](./oneOf.md) | 11 | - | 3 | - |
57+
| [pattern](./pattern.md) | 2 | - | - | - |
58+
| [patternProperties](./patternProperties.md) | 5 | - | - | - |
59+
| [properties](./properties.md) | 6 | - | - | - |
60+
| [propertyNames](./propertyNames.md) | 4 | - | - | - |
61+
| [recursiveRef](./recursiveRef.md) | 9 | - | 4 | - |
62+
| [ref](./ref.md) | 29 | - | - | - |
63+
| [refRemote](./refRemote.md) | 13 | - | - | - |
64+
| [required](./required.md) | 5 | - | - | - |
65+
| [type](./type.md) | 11 | - | - | - |
66+
| [unevaluatedItems](./unevaluatedItems.md) | 20 | - | 1 | - |
67+
| [unevaluatedProperties](./unevaluatedProperties.md) | 34 | - | 3 | - |
68+
| [uniqueItems](./uniqueItems.md) | 6 | - | - | - |
69+
| [unknownKeyword](./unknownKeyword.md) | 1 | - | 1 | - |
70+
| [vocabulary](./vocabulary.md) | 1 | 1 | - | - |
71+
| [optional/bignum](./optional-bignum.md) | 7 | - | - | - |
72+
| [optional/cross-draft](./optional-cross-draft.md) | 2 | - | 1 | - |
73+
| [optional/dependencies-compatibility](./optional-dependencies-compatibility.md) | 7 | - | - | - |
74+
| [optional/ecmascript-regex](./optional-ecmascript-regex.md) | 20 | - | - | - |
75+
| [optional/float-overflow](./optional-float-overflow.md) | 1 | - | - | - |
76+
| [optional/no-schema](./optional-no-schema.md) | 1 | - | - | - |
77+
| [optional/non-bmp-regex](./optional-non-bmp-regex.md) | 2 | - | - | - |
78+
| [optional/refOfUnknownKeyword](./optional-refOfUnknownKeyword.md) | 2 | - | 2 | - |
7479

7580
### Notes
7681

doc/samples/additionalItems.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ return ref0
132132
* `[requireValidation] type should be specified at #`
133133

134134

135-
## additionalItems should not look in applicators, valid case
135+
## additionalItems does not look in applicators, valid case
136136

137137
### Schema
138138

@@ -164,7 +164,7 @@ return ref0
164164
* `Unprocessed keywords: ["additionalItems"] at #`
165165

166166

167-
## additionalItems should not look in applicators, invalid case
167+
## additionalItems does not look in applicators, invalid case
168168

169169
### Schema
170170

@@ -243,3 +243,26 @@ return ref0
243243

244244
* `[requireStringValidation] pattern, format or contentSchema should be specified for strings, use pattern: ^[\s\S]*$ to opt-out at #/0`
245245

246+
247+
## additionalItems with null instance elements
248+
249+
### Schema
250+
251+
```json
252+
{ "additionalItems": { "type": "null" } }
253+
```
254+
255+
### Code
256+
257+
```js
258+
'use strict'
259+
const ref0 = function validate(data) {
260+
return true
261+
};
262+
return ref0
263+
```
264+
265+
### Warnings
266+
267+
* `Unprocessed keywords: ["additionalItems"] at #`
268+

doc/samples/additionalProperties.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ return ref0
6060
* `Should start with ^ and end with $: "^á" at #`
6161

6262

63-
## additionalProperties allows a schema which should validate
63+
## additionalProperties with schema
6464

6565
### Schema
6666

@@ -144,7 +144,7 @@ return ref0
144144
* `[requireValidation] empty rules node is not allowed at #/properties/foo`
145145

146146

147-
## additionalProperties should not look in applicators
147+
## additionalProperties does not look in applicators
148148

149149
### Schema
150150

@@ -174,3 +174,31 @@ return ref0
174174

175175
* `[requireValidation] empty rules node is not allowed at #/allOf/0/properties/foo`
176176

177+
178+
## additionalProperties with null valued instance properties
179+
180+
### Schema
181+
182+
```json
183+
{ "additionalProperties": { "type": "null" } }
184+
```
185+
186+
### Code
187+
188+
```js
189+
'use strict'
190+
const ref0 = function validate(data) {
191+
if (typeof data === "object" && data && !Array.isArray(data)) {
192+
for (const key0 of Object.keys(data)) {
193+
if (!(data[key0] === null)) return false
194+
}
195+
}
196+
return true
197+
};
198+
return ref0
199+
```
200+
201+
##### Strong mode notices
202+
203+
* `[requireValidation] type should be specified at #`
204+

0 commit comments

Comments
 (0)