@cleverbrush/schema 0.0.17 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +213 -163
  2. package/dist/builders/AliasSchemaBuilder.d.ts +14 -0
  3. package/dist/builders/AliasSchemaBuilder.js +91 -0
  4. package/dist/builders/ArraySchemaBuilder.d.ts +15 -0
  5. package/dist/builders/ArraySchemaBuilder.js +141 -0
  6. package/dist/builders/BooleanSchemaBuilder.d.ts +31 -0
  7. package/dist/builders/BooleanSchemaBuilder.js +90 -0
  8. package/dist/builders/FunctionSchemaBuilder.d.ts +25 -0
  9. package/dist/builders/FunctionSchemaBuilder.js +66 -0
  10. package/dist/builders/NumberSchemaBuilder.d.ts +61 -0
  11. package/dist/builders/NumberSchemaBuilder.js +206 -0
  12. package/dist/builders/ObjectSchemaBuilder.d.ts +83 -0
  13. package/dist/builders/ObjectSchemaBuilder.js +344 -0
  14. package/dist/builders/SchemaBuilder.d.ts +36 -0
  15. package/dist/builders/SchemaBuilder.js +88 -0
  16. package/dist/builders/StringSchemaBuilder.d.ts +14 -0
  17. package/dist/builders/StringSchemaBuilder.js +140 -0
  18. package/dist/builders/UnionSchemaBuilder.d.ts +10 -0
  19. package/dist/builders/UnionSchemaBuilder.js +100 -0
  20. package/dist/defaultSchemas.d.ts +4 -0
  21. package/dist/defaultSchemas.js +45 -0
  22. package/dist/index.d.ts +38 -90
  23. package/dist/index.js +30 -4
  24. package/dist/schema.d.ts +242 -0
  25. package/dist/schema.js +2 -0
  26. package/dist/schemaRegistry.d.ts +54 -0
  27. package/dist/schemaRegistry.js +301 -0
  28. package/dist/validators/validateArray.d.ts +3 -2
  29. package/dist/validators/validateBoolean.d.ts +2 -2
  30. package/dist/validators/validateBoolean.js +1 -4
  31. package/dist/validators/validateFunction.d.ts +2 -0
  32. package/dist/validators/validateFunction.js +21 -0
  33. package/dist/validators/validateNumber.d.ts +2 -2
  34. package/dist/validators/validateNumber.js +1 -1
  35. package/dist/validators/validateObject.d.ts +3 -2
  36. package/dist/validators/validateObject.js +33 -11
  37. package/dist/validators/validateString.d.ts +2 -2
  38. package/dist/validators/validateString.js +1 -1
  39. package/dist/validators/validateUnion.d.ts +3 -0
  40. package/dist/validators/validateUnion.js +30 -0
  41. package/package.json +3 -3
  42. package/src/builders/AliasSchemaBuilder.test.ts +124 -0
  43. package/src/builders/AliasSchemaBuilder.ts +250 -0
  44. package/src/builders/ArraySchemaBuilder.test.ts +270 -0
  45. package/src/builders/ArraySchemaBuilder.ts +381 -0
  46. package/src/builders/BooleanSchemaBuilder.test.ts +196 -0
  47. package/src/builders/BooleanSchemaBuilder.ts +155 -0
  48. package/src/builders/FunctionSchemaBuilder.test.ts +134 -0
  49. package/src/builders/FunctionSchemaBuilder.ts +109 -0
  50. package/src/builders/NumberSchemaBuilder.test.ts +493 -0
  51. package/src/builders/NumberSchemaBuilder.ts +789 -0
  52. package/src/builders/ObjectSchemaBuilder.test.ts +657 -0
  53. package/src/builders/ObjectSchemaBuilder.ts +794 -0
  54. package/src/builders/SchemaBuilder.test.ts +73 -0
  55. package/src/builders/SchemaBuilder.ts +135 -0
  56. package/src/builders/StringSchemaBuilder.test.ts +318 -0
  57. package/src/builders/StringSchemaBuilder.ts +392 -0
  58. package/src/builders/UnionSchemaBuilder.test.ts +162 -0
  59. package/src/builders/UnionSchemaBuilder.ts +159 -0
  60. package/src/defaultSchemas.ts +44 -0
  61. package/src/index.ts +70 -190
  62. package/src/schema.ts +922 -0
  63. package/src/schemaRegistry.builders.test.ts +1438 -0
  64. package/src/{schemaValidator.test.ts → schemaRegistry.test.ts} +561 -185
  65. package/src/schemaRegistry.ts +532 -0
  66. package/src/validators/validateArray.ts +4 -7
  67. package/src/validators/validateBoolean.ts +2 -11
  68. package/src/validators/validateFunction.ts +25 -0
  69. package/src/validators/validateNumber.ts +2 -7
  70. package/src/validators/validateObject.ts +32 -21
  71. package/src/validators/validateString.ts +2 -7
  72. package/src/validators/validateUnion.ts +36 -0
  73. package/dist/schemaValidator.d.ts +0 -16
  74. package/dist/schemaValidator.js +0 -234
  75. package/src/schemaValidator.ts +0 -367
