@@ -27,6 +27,22 @@ export type JSONSchema4TypeName =
27
27
*/
28
28
export type JSONSchema4Type = boolean | number | string | null ;
29
29
30
+ export type JSONSchema4TypeExtended =
31
+ | JSONSchema4Type
32
+ | JSONSchema4Array
33
+ | JSONSchema4Object ;
34
+
35
+ // Workaround for infinite type recursion
36
+ // eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
37
+ export interface JSONSchema4Object {
38
+ [ key : string ] : JSONSchema4TypeExtended ;
39
+ }
40
+
41
+ // Workaround for infinite type recursion
42
+ // https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
43
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
44
+ export interface JSONSchema4Array extends Array < JSONSchema4TypeExtended > { }
45
+
30
46
/**
31
47
* Meta schema
32
48
*
@@ -51,7 +67,7 @@ export type JSONSchema4 =
51
67
| JSONSchema4AnyOfSchema
52
68
| JSONSchema4AnySchema
53
69
| JSONSchema4ArraySchema
54
- | JSONSchema4BoleanSchema
70
+ | JSONSchema4BooleanSchema
55
71
| JSONSchema4MultiSchema
56
72
| JSONSchema4NullSchema
57
73
| JSONSchema4NumberSchema
@@ -133,7 +149,7 @@ interface JSONSchema4Base {
133
149
/**
134
150
* The default value for the item if not present
135
151
*/
136
- default ?: JSONSchema4Type | undefined ;
152
+ default ?: JSONSchema4TypeExtended | undefined ;
137
153
138
154
/**
139
155
* This attribute indicates if the instance must have a value, and not
@@ -187,7 +203,7 @@ export interface JSONSchema4MultiSchema
187
203
Omit < JSONSchema4ArraySchema , 'enum' | 'type' > ,
188
204
Omit < JSONSchema4StringSchema , 'enum' | 'type' > ,
189
205
Omit < JSONSchema4NumberSchema , 'enum' | 'type' > ,
190
- Omit < JSONSchema4BoleanSchema , 'enum' | 'type' > ,
206
+ Omit < JSONSchema4BooleanSchema , 'enum' | 'type' > ,
191
207
Omit < JSONSchema4NullSchema , 'enum' | 'type' > ,
192
208
Omit < JSONSchema4AnySchema , 'enum' | 'type' > {
193
209
type : JSONSchema4TypeName [ ] ;
@@ -440,7 +456,7 @@ export interface JSONSchema4NumberSchema extends JSONSchema4Base {
440
456
/**
441
457
* @see https://json-schema.org/understanding-json-schema/reference/boolean.html
442
458
*/
443
- export interface JSONSchema4BoleanSchema extends JSONSchema4Base {
459
+ export interface JSONSchema4BooleanSchema extends JSONSchema4Base {
444
460
type : 'boolean' ;
445
461
446
462
/**
0 commit comments