This repository was archived by the owner on Feb 23, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSchema.type.ts
More file actions
72 lines (61 loc) · 1.4 KB
/
Schema.type.ts
File metadata and controls
72 lines (61 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
export type String = {
type: 'string';
enum?: string[];
pattern?: string;
min?: number;
max?: number;
default?: string | null;
trim?: boolean; // Default: true
lowercase?: boolean;
uppercase?: boolean;
nullable: boolean;
required: boolean;
};
export type Number = {
type: 'number';
enum?: number[];
min?: number;
max?: number;
integer?: boolean;
positive?: boolean;
negative?: boolean;
default?: number | null;
nullable: boolean;
required: boolean;
};
export type Boolean = {
type: 'boolean';
default?: boolean | null;
nullable: boolean;
required: boolean;
};
export type Date = {
type: 'date';
min?: string;
max?: string;
default?: string | null;
nullable: boolean;
required: boolean;
};
export type Object = {
type: 'object';
properties: Schema;
default?: Record<string, unknown> | null;
nullable: boolean;
required: boolean;
};
export type _Array = {
type: 'array';
min?: number;
max?: number;
items: Type;
default?: unknown[] | null;
nullable: boolean;
required: boolean;
};
export type TypeSingle = String | Number | Boolean | Date | Object | _Array;
export type TypeUnion = [TypeSingle, TypeSingle, ...TypeSingle[]];
export type Type = TypeSingle | TypeUnion;
export type SchemaSingle = Record<string, Type>;
export type SchemaUnion = [SchemaSingle, SchemaSingle, ...SchemaSingle[]];
export type Schema = SchemaSingle | SchemaUnion;