package/README.md CHANGED
@@ -29,19 +29,21 @@ Any schema defined by object can contain the following fields:
29
29
 
30
30
  `number` schema can be defined as follows:
31
31
 
32
- import { SchemaValidator } from '@cleverbrush/schema';
33
- const validator = new SchemaValidator();
34
-
35
- // validates for integer number between 1 and 100
36
- let result = await validator.validate(
37
- {
38
- type: "number",
39
- isInteger: true,
40
- min: 1,
41
- max: 100,
42
- },
43
- 10
44
- );
32
+ ```typescript
33
+ import { SchemaValidator } from '@cleverbrush/schema';
34
+ const validator = new SchemaValidator();
35
+
36
+ // validates for integer number between 1 and 100
37
+ let result = await validator.validate(
38
+ {
39
+ type: 'number',
40
+ isInteger: true,
41
+ min: 1,
42
+ max: 100
43
+ },
44
+ 10
45
+ );
46
+ ```
45
47
 
46
48
  All fields available (apart of common fields for all schemas) are:
47
49
 
@@ -54,43 +56,56 @@ All fields available (apart of common fields for all schemas) are:
54
56
 
55
57
  Also it can be defined either by shortcut:
56
58
 
57
- import { SchemaValidator } from '@cleverbrush/schema';
58
- const validator = new SchemaValidator();
59
- let result = await validator.validate('number', 10);
60
- // { valid: true }
61
- result = await validator.validate('number', 'some string');
62
- // { valid: false, errors: [ 'expected type number, but saw string' ] }
59
+ ```typescript
60
+ import { SchemaValidator } from '@cleverbrush/schema';
61
+
62
+ const validator = new SchemaValidator();
63
+ let result = await validator.validate('number', 10);
64
+ // { valid: true }
65
+ result = await validator.validate('number', 'some string');
66
+ // { valid: false, errors: [ 'expected type number, but saw string' ] }
67
+ ```
63
68
 
64
69
  which is equal to:
65
70
 
