forked from aikoven/slice2json
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
163 lines (145 loc) · 2.99 KB
/
types.ts
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
export interface SliceSource {
pragmaOnce?: boolean;
includes?: string[];
globalMetadata?: string[];
modules: ModuleDeclaration[];
}
export interface ModuleDeclaration {
type: 'module';
name: string;
doc?: string;
metadata?: string[];
content: ModuleChild[];
}
export type ModuleChild =
| ModuleDeclaration
| ClassForwardDeclaration
| ClassDeclaration
| InterfaceForwardDeclaration
| InterfaceDeclaration
| ExceptionDeclaration
| StructDeclaration
| EnumDeclaration
| SequenceDeclaration
| DictionaryDeclaration
| ConstDeclaration;
export interface ClassForwardDeclaration {
type: 'classForward';
name: string;
doc?: string;
local?: boolean;
extends?: string;
}
export interface ClassDeclaration {
type: 'class';
name: string;
doc?: string;
metadata?: string;
local?: boolean;
extends?: string;
content: ClassChild[];
}
export type ClassChild = ClassFieldDeclaration | OperationDeclaration;
export interface ClassFieldDeclaration {
type: 'field';
name: string;
doc?: string;
metadata?: string[];
optional?: number;
dataType: string;
defaultValue?: string;
}
export interface InterfaceForwardDeclaration {
type: 'interfaceForward';
name: string;
doc?: string;
local?: boolean;
extends?: string[];
}
export interface InterfaceDeclaration {
type: 'interface';
name: string;
doc?: string;
metadata?: string[];
local?: boolean;
extends?: string[];
content: OperationDeclaration[];
}
export interface ExceptionDeclaration {
type: 'exception';
name: string;
doc?: string;
metadata?: string[];
local?: boolean;
extends?: string;
content: ClassFieldDeclaration[];
}
export interface StructDeclaration {
type: 'struct';
name: string;
doc?: string;
metadata?: string[];
local?: boolean;
fields: StructFieldDeclaration[];
}
export interface StructFieldDeclaration {
name: string;
doc?: string;
metadata?: string[];
dataType: string;
defaultValue?: string;
}
export interface EnumDeclaration {
type: 'enum';
name: string;
doc?: string;
metadata?: string[];
enums: EnumElement[];
}
export interface EnumElement {
doc?: string;
name: string;
value?: string;
}
export interface SequenceDeclaration {
type: 'sequence';
name: string;
doc?: string;
metadata?: string[];
local?: boolean;
dataType: string;
}
export interface DictionaryDeclaration {
type: 'dictionary';
name: string;
doc?: string;
metadata?: string;
local?: boolean;
keyType: string;
valueType: string;
}
export interface ConstDeclaration {
type: 'const';
name: string;
doc?: string;
dataType: string;
value: string;
}
export interface OperationDeclaration {
type: 'operation';
name: string;
doc?: string;
metadata?: string[];
idempotent?: boolean;
returnOptional?: number;
returnType: string;
parameters: ParameterDeclaration[];
throws?: string[];
}
export interface ParameterDeclaration {
name: string;
metadata?: string[];
out?: boolean;
optional?: number;
dataType: string;
}