@kubb/plugin-oas 3.10.10 → 3.10.12
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.
- package/dist/{OperationGenerator-BFmQs4BO.d.cts → OperationGenerator-CF1rxGSV.d.ts} +2 -273
- package/dist/{OperationGenerator-BFmQs4BO.d.ts → OperationGenerator-DxdJDBEc.d.cts} +2 -273
- package/dist/{Schema-Cmvkb9CW.d.ts → Schema-AjebpeVY.d.ts} +1 -1
- package/dist/{Schema-BunfYze0.d.cts → Schema-M6983FL1.d.cts} +1 -1
- package/dist/SchemaMapper-B21ZmWag.d.cts +275 -0
- package/dist/SchemaMapper-B21ZmWag.d.ts +275 -0
- package/dist/chunk-6S7YFY6F.js +33 -0
- package/dist/chunk-6S7YFY6F.js.map +1 -0
- package/dist/chunk-76E35IZ2.js +56 -0
- package/dist/chunk-76E35IZ2.js.map +1 -0
- package/dist/chunk-DTD4ZUDA.cjs +36 -0
- package/dist/chunk-DTD4ZUDA.cjs.map +1 -0
- package/dist/{chunk-QDPL3I3X.js → chunk-HLZZQQYR.js} +33 -91
- package/dist/chunk-HLZZQQYR.js.map +1 -0
- package/dist/chunk-QF3E6S2N.js +29 -0
- package/dist/chunk-QF3E6S2N.js.map +1 -0
- package/dist/chunk-RSHQODEK.cjs +35 -0
- package/dist/chunk-RSHQODEK.cjs.map +1 -0
- package/dist/{chunk-Y6YAXTK5.cjs → chunk-S3UPJP7I.cjs} +5 -5
- package/dist/chunk-S3UPJP7I.cjs.map +1 -0
- package/dist/{chunk-6HG3X5MB.js → chunk-S7ZYTJXL.js} +3 -3
- package/dist/chunk-S7ZYTJXL.js.map +1 -0
- package/dist/{chunk-7U6BHIOO.cjs → chunk-WAB2O4DX.cjs} +116 -176
- package/dist/chunk-WAB2O4DX.cjs.map +1 -0
- package/dist/chunk-YWMMI3MO.cjs +59 -0
- package/dist/chunk-YWMMI3MO.cjs.map +1 -0
- package/dist/components.cjs +0 -1
- package/dist/components.d.cts +4 -3
- package/dist/components.d.ts +4 -3
- package/dist/components.js +0 -1
- package/dist/generators.cjs +3 -5
- package/dist/generators.d.cts +2 -1
- package/dist/generators.d.ts +2 -1
- package/dist/generators.js +2 -4
- package/dist/hooks.cjs +3 -2
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +3 -2
- package/dist/hooks.d.ts +3 -2
- package/dist/hooks.js +2 -1
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +13 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +733 -0
- package/dist/mocks.cjs.map +1 -0
- package/dist/mocks.d.cts +15 -0
- package/dist/mocks.d.ts +15 -0
- package/dist/mocks.js +731 -0
- package/dist/mocks.js.map +1 -0
- package/dist/utils.cjs +61 -18
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +2 -1
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +51 -1
- package/dist/utils.js.map +1 -1
- package/package.json +16 -8
- package/src/SchemaGenerator.ts +27 -39
- package/src/generator.tsx +1 -1
- package/src/generators/jsonGenerator.ts +2 -1
- package/src/mocks/index.ts +1 -0
- package/src/mocks/schemas.ts +728 -0
- package/src/utils/parseFromConfig.ts +1 -1
- package/dist/chunk-6HG3X5MB.js.map +0 -1
- package/dist/chunk-7U6BHIOO.cjs.map +0 -1
- package/dist/chunk-DEDONPUL.cjs +0 -114
- package/dist/chunk-DEDONPUL.cjs.map +0 -1
- package/dist/chunk-PADR76WZ.cjs +0 -4
- package/dist/chunk-PADR76WZ.cjs.map +0 -1
- package/dist/chunk-QDPL3I3X.js.map +0 -1
- package/dist/chunk-QPFZUPQA.js +0 -100
- package/dist/chunk-QPFZUPQA.js.map +0 -1
- package/dist/chunk-R47XMJ32.js +0 -3
- package/dist/chunk-R47XMJ32.js.map +0 -1
- package/dist/chunk-Y6YAXTK5.cjs.map +0 -1
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { KubbFile } from '@kubb/core/fs';
|
|
2
|
+
|
|
3
|
+
type SchemaKeywordMapper = {
|
|
4
|
+
object: {
|
|
5
|
+
keyword: 'object';
|
|
6
|
+
args: {
|
|
7
|
+
properties: {
|
|
8
|
+
[x: string]: Schema[];
|
|
9
|
+
};
|
|
10
|
+
additionalProperties: Schema[];
|
|
11
|
+
strict?: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
url: {
|
|
15
|
+
keyword: 'url';
|
|
16
|
+
};
|
|
17
|
+
readOnly: {
|
|
18
|
+
keyword: 'readOnly';
|
|
19
|
+
};
|
|
20
|
+
writeOnly: {
|
|
21
|
+
keyword: 'writeOnly';
|
|
22
|
+
};
|
|
23
|
+
uuid: {
|
|
24
|
+
keyword: 'uuid';
|
|
25
|
+
};
|
|
26
|
+
email: {
|
|
27
|
+
keyword: 'email';
|
|
28
|
+
};
|
|
29
|
+
firstName: {
|
|
30
|
+
keyword: 'firstName';
|
|
31
|
+
};
|
|
32
|
+
lastName: {
|
|
33
|
+
keyword: 'lastName';
|
|
34
|
+
};
|
|
35
|
+
phone: {
|
|
36
|
+
keyword: 'phone';
|
|
37
|
+
};
|
|
38
|
+
password: {
|
|
39
|
+
keyword: 'password';
|
|
40
|
+
};
|
|
41
|
+
date: {
|
|
42
|
+
keyword: 'date';
|
|
43
|
+
args: {
|
|
44
|
+
type?: 'date' | 'string';
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
time: {
|
|
48
|
+
keyword: 'time';
|
|
49
|
+
args: {
|
|
50
|
+
type?: 'date' | 'string';
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
datetime: {
|
|
54
|
+
keyword: 'datetime';
|
|
55
|
+
args: {
|
|
56
|
+
offset?: boolean;
|
|
57
|
+
local?: boolean;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
tuple: {
|
|
61
|
+
keyword: 'tuple';
|
|
62
|
+
args: {
|
|
63
|
+
items: Schema[];
|
|
64
|
+
min?: number;
|
|
65
|
+
max?: number;
|
|
66
|
+
rest?: Schema;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
array: {
|
|
70
|
+
keyword: 'array';
|
|
71
|
+
args: {
|
|
72
|
+
items: Schema[];
|
|
73
|
+
min?: number;
|
|
74
|
+
max?: number;
|
|
75
|
+
unique?: boolean;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
enum: {
|
|
79
|
+
keyword: 'enum';
|
|
80
|
+
args: {
|
|
81
|
+
name: string;
|
|
82
|
+
typeName: string;
|
|
83
|
+
asConst: boolean;
|
|
84
|
+
items: Array<{
|
|
85
|
+
name: string | number;
|
|
86
|
+
format: 'string' | 'number' | 'boolean';
|
|
87
|
+
value?: string | number | boolean;
|
|
88
|
+
}>;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
and: {
|
|
92
|
+
keyword: 'and';
|
|
93
|
+
args: Schema[];
|
|
94
|
+
};
|
|
95
|
+
const: {
|
|
96
|
+
keyword: 'const';
|
|
97
|
+
args: {
|
|
98
|
+
name: string | number;
|
|
99
|
+
format: 'string' | 'number' | 'boolean';
|
|
100
|
+
value?: string | number | boolean;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
union: {
|
|
104
|
+
keyword: 'union';
|
|
105
|
+
args: Schema[];
|
|
106
|
+
};
|
|
107
|
+
ref: {
|
|
108
|
+
keyword: 'ref';
|
|
109
|
+
args: {
|
|
110
|
+
name: string;
|
|
111
|
+
$ref: string;
|
|
112
|
+
/**
|
|
113
|
+
* Full qualified path.
|
|
114
|
+
*/
|
|
115
|
+
path: KubbFile.OptionalPath;
|
|
116
|
+
/**
|
|
117
|
+
* When true `File.Import` will be used.
|
|
118
|
+
* When false a reference will be used inside the current file.
|
|
119
|
+
*/
|
|
120
|
+
isImportable: boolean;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
matches: {
|
|
124
|
+
keyword: 'matches';
|
|
125
|
+
args?: string;
|
|
126
|
+
};
|
|
127
|
+
boolean: {
|
|
128
|
+
keyword: 'boolean';
|
|
129
|
+
};
|
|
130
|
+
default: {
|
|
131
|
+
keyword: 'default';
|
|
132
|
+
args: string | number | boolean;
|
|
133
|
+
};
|
|
134
|
+
string: {
|
|
135
|
+
keyword: 'string';
|
|
136
|
+
};
|
|
137
|
+
integer: {
|
|
138
|
+
keyword: 'integer';
|
|
139
|
+
};
|
|
140
|
+
number: {
|
|
141
|
+
keyword: 'number';
|
|
142
|
+
};
|
|
143
|
+
max: {
|
|
144
|
+
keyword: 'max';
|
|
145
|
+
args: number;
|
|
146
|
+
};
|
|
147
|
+
min: {
|
|
148
|
+
keyword: 'min';
|
|
149
|
+
args: number;
|
|
150
|
+
};
|
|
151
|
+
describe: {
|
|
152
|
+
keyword: 'describe';
|
|
153
|
+
args: string;
|
|
154
|
+
};
|
|
155
|
+
example: {
|
|
156
|
+
keyword: 'example';
|
|
157
|
+
args: string;
|
|
158
|
+
};
|
|
159
|
+
deprecated: {
|
|
160
|
+
keyword: 'deprecated';
|
|
161
|
+
};
|
|
162
|
+
optional: {
|
|
163
|
+
keyword: 'optional';
|
|
164
|
+
};
|
|
165
|
+
undefined: {
|
|
166
|
+
keyword: 'undefined';
|
|
167
|
+
};
|
|
168
|
+
nullish: {
|
|
169
|
+
keyword: 'nullish';
|
|
170
|
+
};
|
|
171
|
+
nullable: {
|
|
172
|
+
keyword: 'nullable';
|
|
173
|
+
};
|
|
174
|
+
null: {
|
|
175
|
+
keyword: 'null';
|
|
176
|
+
};
|
|
177
|
+
any: {
|
|
178
|
+
keyword: 'any';
|
|
179
|
+
};
|
|
180
|
+
unknown: {
|
|
181
|
+
keyword: 'unknown';
|
|
182
|
+
};
|
|
183
|
+
void: {
|
|
184
|
+
keyword: 'void';
|
|
185
|
+
};
|
|
186
|
+
blob: {
|
|
187
|
+
keyword: 'blob';
|
|
188
|
+
};
|
|
189
|
+
schema: {
|
|
190
|
+
keyword: 'schema';
|
|
191
|
+
args: {
|
|
192
|
+
type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
|
|
193
|
+
format?: string;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
name: {
|
|
197
|
+
keyword: 'name';
|
|
198
|
+
args: string;
|
|
199
|
+
};
|
|
200
|
+
catchall: {
|
|
201
|
+
keyword: 'catchall';
|
|
202
|
+
};
|
|
203
|
+
interface: {
|
|
204
|
+
keyword: 'interface';
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
declare const schemaKeywords: {
|
|
208
|
+
any: "any";
|
|
209
|
+
unknown: "unknown";
|
|
210
|
+
number: "number";
|
|
211
|
+
integer: "integer";
|
|
212
|
+
string: "string";
|
|
213
|
+
boolean: "boolean";
|
|
214
|
+
undefined: "undefined";
|
|
215
|
+
nullable: "nullable";
|
|
216
|
+
null: "null";
|
|
217
|
+
nullish: "nullish";
|
|
218
|
+
array: "array";
|
|
219
|
+
tuple: "tuple";
|
|
220
|
+
enum: "enum";
|
|
221
|
+
union: "union";
|
|
222
|
+
datetime: "datetime";
|
|
223
|
+
date: "date";
|
|
224
|
+
email: "email";
|
|
225
|
+
uuid: "uuid";
|
|
226
|
+
url: "url";
|
|
227
|
+
void: "void";
|
|
228
|
+
default: "default";
|
|
229
|
+
const: "const";
|
|
230
|
+
and: "and";
|
|
231
|
+
describe: "describe";
|
|
232
|
+
min: "min";
|
|
233
|
+
max: "max";
|
|
234
|
+
optional: "optional";
|
|
235
|
+
readOnly: "readOnly";
|
|
236
|
+
writeOnly: "writeOnly";
|
|
237
|
+
object: "object";
|
|
238
|
+
ref: "ref";
|
|
239
|
+
matches: "matches";
|
|
240
|
+
firstName: "firstName";
|
|
241
|
+
lastName: "lastName";
|
|
242
|
+
password: "password";
|
|
243
|
+
phone: "phone";
|
|
244
|
+
blob: "blob";
|
|
245
|
+
deprecated: "deprecated";
|
|
246
|
+
example: "example";
|
|
247
|
+
schema: "schema";
|
|
248
|
+
catchall: "catchall";
|
|
249
|
+
time: "time";
|
|
250
|
+
name: "name";
|
|
251
|
+
interface: "interface";
|
|
252
|
+
};
|
|
253
|
+
type SchemaKeyword = keyof SchemaKeywordMapper;
|
|
254
|
+
type SchemaMapper<T = string | null | undefined> = {
|
|
255
|
+
[K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined;
|
|
256
|
+
};
|
|
257
|
+
type SchemaKeywordBase<T> = {
|
|
258
|
+
keyword: SchemaKeyword;
|
|
259
|
+
args: T;
|
|
260
|
+
};
|
|
261
|
+
type Schema = {
|
|
262
|
+
keyword: string;
|
|
263
|
+
} | SchemaKeywordMapper[keyof SchemaKeywordMapper];
|
|
264
|
+
type SchemaTree = {
|
|
265
|
+
parent: Schema | undefined;
|
|
266
|
+
current: Schema;
|
|
267
|
+
siblings: Schema[];
|
|
268
|
+
/**
|
|
269
|
+
* this will be equal to the key of a property(object)
|
|
270
|
+
*/
|
|
271
|
+
name?: string;
|
|
272
|
+
};
|
|
273
|
+
declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
|
|
274
|
+
|
|
275
|
+
export { type Schema as S, type SchemaTree as a, type SchemaKeyword as b, type SchemaKeywordBase as c, type SchemaKeywordMapper as d, type SchemaMapper as e, isKeyword as i, schemaKeywords as s };
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { KubbFile } from '@kubb/core/fs';
|
|
2
|
+
|
|
3
|
+
type SchemaKeywordMapper = {
|
|
4
|
+
object: {
|
|
5
|
+
keyword: 'object';
|
|
6
|
+
args: {
|
|
7
|
+
properties: {
|
|
8
|
+
[x: string]: Schema[];
|
|
9
|
+
};
|
|
10
|
+
additionalProperties: Schema[];
|
|
11
|
+
strict?: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
url: {
|
|
15
|
+
keyword: 'url';
|
|
16
|
+
};
|
|
17
|
+
readOnly: {
|
|
18
|
+
keyword: 'readOnly';
|
|
19
|
+
};
|
|
20
|
+
writeOnly: {
|
|
21
|
+
keyword: 'writeOnly';
|
|
22
|
+
};
|
|
23
|
+
uuid: {
|
|
24
|
+
keyword: 'uuid';
|
|
25
|
+
};
|
|
26
|
+
email: {
|
|
27
|
+
keyword: 'email';
|
|
28
|
+
};
|
|
29
|
+
firstName: {
|
|
30
|
+
keyword: 'firstName';
|
|
31
|
+
};
|
|
32
|
+
lastName: {
|
|
33
|
+
keyword: 'lastName';
|
|
34
|
+
};
|
|
35
|
+
phone: {
|
|
36
|
+
keyword: 'phone';
|
|
37
|
+
};
|
|
38
|
+
password: {
|
|
39
|
+
keyword: 'password';
|
|
40
|
+
};
|
|
41
|
+
date: {
|
|
42
|
+
keyword: 'date';
|
|
43
|
+
args: {
|
|
44
|
+
type?: 'date' | 'string';
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
time: {
|
|
48
|
+
keyword: 'time';
|
|
49
|
+
args: {
|
|
50
|
+
type?: 'date' | 'string';
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
datetime: {
|
|
54
|
+
keyword: 'datetime';
|
|
55
|
+
args: {
|
|
56
|
+
offset?: boolean;
|
|
57
|
+
local?: boolean;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
tuple: {
|
|
61
|
+
keyword: 'tuple';
|
|
62
|
+
args: {
|
|
63
|
+
items: Schema[];
|
|
64
|
+
min?: number;
|
|
65
|
+
max?: number;
|
|
66
|
+
rest?: Schema;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
array: {
|
|
70
|
+
keyword: 'array';
|
|
71
|
+
args: {
|
|
72
|
+
items: Schema[];
|
|
73
|
+
min?: number;
|
|
74
|
+
max?: number;
|
|
75
|
+
unique?: boolean;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
enum: {
|
|
79
|
+
keyword: 'enum';
|
|
80
|
+
args: {
|
|
81
|
+
name: string;
|
|
82
|
+
typeName: string;
|
|
83
|
+
asConst: boolean;
|
|
84
|
+
items: Array<{
|
|
85
|
+
name: string | number;
|
|
86
|
+
format: 'string' | 'number' | 'boolean';
|
|
87
|
+
value?: string | number | boolean;
|
|
88
|
+
}>;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
and: {
|
|
92
|
+
keyword: 'and';
|
|
93
|
+
args: Schema[];
|
|
94
|
+
};
|
|
95
|
+
const: {
|
|
96
|
+
keyword: 'const';
|
|
97
|
+
args: {
|
|
98
|
+
name: string | number;
|
|
99
|
+
format: 'string' | 'number' | 'boolean';
|
|
100
|
+
value?: string | number | boolean;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
union: {
|
|
104
|
+
keyword: 'union';
|
|
105
|
+
args: Schema[];
|
|
106
|
+
};
|
|
107
|
+
ref: {
|
|
108
|
+
keyword: 'ref';
|
|
109
|
+
args: {
|
|
110
|
+
name: string;
|
|
111
|
+
$ref: string;
|
|
112
|
+
/**
|
|
113
|
+
* Full qualified path.
|
|
114
|
+
*/
|
|
115
|
+
path: KubbFile.OptionalPath;
|
|
116
|
+
/**
|
|
117
|
+
* When true `File.Import` will be used.
|
|
118
|
+
* When false a reference will be used inside the current file.
|
|
119
|
+
*/
|
|
120
|
+
isImportable: boolean;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
matches: {
|
|
124
|
+
keyword: 'matches';
|
|
125
|
+
args?: string;
|
|
126
|
+
};
|
|
127
|
+
boolean: {
|
|
128
|
+
keyword: 'boolean';
|
|
129
|
+
};
|
|
130
|
+
default: {
|
|
131
|
+
keyword: 'default';
|
|
132
|
+
args: string | number | boolean;
|
|
133
|
+
};
|
|
134
|
+
string: {
|
|
135
|
+
keyword: 'string';
|
|
136
|
+
};
|
|
137
|
+
integer: {
|
|
138
|
+
keyword: 'integer';
|
|
139
|
+
};
|
|
140
|
+
number: {
|
|
141
|
+
keyword: 'number';
|
|
142
|
+
};
|
|
143
|
+
max: {
|
|
144
|
+
keyword: 'max';
|
|
145
|
+
args: number;
|
|
146
|
+
};
|
|
147
|
+
min: {
|
|
148
|
+
keyword: 'min';
|
|
149
|
+
args: number;
|
|
150
|
+
};
|
|
151
|
+
describe: {
|
|
152
|
+
keyword: 'describe';
|
|
153
|
+
args: string;
|
|
154
|
+
};
|
|
155
|
+
example: {
|
|
156
|
+
keyword: 'example';
|
|
157
|
+
args: string;
|
|
158
|
+
};
|
|
159
|
+
deprecated: {
|
|
160
|
+
keyword: 'deprecated';
|
|
161
|
+
};
|
|
162
|
+
optional: {
|
|
163
|
+
keyword: 'optional';
|
|
164
|
+
};
|
|
165
|
+
undefined: {
|
|
166
|
+
keyword: 'undefined';
|
|
167
|
+
};
|
|
168
|
+
nullish: {
|
|
169
|
+
keyword: 'nullish';
|
|
170
|
+
};
|
|
171
|
+
nullable: {
|
|
172
|
+
keyword: 'nullable';
|
|
173
|
+
};
|
|
174
|
+
null: {
|
|
175
|
+
keyword: 'null';
|
|
176
|
+
};
|
|
177
|
+
any: {
|
|
178
|
+
keyword: 'any';
|
|
179
|
+
};
|
|
180
|
+
unknown: {
|
|
181
|
+
keyword: 'unknown';
|
|
182
|
+
};
|
|
183
|
+
void: {
|
|
184
|
+
keyword: 'void';
|
|
185
|
+
};
|
|
186
|
+
blob: {
|
|
187
|
+
keyword: 'blob';
|
|
188
|
+
};
|
|
189
|
+
schema: {
|
|
190
|
+
keyword: 'schema';
|
|
191
|
+
args: {
|
|
192
|
+
type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
|
|
193
|
+
format?: string;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
name: {
|
|
197
|
+
keyword: 'name';
|
|
198
|
+
args: string;
|
|
199
|
+
};
|
|
200
|
+
catchall: {
|
|
201
|
+
keyword: 'catchall';
|
|
202
|
+
};
|
|
203
|
+
interface: {
|
|
204
|
+
keyword: 'interface';
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
declare const schemaKeywords: {
|
|
208
|
+
any: "any";
|
|
209
|
+
unknown: "unknown";
|
|
210
|
+
number: "number";
|
|
211
|
+
integer: "integer";
|
|
212
|
+
string: "string";
|
|
213
|
+
boolean: "boolean";
|
|
214
|
+
undefined: "undefined";
|
|
215
|
+
nullable: "nullable";
|
|
216
|
+
null: "null";
|
|
217
|
+
nullish: "nullish";
|
|
218
|
+
array: "array";
|
|
219
|
+
tuple: "tuple";
|
|
220
|
+
enum: "enum";
|
|
221
|
+
union: "union";
|
|
222
|
+
datetime: "datetime";
|
|
223
|
+
date: "date";
|
|
224
|
+
email: "email";
|
|
225
|
+
uuid: "uuid";
|
|
226
|
+
url: "url";
|
|
227
|
+
void: "void";
|
|
228
|
+
default: "default";
|
|
229
|
+
const: "const";
|
|
230
|
+
and: "and";
|
|
231
|
+
describe: "describe";
|
|
232
|
+
min: "min";
|
|
233
|
+
max: "max";
|
|
234
|
+
optional: "optional";
|
|
235
|
+
readOnly: "readOnly";
|
|
236
|
+
writeOnly: "writeOnly";
|
|
237
|
+
object: "object";
|
|
238
|
+
ref: "ref";
|
|
239
|
+
matches: "matches";
|
|
240
|
+
firstName: "firstName";
|
|
241
|
+
lastName: "lastName";
|
|
242
|
+
password: "password";
|
|
243
|
+
phone: "phone";
|
|
244
|
+
blob: "blob";
|
|
245
|
+
deprecated: "deprecated";
|
|
246
|
+
example: "example";
|
|
247
|
+
schema: "schema";
|
|
248
|
+
catchall: "catchall";
|
|
249
|
+
time: "time";
|
|
250
|
+
name: "name";
|
|
251
|
+
interface: "interface";
|
|
252
|
+
};
|
|
253
|
+
type SchemaKeyword = keyof SchemaKeywordMapper;
|
|
254
|
+
type SchemaMapper<T = string | null | undefined> = {
|
|
255
|
+
[K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined;
|
|
256
|
+
};
|
|
257
|
+
type SchemaKeywordBase<T> = {
|
|
258
|
+
keyword: SchemaKeyword;
|
|
259
|
+
args: T;
|
|
260
|
+
};
|
|
261
|
+
type Schema = {
|
|
262
|
+
keyword: string;
|
|
263
|
+
} | SchemaKeywordMapper[keyof SchemaKeywordMapper];
|
|
264
|
+
type SchemaTree = {
|
|
265
|
+
parent: Schema | undefined;
|
|
266
|
+
current: Schema;
|
|
267
|
+
siblings: Schema[];
|
|
268
|
+
/**
|
|
269
|
+
* this will be equal to the key of a property(object)
|
|
270
|
+
*/
|
|
271
|
+
name?: string;
|
|
272
|
+
};
|
|
273
|
+
declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
|
|
274
|
+
|
|
275
|
+
export { type Schema as S, type SchemaTree as a, type SchemaKeyword as b, type SchemaKeywordBase as c, type SchemaKeywordMapper as d, type SchemaMapper as e, isKeyword as i, schemaKeywords as s };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getDefaultBanner } from '@kubb/core';
|
|
2
|
+
import { isFunction } from 'remeda';
|
|
3
|
+
|
|
4
|
+
// src/utils/getBanner.ts
|
|
5
|
+
function getBanner({ output, oas, config }) {
|
|
6
|
+
let banner = "";
|
|
7
|
+
if (config?.output?.defaultBanner !== false && config) {
|
|
8
|
+
const { title, description, version } = oas.api?.info || {};
|
|
9
|
+
banner = getDefaultBanner({ title, description, version, config });
|
|
10
|
+
}
|
|
11
|
+
if (!output.banner) {
|
|
12
|
+
return banner;
|
|
13
|
+
}
|
|
14
|
+
if (isFunction(output.banner)) {
|
|
15
|
+
return `${output.banner(oas)}
|
|
16
|
+
${banner}`;
|
|
17
|
+
}
|
|
18
|
+
return `${output.banner}
|
|
19
|
+
${banner}`;
|
|
20
|
+
}
|
|
21
|
+
function getFooter({ output, oas }) {
|
|
22
|
+
if (!output.footer) {
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
25
|
+
if (isFunction(output.footer)) {
|
|
26
|
+
return output.footer(oas);
|
|
27
|
+
}
|
|
28
|
+
return output.footer;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { getBanner, getFooter };
|
|
32
|
+
//# sourceMappingURL=chunk-6S7YFY6F.js.map
|
|
33
|
+
//# sourceMappingURL=chunk-6S7YFY6F.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/getBanner.ts","../src/utils/getFooter.ts"],"names":["isFunction"],"mappings":";;;;AAUO,SAAS,SAAU,CAAA,EAAE,MAAQ,EAAA,GAAA,EAAK,QAAiB,EAAA;AACxD,EAAA,IAAI,MAAS,GAAA,EAAA;AACb,EAAA,IAAI,MAAQ,EAAA,MAAA,EAAQ,aAAkB,KAAA,KAAA,IAAS,MAAQ,EAAA;AACrD,IAAM,MAAA,EAAE,OAAO,WAAa,EAAA,OAAA,KAAY,GAAI,CAAA,GAAA,EAAK,QAAQ,EAAC;AAE1D,IAAA,MAAA,GAAS,iBAAiB,EAAE,KAAA,EAAO,WAAa,EAAA,OAAA,EAAS,QAAQ,CAAA;AAAA;AAGnE,EAAI,IAAA,CAAC,OAAO,MAAQ,EAAA;AAClB,IAAO,OAAA,MAAA;AAAA;AAGT,EAAI,IAAA,UAAA,CAAW,MAAO,CAAA,MAAM,CAAG,EAAA;AAC7B,IAAA,OAAO,CAAG,EAAA,MAAA,CAAO,MAAO,CAAA,GAAG,CAAC;AAAA,EAAK,MAAM,CAAA,CAAA;AAAA;AAGzC,EAAO,OAAA,CAAA,EAAG,OAAO,MAAM;AAAA,EAAK,MAAM,CAAA,CAAA;AACpC;AClBO,SAAS,SAAU,CAAA,EAAE,MAAQ,EAAA,GAAA,EAAc,EAAA;AAChD,EAAI,IAAA,CAAC,OAAO,MAAQ,EAAA;AAClB,IAAO,OAAA,MAAA;AAAA;AAGT,EAAIA,IAAAA,UAAAA,CAAW,MAAO,CAAA,MAAM,CAAG,EAAA;AAC7B,IAAO,OAAA,MAAA,CAAO,OAAO,GAAG,CAAA;AAAA;AAG1B,EAAA,OAAO,MAAO,CAAA,MAAA;AAChB","file":"chunk-6S7YFY6F.js","sourcesContent":["import { getDefaultBanner, type Config, type Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props = {\n oas: Oas\n output: Output<Oas>\n config?: Config\n}\n\nexport function getBanner({ output, oas, config }: Props) {\n let banner = ''\n if (config?.output?.defaultBanner !== false && config) {\n const { title, description, version } = oas.api?.info || {}\n\n banner = getDefaultBanner({ title, description, version, config })\n }\n\n if (!output.banner) {\n return banner\n }\n\n if (isFunction(output.banner)) {\n return `${output.banner(oas)}\\n${banner}`\n }\n\n return `${output.banner}\\n${banner}`\n}\n","import type { Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props = {\n oas: Oas\n output: Output<Oas>\n}\n\nexport function getFooter({ output, oas }: Props) {\n if (!output.footer) {\n return undefined\n }\n\n if (isFunction(output.footer)) {\n return output.footer(oas)\n }\n\n return output.footer\n}\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// src/SchemaMapper.ts
|
|
2
|
+
var schemaKeywords = {
|
|
3
|
+
any: "any",
|
|
4
|
+
unknown: "unknown",
|
|
5
|
+
number: "number",
|
|
6
|
+
integer: "integer",
|
|
7
|
+
string: "string",
|
|
8
|
+
boolean: "boolean",
|
|
9
|
+
undefined: "undefined",
|
|
10
|
+
nullable: "nullable",
|
|
11
|
+
null: "null",
|
|
12
|
+
nullish: "nullish",
|
|
13
|
+
array: "array",
|
|
14
|
+
tuple: "tuple",
|
|
15
|
+
enum: "enum",
|
|
16
|
+
union: "union",
|
|
17
|
+
datetime: "datetime",
|
|
18
|
+
date: "date",
|
|
19
|
+
email: "email",
|
|
20
|
+
uuid: "uuid",
|
|
21
|
+
url: "url",
|
|
22
|
+
void: "void",
|
|
23
|
+
/* intersection */
|
|
24
|
+
default: "default",
|
|
25
|
+
const: "const",
|
|
26
|
+
and: "and",
|
|
27
|
+
describe: "describe",
|
|
28
|
+
min: "min",
|
|
29
|
+
max: "max",
|
|
30
|
+
optional: "optional",
|
|
31
|
+
readOnly: "readOnly",
|
|
32
|
+
writeOnly: "writeOnly",
|
|
33
|
+
// custom ones
|
|
34
|
+
object: "object",
|
|
35
|
+
ref: "ref",
|
|
36
|
+
matches: "matches",
|
|
37
|
+
firstName: "firstName",
|
|
38
|
+
lastName: "lastName",
|
|
39
|
+
password: "password",
|
|
40
|
+
phone: "phone",
|
|
41
|
+
blob: "blob",
|
|
42
|
+
deprecated: "deprecated",
|
|
43
|
+
example: "example",
|
|
44
|
+
schema: "schema",
|
|
45
|
+
catchall: "catchall",
|
|
46
|
+
time: "time",
|
|
47
|
+
name: "name",
|
|
48
|
+
interface: "interface"
|
|
49
|
+
};
|
|
50
|
+
function isKeyword(meta, keyword) {
|
|
51
|
+
return meta.keyword === keyword;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { isKeyword, schemaKeywords };
|
|
55
|
+
//# sourceMappingURL=chunk-76E35IZ2.js.map
|
|
56
|
+
//# sourceMappingURL=chunk-76E35IZ2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/SchemaMapper.ts"],"names":[],"mappings":";AA6FO,IAAM,cAAiB,GAAA;AAAA,EAC5B,GAAK,EAAA,KAAA;AAAA,EACL,OAAS,EAAA,SAAA;AAAA,EACT,MAAQ,EAAA,QAAA;AAAA,EACR,OAAS,EAAA,SAAA;AAAA,EACT,MAAQ,EAAA,QAAA;AAAA,EACR,OAAS,EAAA,SAAA;AAAA,EACT,SAAW,EAAA,WAAA;AAAA,EACX,QAAU,EAAA,UAAA;AAAA,EACV,IAAM,EAAA,MAAA;AAAA,EACN,OAAS,EAAA,SAAA;AAAA,EACT,KAAO,EAAA,OAAA;AAAA,EACP,KAAO,EAAA,OAAA;AAAA,EACP,IAAM,EAAA,MAAA;AAAA,EACN,KAAO,EAAA,OAAA;AAAA,EACP,QAAU,EAAA,UAAA;AAAA,EACV,IAAM,EAAA,MAAA;AAAA,EACN,KAAO,EAAA,OAAA;AAAA,EACP,IAAM,EAAA,MAAA;AAAA,EACN,GAAK,EAAA,KAAA;AAAA,EACL,IAAM,EAAA,MAAA;AAAA;AAAA,EAEN,OAAS,EAAA,SAAA;AAAA,EACT,KAAO,EAAA,OAAA;AAAA,EACP,GAAK,EAAA,KAAA;AAAA,EACL,QAAU,EAAA,UAAA;AAAA,EACV,GAAK,EAAA,KAAA;AAAA,EACL,GAAK,EAAA,KAAA;AAAA,EACL,QAAU,EAAA,UAAA;AAAA,EACV,QAAU,EAAA,UAAA;AAAA,EACV,SAAW,EAAA,WAAA;AAAA;AAAA,EAGX,MAAQ,EAAA,QAAA;AAAA,EACR,GAAK,EAAA,KAAA;AAAA,EACL,OAAS,EAAA,SAAA;AAAA,EACT,SAAW,EAAA,WAAA;AAAA,EACX,QAAU,EAAA,UAAA;AAAA,EACV,QAAU,EAAA,UAAA;AAAA,EACV,KAAO,EAAA,OAAA;AAAA,EACP,IAAM,EAAA,MAAA;AAAA,EACN,UAAY,EAAA,YAAA;AAAA,EACZ,OAAS,EAAA,SAAA;AAAA,EACT,MAAQ,EAAA,QAAA;AAAA,EACR,QAAU,EAAA,UAAA;AAAA,EACV,IAAM,EAAA,MAAA;AAAA,EACN,IAAM,EAAA,MAAA;AAAA,EACN,SAAW,EAAA;AACb;AA2BO,SAAS,SAAA,CAAiE,MAAS,OAAwD,EAAA;AAChJ,EAAA,OAAO,KAAK,OAAY,KAAA,OAAA;AAC1B","file":"chunk-76E35IZ2.js","sourcesContent":["import type { KubbFile } from '@kubb/core/fs'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: Schema[]\n strict?: boolean\n }\n }\n url: { keyword: 'url' }\n readOnly: { keyword: 'readOnly' }\n writeOnly: { keyword: 'writeOnly' }\n uuid: { keyword: 'uuid' }\n email: { keyword: 'email' }\n firstName: { keyword: 'firstName' }\n lastName: { keyword: 'lastName' }\n phone: { keyword: 'phone' }\n password: { keyword: 'password' }\n date: { keyword: 'date'; args: { type?: 'date' | 'string' } }\n time: { keyword: 'time'; args: { type?: 'date' | 'string' } }\n datetime: { keyword: 'datetime'; args: { offset?: boolean; local?: boolean } }\n tuple: { keyword: 'tuple'; args: { items: Schema[]; min?: number; max?: number; rest?: Schema } }\n array: {\n keyword: 'array'\n args: { items: Schema[]; min?: number; max?: number; unique?: boolean }\n }\n enum: {\n keyword: 'enum'\n args: {\n name: string\n typeName: string\n asConst: boolean\n items: Array<{\n name: string | number\n format: 'string' | 'number' | 'boolean'\n value?: string | number | boolean\n }>\n }\n }\n and: { keyword: 'and'; args: Schema[] }\n const: {\n keyword: 'const'\n args: {\n name: string | number\n format: 'string' | 'number' | 'boolean'\n value?: string | number | boolean\n }\n }\n union: { keyword: 'union'; args: Schema[] }\n ref: {\n keyword: 'ref'\n args: {\n name: string\n $ref: string\n /**\n * Full qualified path.\n */\n path: KubbFile.OptionalPath\n /**\n * When true `File.Import` will be used.\n * When false a reference will be used inside the current file.\n */\n isImportable: boolean\n }\n }\n matches: { keyword: 'matches'; args?: string }\n boolean: { keyword: 'boolean' }\n default: { keyword: 'default'; args: string | number | boolean }\n string: { keyword: 'string' }\n integer: { keyword: 'integer' }\n number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; args: number }\n describe: { keyword: 'describe'; args: string }\n example: { keyword: 'example'; args: string }\n deprecated: { keyword: 'deprecated' }\n optional: { keyword: 'optional' }\n undefined: { keyword: 'undefined' }\n nullish: { keyword: 'nullish' }\n nullable: { keyword: 'nullable' }\n null: { keyword: 'null' }\n any: { keyword: 'any' }\n unknown: { keyword: 'unknown' }\n void: { keyword: 'void' }\n blob: { keyword: 'blob' }\n schema: { keyword: 'schema'; args: { type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; format?: string } }\n name: { keyword: 'name'; args: string }\n catchall: { keyword: 'catchall' }\n interface: { keyword: 'interface' }\n}\n\nexport const schemaKeywords = {\n any: 'any',\n unknown: 'unknown',\n number: 'number',\n integer: 'integer',\n string: 'string',\n boolean: 'boolean',\n undefined: 'undefined',\n nullable: 'nullable',\n null: 'null',\n nullish: 'nullish',\n array: 'array',\n tuple: 'tuple',\n enum: 'enum',\n union: 'union',\n datetime: 'datetime',\n date: 'date',\n email: 'email',\n uuid: 'uuid',\n url: 'url',\n void: 'void',\n /* intersection */\n default: 'default',\n const: 'const',\n and: 'and',\n describe: 'describe',\n min: 'min',\n max: 'max',\n optional: 'optional',\n readOnly: 'readOnly',\n writeOnly: 'writeOnly',\n\n // custom ones\n object: 'object',\n ref: 'ref',\n matches: 'matches',\n firstName: 'firstName',\n lastName: 'lastName',\n password: 'password',\n phone: 'phone',\n blob: 'blob',\n deprecated: 'deprecated',\n example: 'example',\n schema: 'schema',\n catchall: 'catchall',\n time: 'time',\n name: 'name',\n interface: 'interface',\n} satisfies {\n [K in keyof SchemaKeywordMapper]: SchemaKeywordMapper[K]['keyword']\n}\n\nexport type SchemaKeyword = keyof SchemaKeywordMapper\n\nexport type SchemaMapper<T = string | null | undefined> = {\n [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined\n}\n\nexport type SchemaKeywordBase<T> = {\n keyword: SchemaKeyword\n args: T\n}\n\nexport type Schema = { keyword: string } | SchemaKeywordMapper[keyof SchemaKeywordMapper]\n\nexport type SchemaTree = {\n parent: Schema | undefined\n current: Schema\n siblings: Schema[]\n /**\n * this will be equal to the key of a property(object)\n */\n name?: string\n}\n\nexport function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]> {\n return meta.keyword === keyword\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@kubb/core');
|
|
4
|
+
var remeda = require('remeda');
|
|
5
|
+
|
|
6
|
+
// src/utils/getBanner.ts
|
|
7
|
+
function getBanner({ output, oas, config }) {
|
|
8
|
+
let banner = "";
|
|
9
|
+
if (config?.output?.defaultBanner !== false && config) {
|
|
10
|
+
const { title, description, version } = oas.api?.info || {};
|
|
11
|
+
banner = core.getDefaultBanner({ title, description, version, config });
|
|
12
|
+
}
|
|
13
|
+
if (!output.banner) {
|
|
14
|
+
return banner;
|
|
15
|
+
}
|
|
16
|
+
if (remeda.isFunction(output.banner)) {
|
|
17
|
+
return `${output.banner(oas)}
|
|
18
|
+
${banner}`;
|
|
19
|
+
}
|
|
20
|
+
return `${output.banner}
|
|
21
|
+
${banner}`;
|
|
22
|
+
}
|
|
23
|
+
function getFooter({ output, oas }) {
|
|
24
|
+
if (!output.footer) {
|
|
25
|
+
return void 0;
|
|
26
|
+
}
|
|
27
|
+
if (remeda.isFunction(output.footer)) {
|
|
28
|
+
return output.footer(oas);
|
|
29
|
+
}
|
|
30
|
+
return output.footer;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
exports.getBanner = getBanner;
|
|
34
|
+
exports.getFooter = getFooter;
|
|
35
|
+
//# sourceMappingURL=chunk-DTD4ZUDA.cjs.map
|
|
36
|
+
//# sourceMappingURL=chunk-DTD4ZUDA.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/getBanner.ts","../src/utils/getFooter.ts"],"names":["getDefaultBanner","isFunction"],"mappings":";;;;;;AAUO,SAAS,SAAU,CAAA,EAAE,MAAQ,EAAA,GAAA,EAAK,QAAiB,EAAA;AACxD,EAAA,IAAI,MAAS,GAAA,EAAA;AACb,EAAA,IAAI,MAAQ,EAAA,MAAA,EAAQ,aAAkB,KAAA,KAAA,IAAS,MAAQ,EAAA;AACrD,IAAM,MAAA,EAAE,OAAO,WAAa,EAAA,OAAA,KAAY,GAAI,CAAA,GAAA,EAAK,QAAQ,EAAC;AAE1D,IAAA,MAAA,GAASA,sBAAiB,EAAE,KAAA,EAAO,WAAa,EAAA,OAAA,EAAS,QAAQ,CAAA;AAAA;AAGnE,EAAI,IAAA,CAAC,OAAO,MAAQ,EAAA;AAClB,IAAO,OAAA,MAAA;AAAA;AAGT,EAAI,IAAAC,iBAAA,CAAW,MAAO,CAAA,MAAM,CAAG,EAAA;AAC7B,IAAA,OAAO,CAAG,EAAA,MAAA,CAAO,MAAO,CAAA,GAAG,CAAC;AAAA,EAAK,MAAM,CAAA,CAAA;AAAA;AAGzC,EAAO,OAAA,CAAA,EAAG,OAAO,MAAM;AAAA,EAAK,MAAM,CAAA,CAAA;AACpC;AClBO,SAAS,SAAU,CAAA,EAAE,MAAQ,EAAA,GAAA,EAAc,EAAA;AAChD,EAAI,IAAA,CAAC,OAAO,MAAQ,EAAA;AAClB,IAAO,OAAA,MAAA;AAAA;AAGT,EAAIA,IAAAA,iBAAAA,CAAW,MAAO,CAAA,MAAM,CAAG,EAAA;AAC7B,IAAO,OAAA,MAAA,CAAO,OAAO,GAAG,CAAA;AAAA;AAG1B,EAAA,OAAO,MAAO,CAAA,MAAA;AAChB","file":"chunk-DTD4ZUDA.cjs","sourcesContent":["import { getDefaultBanner, type Config, type Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props = {\n oas: Oas\n output: Output<Oas>\n config?: Config\n}\n\nexport function getBanner({ output, oas, config }: Props) {\n let banner = ''\n if (config?.output?.defaultBanner !== false && config) {\n const { title, description, version } = oas.api?.info || {}\n\n banner = getDefaultBanner({ title, description, version, config })\n }\n\n if (!output.banner) {\n return banner\n }\n\n if (isFunction(output.banner)) {\n return `${output.banner(oas)}\\n${banner}`\n }\n\n return `${output.banner}\\n${banner}`\n}\n","import type { Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props = {\n oas: Oas\n output: Output<Oas>\n}\n\nexport function getFooter({ output, oas }: Props) {\n if (!output.footer) {\n return undefined\n }\n\n if (isFunction(output.footer)) {\n return output.footer(oas)\n }\n\n return output.footer\n}\n"]}
|