66
- import { SchemaValidator } from '@cleverbrush/schema';
67
- const validator = new SchemaValidator();
68
- let result = await validator.validate({
71
+ ```typescript
72
+ import { SchemaValidator } from '@cleverbrush/schema';
73
+
74
+ const validator = new SchemaValidator();
75
+
76
+ let result = await validator.validate(
77
+ {
69
78
  type: 'number',
70
79
  isRequired: true,
71
80
  isNullable: false,
72
81
  ensureNotNaN: true,
73
82
  ensureIsFinite: true
74
- }, 0 / 0);
75
- // { valid: false }
83
+ },
84
+ 0 / 0
85
+ );
86
+ // { valid: false }
87
+ ```
76
88
 
77
89
  ### String
78
90
 
79
91
  `string` schema can be defined as follows:
80
92
 
81
- import { SchemaValidator } from '@cleverbrush/schema';
82
- const validator = new SchemaValidator();
93
+ ```typescript
94
+ import { SchemaValidator } from '@cleverbrush/schema';
83
95
 
84
- // validates for non empty string no longer than 100 chars
85
- let result = await validator.validate(
86
- {
87
- type: "string",
88
- minLength: 1,
89
- maxLength: 100
90
- },
91
- "some value here"
92
- );
93
- // { valid: true }
96
+ const validator = new SchemaValidator();
97
+
98
+ // validates for non empty string no longer than 100 chars
99
+ let result = await validator.validate(
100
+ {
101
+ type: 'string',
102
+ minLength: 1,
103
+ maxLength: 100
104
+ },
105
+ 'some value here'
106
+ );
107
+ // { valid: true }
108
+ ```
94
109
 
95
110
  All fields available (apart of common fields for all schemas) are:
96
111
 
@@ -100,46 +115,59 @@ All fields available (apart of common fields for all schemas) are:
100
115
 
101
116
  Also it can be defined either by shortcut:
102
117
 
103
- import { SchemaValidator } from '@cleverbrush/schema';
104
- const validator = new SchemaValidator();
105
- let result = await validator.validate('string', 'something');
106
- // { valid: true }
107
- result = await validator.validate('string', 10);
108
- // { valid: false, errors: [ 'expected type string, but saw number' ] }
118
+ ```typescript
119
+ import { SchemaValidator } from '@cleverbrush/schema';
109
120
 
110
- which is equal to:
121
+ const validator = new SchemaValidator();
122
+
123
+ let result = await validator.validate('string', 'something');
124
+ // { valid: true }
125
+ result = await validator.validate('string', 10);
126
+ // { valid: false, errors: [ 'expected type string, but saw number' ] }
127
+ ```
128
+
129
+ or by detailed descriptor:
130
+
131
+ ```typescript
132
+ import { SchemaValidator } from '@cleverbrush/schema';
111
133
 
112
- import { SchemaValidator } from '@cleverbrush/schema';
113
- const validator = new SchemaValidator();
114
- let result = await validator.validate({
134
+ const validator = new SchemaValidator();
135
+
136
+ let result = await validator.validate(
137
+ {
115
138
  type: 'string',
116
139
  isNullable: false,
117
140
  isRequired: true
118
- }, 1230);
119
- // { valid: false }
141
+ },
142
+ 1230
143
+ );
144
+ // { valid: false }
145
+ ```
120
146
 
121
147
  ### Array
122
148
 
123
149
  `array` schema can be defined as follows:
124
150
 
125
- import { SchemaValidator } from '@cleverbrush/schema';
126
- const validator = new SchemaValidator();
127
-
128
- // validates for non empty string no longer than 100 chars
129
- let result = await validator.validate(
130
- {
131
- type: "array",
132
- minLength: 5,
133
- maxLength: 10,
134
- ofType: {
135
- type: "number",
136
- min: 1,
137
- max: 10
138
- }
139
- },
140
- [5, 6, 7, 8, 9]
141
- );
142
- // { valid: true }
151
+ ```typescript
152
+ import { SchemaValidator } from '@cleverbrush/schema';
153
+ const validator = new SchemaValidator();
154
+
155
+ // validates for non empty string no longer than 100 chars
156
+ let result = await validator.validate(
157
+ {
158
+ type: 'array',
159
+ minLength: 5,
160
+ maxLength: 10,
161
+ ofType: {
162
+ type: 'number',
163
+ min: 1,
164
+ max: 10
165
+ }
166
+ },
167
+ [5, 6, 7, 8, 9]
168
+ );
169
+ // { valid: true }
170
+ ```
143
171
 
144
172
  All fields available (apart of common fields for all schemas) are:
145
173
 
@@ -149,60 +177,74 @@ All fields available (apart of common fields for all schemas) are:
149
177
 
150
178
  Also it can be defined either by shortcut:
151
179
 
152
- import { SchemaValidator } from '@cleverbrush/schema';
153
- const validator = new SchemaValidator();
154
- let result = await validator.validate('array', []);
155
- // { valid: true }
156
- result = await validator.validate('array', 10);
157
- // { valid: false, errors: [ 'expected array' ] }
180
+ ```typescript
181
+ import { SchemaValidator } from '@cleverbrush/schema';
158
182
 
159
- which is equal to:
183
+ const validator = new SchemaValidator();
184
+
185
+ let result = await validator.validate('array', []);
186
+ // { valid: true }
187
+ result = await validator.validate('array', 10);
188
+ // { valid: false, errors: [ 'expected array' ] }
189
+ ```
190
+
191
+ or by detailed descriptor:
160
192
 
161
- import { SchemaValidator } from '@cleverbrush/schema';
162
- const validator = new SchemaValidator();
163
- let result = await validator.validate({
193
+ ```typescript
194
+ import { SchemaValidator } from '@cleverbrush/schema';
195
+
196
+ const validator = new SchemaValidator();
197
+
198
+ let result = await validator.validate(
199
+ {
164
200
  type: 'array'
165
- }, 1230);
166
- // { valid: false, errors: [ 'expected array' ] }
201
+ },
202
+ 1230
203
+ );
204
+ // { valid: false, errors: [ 'expected array' ] }
205
+ ```
167
206
 
168
207
  ### Object
169
208
 
170
209
  `object` type allows to define a complex object schema. For example:
171
210
 
172
- await validator.validate(
173
- {
174
- type: "object",
175
- properties: {
176
- id: "number",
177
- name: {
178
- type: "string",
179
- minLength: 1,
180
- maxLength: 100,
181
- },
182
- address: {
183
- type: "object",
184
- properties: {
185
- city: "string",
186
- street: {
187
- type: "string",
188
- isRequired: false,
189
- },
190
- },
191
- },
211
+ ```typescript
212
+ await validator.validate(
213
+ {
214
+ type: 'object',
215
+ properties: {
216
+ id: 'number',
217
+ name: {
218
+ type: 'string',
219
+ minLength: 1,
220
+ maxLength: 100
192
221
  },
193
- },
194
- {
195
- id: 10,
196
- name: "Andrew",
197
222
  address: {
198
- city: "Madrid",
199
- },
223
+ type: 'object',
224
+ properties: {
225
+ city: 'string',
226
+ street: {
227
+ type: 'string',
228
+ isRequired: false
229
+ }
230
+ }
231
+ }
200
232
  }
201
- );
202
- // {valid: true}
233
+ },
234
+ {
235
+ id: 10,
236
+ name: 'Andrew',
237
+ address: {
238
+ city: 'Madrid'
239
+ }
240
+ }
241
+ );
242
+ // {valid: true}
243
+ ```
203
244
 
204
245
  All fields available are:
205
246
 
247
+ - `noUnknownProperties` - Validator will return an error if this field is set to `true` and validated objects contain fields not defined in the object schema. Equals to `false` by default.
206
248
  - `properties` - the list of properties, every property has corresponding schema definition (see example above).
207
249
 
208
250
  ## Alternative schema
@@ -210,94 +252,102 @@ All fields available are:
210
252
  Everywhere you pass a `schema` object to the library, you may pass an array of `schema` objects which will validate the object to match at least one schema from this list.
211
253
  For example, if you want to check that array is consisting either from number or from `{ name: string, value: number }` objects, you can do the following:
212
254
 
213
- await validator.validate(
214
- {
215
- type: "array",
255
+ ```typescript
256
+ await validator.validate(
257
+ {
258
+ type: 'array',
216
259
  ofType: [
217
- "number",
260
+ 'number',
218
261
  {
219
- type: "object",
220
- properties: {
221
- name: "string",
222
- value: "number",
223
- },
224
- },
225
- ],
226
- },
227
- [
262
+ type: 'object',
263
+ properties: {
264
+ name: 'string',
265
+ value: 'number'
266
+ }
267
+ }
268
+ ]
269
+ },
270
+ [
228
271
  10,
229
- { name: "something", value: 1 },
272
+ { name: 'something', value: 1 },
230
273
  100,
231
- { name: "another string", value: 1 },
232
- ]
233
- );
234
- // {valid: true}
274
+ { name: 'another string', value: 1 }
275
+ ]
276
+ );
277
+ // {valid: true}
278
+ ```
235
279
 
236
280
  ## Named schemas
237
281
 
238
282
  There is a possibility to register a schema, give it a name and then reuse it:
239
283
 
240
- const validator = new SchemaValidator().addSchemaType("Address", {
284
+ ```typescript
285
+ const validator = new SchemaValidator().addSchemaType('Address', {
241
286
  properties: {
242
287
  id: {
243
- type: "number",
244
- min: 1,
288
+ type: 'number',
289
+ min: 1
245
290
  },
246
- street: "string",
247
- zip: "number",
248
- },
249
- });
250
-
251
- await validator.validate(
252
- {
253
- type: "object",
291
+ street: 'string',
292
+ zip: 'number'
293
+ }
294
+ });
295
+
296
+ await validator.validate(
297
+ {
298
+ type: 'object',
254
299
  properties: {
255
- name: "string",
256
- address1: "Address",
257
- address2: "Address",
258
- },
259
- },
260
- {
261
- name: "Andrew",
300
+ name: 'string',
301
+ address1: 'Address',
302
+ address2: 'Address'
303
+ }
304
+ },
305
+ {
306
+ name: 'Andrew',
262
307
  address1: {
263
308
  id: 1,
264
- street: "some street",
265
- zip: 12345,
309
+ street: 'some street',
310
+ zip: 12345
266
311
  },
267
312
  address2: {
268
313
  id: 2,
269
- street: "some street 2",
270
- zip: 3456,
271
- },
314
+ street: 'some street 2',
315
+ zip: 3456
272
316
  }
273
- );
317
+ }
318
+ );
274
319
 
275
- // { valid: true }
320
+ // { valid: true }
321
+ ```
276
322
 
277
323
  Also there is a possibility to organize schemas in modules (or even submodules):
278
324
 
279
- const validator = new SchemaValidator().addSchemaType("Module1.DTOs.Address", {
325
+ ```typescript
326
+ const validator = new SchemaValidator()
327
+ .addSchemaType('Module1.DTOs.Address', {
280
328
  properties: {
281
329
  id: {
282
- type: "number",
283
- min: 1,
330
+ type: 'number',
331
+ min: 1
284
332
  },
285
- street: "string",
286
- zip: "number",
333
+ street: 'string',
334
+ zip: 'number'
287
335
  }
288
- }).addSchemaType("Module1.Models.Person", {
336
+ })
337
+ .addSchemaType('Module1.Models.Person', {
289
338
  properties: {
290
- firstName: "string",
291
- lastName: "string"
292
- },
339
+ firstName: 'string',
340
+ lastName: 'string'
341
+ }
293
342
  });
294
343
 
295
- const resultPerson = await validator.schemas.Module1.Models.Person.validate({
296
- fistName: 'John',
297
- lastName: 'Smith'
298
- });
344
+ const resultPerson = await validator.schemas.Module1.Models.Person.validate({
345
+ fistName: 'John',
346
+ lastName: 'Smith'
347
+ });
299
348
 
300
- const resultAddress = await validator.schemas.Module1.DTOs.Address.validate({ });
349
+ const resultAddress = await validator.schemas.Module1.DTOs.Address.validate({});
350
+ ```
301
351
 
302
352
  ## Examples
303
353
 
@@ -0,0 +1,14 @@
1
+ import { ISchemaBuilder } from './SchemaBuilder.js';
2
+ import { InferType } from '../schema.js';
3
+ import { ISchemaRegistry } from '../index.js';
4
+ export interface IAliasSchemaBuilder<TSchemaName extends keyof TAliases, TRequired extends boolean = true, TNullable extends boolean = false, TAliases extends Record<string, any> = never, TAliasesCompiledType = any, TExternalRegistryKeys extends Record<string, any> = {}> extends ISchemaBuilder<TRequired, TNullable> {
5
+ readonly type: 'alias';
6
+ schemaName: TSchemaName;
7
+ externalRegistry: ISchemaRegistry<TExternalRegistryKeys>;
8
+ optional(): IAliasSchemaBuilder<TSchemaName, false, TNullable, TAliases, TAliasesCompiledType, TExternalRegistryKeys>;
9
+ required(): IAliasSchemaBuilder<TSchemaName, true, TNullable, TAliases, TAliasesCompiledType, TExternalRegistryKeys>;
10
+ nullable(): IAliasSchemaBuilder<TSchemaName, TRequired, true, TAliases, TAliasesCompiledType, TExternalRegistryKeys>;
11
+ notNullable(): IAliasSchemaBuilder<TSchemaName, TRequired, false, TAliases, TAliasesCompiledType, TExternalRegistryKeys>;
12
+ }
13
+ export declare const alias: <TSchemaName extends keyof TAliases, TAliases extends Record<string, any>, TAliasesCompiledType = InferType<TAliases[TSchemaName]>>(schemaName: TSchemaName) => IAliasSchemaBuilder<TSchemaName, true, false, TAliases, TAliasesCompiledType, {}>;
14
+ export declare const externalAlias: <TSchemaName extends keyof TAliases, TAliases extends Record<string, any>, TExternalSchemaRegistry extends ISchemaRegistry<TAliases>, TAliasesCompiledType = InferType<TAliases[TSchemaName]>>(registry: TExternalSchemaRegistry, schemaName: TSchemaName) => IAliasSchemaBuilder<TSchemaName, true, false, TAliases, TAliasesCompiledType, {}>;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.externalAlias = exports.alias = void 0;
4
+ const SchemaBuilder_js_1 = require("./SchemaBuilder.js");
5
+ const defaultSchemas_js_1 = require("../defaultSchemas.js");
6
+ class AliasSchemaBuilder extends SchemaBuilder_js_1.SchemaBuilder {
7
+ clone() {
8
+ return AliasSchemaBuilder.create(this._schema);
9
+ }
10
+ get _schema() {
11
+ return Object.assign({
12
+ type: this.type,
13
+ schemaName: this.schemaName,
14
+ externalRegistry: this.externalRegistry
15
+ }, this.getCommonSchema());
16
+ }
17
+ static create(obj) {
18
+ return new AliasSchemaBuilder(obj);
19
+ }
20
+ schemaName;
21
+ externalRegistry;
22
+ constructor(obj) {
23
+ super(obj);
24
+ if (typeof obj === 'object' && obj) {
25
+ if (typeof obj.schemaName === 'string') {
26
+ this.schemaName = obj.schemaName;
27
+ }
28
+ if (typeof obj.externalRegistry === 'object' &&
29
+ obj.externalRegistry) {
30
+ this.externalRegistry = obj.externalRegistry;
31
+ }
32
+ }
33
+ else {
34
+ const defaultSchema = defaultSchemas_js_1.defaultSchemas['alias'];
35
+ this.isRequired = defaultSchema.isRequired;
36
+ this.isNullable = defaultSchema.isNullable;
37
+ }
38
+ }
39
+ get type() {
40
+ return 'alias';
41
+ }
42
+ optional() {
43
+ if (this.isRequired === false) {
44
+ return this;
45
+ }
46
+ return AliasSchemaBuilder.create({
47
+ ...this._schema,
48
+ isRequired: false
49
+ });
50
+ }
51
+ required() {
52
+ if (this.isRequired === true) {
53
+ return this;
54
+ }
55
+ return AliasSchemaBuilder.create({
56
+ ...this._schema,
57
+ isRequired: true
58
+ });
59
+ }
60
+ nullable() {
61
+ if (this._isNullable === true) {
62
+ return this;
63
+ }
64
+ return AliasSchemaBuilder.create({
65
+ ...this._schema,
66
+ isNullable: true
67
+ });
68
+ }
69
+ notNullable() {
70
+ if (this.isNullable === false) {
71
+ return this;
72
+ }
73
+ return AliasSchemaBuilder.create({
74
+ ...this._schema,
75
+ isNullable: false
76
+ });
77
+ }
78
+ }
79
+ const alias = (schemaName) => AliasSchemaBuilder.create({
80
+ schemaName,
81
+ isRequired: true,
82
+ isNullable: false
83
+ });
84
+ exports.alias = alias;
85
+ const externalAlias = (registry, schemaName) => AliasSchemaBuilder.create({
86
+ schemaName,
87
+ isRequired: true,
88
+ isNullable: false,
89
+ externalRegistry: registry
90
+ });
91
+ exports.externalAlias = externalAlias;
@@ -0,0 +1,15 @@
1
+ import { ISchemaBuilder } from './SchemaBuilder.js';
2
+ import { Schema } from '../schema.js';
3
+ export interface IArraySchemaBuilder<TRequired extends boolean = true, TNullable extends boolean = false, TOfType extends Schema | undefined = undefined, TMaxLength extends number | undefined = undefined, TMinLength extends number | undefined = undefined> extends ISchemaBuilder<TRequired, TNullable> {
4
+ optional(): IArraySchemaBuilder<false, TNullable, TOfType, TMaxLength, TMinLength>;
5
+ required(): IArraySchemaBuilder<true, TNullable, TOfType, TMaxLength, TMinLength>;
6
+ ofType<T extends Schema>(schema: T): IArraySchemaBuilder<TRequired, TNullable, T, TMaxLength, TMinLength>;
7
+ nullable(): IArraySchemaBuilder<TRequired, true, TOfType, TMaxLength, TMinLength>;
8
+ notNullable(): IArraySchemaBuilder<TRequired, false, TOfType, TMaxLength, TMinLength>;
9
+ clearOfType(): IArraySchemaBuilder<TRequired, TNullable, undefined, TMaxLength, TMinLength>;
10
+ maxLength<T extends number>(length: T): IArraySchemaBuilder<TRequired, TNullable, TOfType, T, TMinLength>;
11
+ clearMaxLength(): IArraySchemaBuilder<TRequired, TNullable, TOfType, undefined, TMinLength>;
12
+ minLength<T extends number>(length: T): IArraySchemaBuilder<TRequired, TNullable, TOfType, TMaxLength, T>;
13
+ clearMinLength(): IArraySchemaBuilder<TRequired, TNullable, TOfType, TMaxLength, TMinLength>;
14
+ }
15
+ export declare const array: () => IArraySchemaBuilder<true, false, undefined, undefined, undefined>;