|
1 | | -export const PER_FIELD_SCHEMA = { |
2 | | - $$strict: true, // no additional properties allowed |
3 | | - defaultValue: { type: 'any', optional: true }, |
| 1 | +const PER_FIELD_CONFIG = { |
| 2 | + defaultValue: { type: "any", optional: true }, |
4 | 3 | required: [ |
5 | | - { type: 'boolean', optional: true }, |
| 4 | + { type: "boolean", optional: true }, |
6 | 5 | { |
7 | | - type: 'object', |
| 6 | + type: "object", |
8 | 7 | optional: true, |
9 | 8 | props: { |
10 | | - errorMsg: { type: 'string' }, |
| 9 | + errorMsg: { type: "string" }, |
11 | 10 | }, |
12 | 11 | }, |
13 | 12 | ], |
14 | 13 | min: [ |
15 | | - { type: 'number', optional: true, positive: true, integer: true }, |
| 14 | + { type: "number", optional: true, positive: true, integer: true }, |
16 | 15 | { |
17 | | - type: 'object', |
| 16 | + type: "object", |
18 | 17 | optional: true, |
19 | 18 | props: { |
20 | | - errorMsg: { type: 'string' }, |
21 | | - length: { type: 'number', positive: true, integer: true }, |
| 19 | + errorMsg: { type: "string" }, |
| 20 | + length: { type: "number", positive: true, integer: true }, |
22 | 21 | }, |
23 | 22 | }, |
24 | 23 | ], |
25 | 24 | max: [ |
26 | | - { type: 'number', optional: true, positive: true, integer: true }, |
| 25 | + { type: "number", optional: true, positive: true, integer: true }, |
27 | 26 | { |
28 | | - type: 'object', |
| 27 | + type: "object", |
29 | 28 | optional: true, |
30 | 29 | props: { |
31 | | - errorMsg: { type: 'string' }, |
32 | | - length: { type: 'number', positive: true, integer: true }, |
| 30 | + errorMsg: { type: "string" }, |
| 31 | + length: { type: "number", positive: true, integer: true }, |
33 | 32 | }, |
34 | 33 | }, |
35 | 34 | ], |
36 | 35 | patterns: { |
37 | | - type: 'array', |
| 36 | + type: "array", |
38 | 37 | items: { |
39 | | - type: 'object', |
| 38 | + type: "object", |
40 | 39 | props: { |
41 | | - regex: { type: 'regex' }, |
42 | | - errorMsg: { type: 'string' }, |
| 40 | + regex: { type: "regex" }, |
| 41 | + errorMsg: { type: "string" }, |
43 | 42 | }, |
44 | 43 | }, |
45 | 44 | optional: true, |
46 | 45 | }, |
47 | | - validationFns: { type: 'array', items: 'function', optional: true }, |
| 46 | + validationFns: { type: "array", items: "function", optional: true }, |
| 47 | +}; |
| 48 | + |
| 49 | +export const PER_FIELD_SCHEMA = { |
| 50 | + $$strict: true, // no additional properties allowed |
| 51 | + ...PER_FIELD_CONFIG, |
48 | 52 | }; |
| 53 | + |
49 | 54 | export const FIELD_CONFIG_SCHEMA = { |
| 55 | + $$strict: true, // no additional properties allowed |
50 | 56 | configs: { |
51 | | - type: 'array', |
| 57 | + type: "array", |
52 | 58 | items: { |
53 | | - type: 'object', |
54 | | - props: PER_FIELD_SCHEMA, |
| 59 | + type: "object", |
| 60 | + props: PER_FIELD_CONFIG, |
55 | 61 | }, |
56 | 62 | }, |
57 | 63 | }; |
0 commit comments