@trayio/tray-openapi 5.35.0-unstable.fd7158a → 6.0.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.
- package/dist/OpenApiCodecs.d.ts +4 -207
- package/dist/OpenApiCodecs.d.ts.map +1 -1
- package/dist/OpenApiCodecs.js +3 -3
- package/dist/OpenApiSchemaImporter.d.ts +2 -2
- package/dist/OpenApiSchemaImporter.d.ts.map +1 -1
- package/dist/OpenApiSchemaImporter.js +55 -33
- package/dist/OpenApiSchemaImporter.unit.test.js +13 -24
- package/dist/OpenApiSchemaTransformer.d.ts +2 -2
- package/dist/OpenApiSchemaTransformer.d.ts.map +1 -1
- package/dist/OpenApiSchemaTransformer.js +25 -2
- package/dist/OpenApiSchemaTransformer.unit.test.js +44 -30
- package/dist/OpenApiTypeDescriptors.d.ts +32 -389
- package/dist/OpenApiTypeDescriptors.d.ts.map +1 -1
- package/dist/OpenApiTypeDescriptors.js +109 -80
- package/dist/file-generators/GenerateHandler.d.ts +2 -2
- package/dist/file-generators/GenerateHandler.d.ts.map +1 -1
- package/dist/file-generators/GenerateHandler.js +78 -75
- package/dist/file-generators/GenerateHandler.unit.test.js +97 -73
- package/dist/file-generators/GenerateHandlerTest.d.ts +2 -2
- package/dist/file-generators/GenerateHandlerTest.d.ts.map +1 -1
- package/dist/file-generators/GenerateHandlerTest.js +76 -69
- package/dist/file-generators/GenerateHandlerTest.unit.test.js +230 -206
- package/dist/file-generators/GenerateOperationJson.d.ts +2 -2
- package/dist/file-generators/GenerateOperationJson.d.ts.map +1 -1
- package/dist/file-generators/GenerateOperationJson.js +29 -4
- package/dist/file-generators/GenerateOperationJson.unit.test.js +49 -25
- package/dist/file-generators/SchemaGenerator.d.ts.map +1 -1
- package/dist/file-generators/SchemaGenerator.js +37 -14
- package/dist/file-generators/types/GenerateInputSchema.d.ts +2 -2
- package/dist/file-generators/types/GenerateInputSchema.d.ts.map +1 -1
- package/dist/file-generators/types/GenerateInputSchema.js +95 -88
- package/dist/file-generators/types/GenerateInputSchema.test.js +91 -60
- package/dist/file-generators/types/GenerateInputType.test.js +169 -143
- package/dist/file-generators/types/GenerateInputTypes.d.ts +2 -2
- package/dist/file-generators/types/GenerateInputTypes.d.ts.map +1 -1
- package/dist/file-generators/types/GenerateInputTypes.js +28 -7
- package/dist/file-generators/types/GenerateOutput.d.ts +6 -4
- package/dist/file-generators/types/GenerateOutput.d.ts.map +1 -1
- package/dist/file-generators/types/GenerateOutput.js +57 -46
- package/dist/file-generators/types/GenerateOutput.test.js +62 -35
- package/package.json +8 -6
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
26
|
+
const E = __importStar(require("fp-ts/Either"));
|
|
27
|
+
const O = __importStar(require("fp-ts/Option"));
|
|
4
28
|
const GenerateHandlerTest_1 = require("./GenerateHandlerTest");
|
|
5
29
|
const SchemaGenerator_1 = require("./SchemaGenerator");
|
|
6
30
|
describe('GenerateHandlerTest', () => {
|
|
@@ -8,40 +32,40 @@ describe('GenerateHandlerTest', () => {
|
|
|
8
32
|
const input = {
|
|
9
33
|
operationNameCamelCase: 'getItem',
|
|
10
34
|
input: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
11
|
-
type:
|
|
12
|
-
properties:
|
|
35
|
+
type: O.some('object'),
|
|
36
|
+
properties: O.some({
|
|
13
37
|
id: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
14
|
-
type:
|
|
15
|
-
additionalProperties:
|
|
38
|
+
type: O.some('integer'),
|
|
39
|
+
additionalProperties: O.some(false),
|
|
16
40
|
}),
|
|
17
41
|
name: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
18
|
-
type:
|
|
19
|
-
additionalProperties:
|
|
42
|
+
type: O.some('string'),
|
|
43
|
+
additionalProperties: O.some(false),
|
|
20
44
|
}),
|
|
21
45
|
}),
|
|
22
|
-
required:
|
|
23
|
-
additionalProperties:
|
|
46
|
+
required: O.some(['id', 'name']),
|
|
47
|
+
additionalProperties: O.some(false),
|
|
24
48
|
}),
|
|
25
49
|
output: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
26
|
-
type:
|
|
27
|
-
properties:
|
|
50
|
+
type: O.some('object'),
|
|
51
|
+
properties: O.some({
|
|
28
52
|
id: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
29
|
-
title:
|
|
30
|
-
type:
|
|
31
|
-
additionalProperties:
|
|
53
|
+
title: O.none,
|
|
54
|
+
type: O.some('integer'),
|
|
55
|
+
additionalProperties: O.some(false),
|
|
32
56
|
}),
|
|
33
57
|
name: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
34
|
-
title:
|
|
35
|
-
type:
|
|
36
|
-
additionalProperties:
|
|
58
|
+
title: O.none,
|
|
59
|
+
type: O.some('string'),
|
|
60
|
+
additionalProperties: O.some(false),
|
|
37
61
|
}),
|
|
38
62
|
}),
|
|
39
|
-
required:
|
|
40
|
-
additionalProperties:
|
|
63
|
+
required: O.some(['id']),
|
|
64
|
+
additionalProperties: O.some(false),
|
|
41
65
|
}),
|
|
42
66
|
};
|
|
43
67
|
const result = (0, GenerateHandlerTest_1.generateHandlerTest)(input);
|
|
44
|
-
if (
|
|
68
|
+
if (E.isLeft(result)) {
|
|
45
69
|
console.log(result.left);
|
|
46
70
|
throw new Error('Expected right');
|
|
47
71
|
}
|
|
@@ -75,20 +99,20 @@ describe('GenerateHandlerTest', () => {
|
|
|
75
99
|
operationNameCamelCase: 'getItem',
|
|
76
100
|
input: (0, SchemaGenerator_1.generateNonArraySchemaObject)({}),
|
|
77
101
|
output: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
78
|
-
type:
|
|
79
|
-
properties:
|
|
102
|
+
type: O.some('object'),
|
|
103
|
+
properties: O.some({
|
|
80
104
|
success: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
81
|
-
title:
|
|
82
|
-
type:
|
|
83
|
-
additionalProperties:
|
|
105
|
+
title: O.none,
|
|
106
|
+
type: O.some('boolean'),
|
|
107
|
+
additionalProperties: O.some(false),
|
|
84
108
|
}),
|
|
85
109
|
}),
|
|
86
|
-
required:
|
|
87
|
-
additionalProperties:
|
|
110
|
+
required: O.some(['success']),
|
|
111
|
+
additionalProperties: O.some(false),
|
|
88
112
|
}),
|
|
89
113
|
};
|
|
90
114
|
const result = (0, GenerateHandlerTest_1.generateHandlerTest)(input);
|
|
91
|
-
if (
|
|
115
|
+
if (E.isLeft(result)) {
|
|
92
116
|
console.log(result.left);
|
|
93
117
|
throw new Error('Expected right');
|
|
94
118
|
}
|
|
@@ -120,47 +144,47 @@ describe('GenerateHandlerTest', () => {
|
|
|
120
144
|
const input = {
|
|
121
145
|
operationNameCamelCase: 'createPerson',
|
|
122
146
|
input: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
123
|
-
type:
|
|
124
|
-
properties:
|
|
147
|
+
type: O.some('object'),
|
|
148
|
+
properties: O.some({
|
|
125
149
|
metadata: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
126
|
-
type:
|
|
127
|
-
properties:
|
|
150
|
+
type: O.some('object'),
|
|
151
|
+
properties: O.some({
|
|
128
152
|
name: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
129
|
-
title:
|
|
130
|
-
type:
|
|
131
|
-
additionalProperties:
|
|
153
|
+
title: O.none,
|
|
154
|
+
type: O.some('string'),
|
|
155
|
+
additionalProperties: O.some(false),
|
|
132
156
|
}),
|
|
133
157
|
age: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
134
|
-
title:
|
|
135
|
-
type:
|
|
136
|
-
additionalProperties:
|
|
158
|
+
title: O.none,
|
|
159
|
+
type: O.some('integer'),
|
|
160
|
+
additionalProperties: O.some(false),
|
|
137
161
|
}),
|
|
138
162
|
}),
|
|
139
|
-
additionalProperties:
|
|
163
|
+
additionalProperties: O.some(false),
|
|
140
164
|
}),
|
|
141
165
|
}),
|
|
142
|
-
additionalProperties:
|
|
166
|
+
additionalProperties: O.some(false),
|
|
143
167
|
}),
|
|
144
168
|
output: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
145
|
-
type:
|
|
146
|
-
properties:
|
|
169
|
+
type: O.some('object'),
|
|
170
|
+
properties: O.some({
|
|
147
171
|
parents: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
148
|
-
type:
|
|
149
|
-
properties:
|
|
172
|
+
type: O.some('object'),
|
|
173
|
+
properties: O.some({
|
|
150
174
|
child: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
151
|
-
title:
|
|
152
|
-
type:
|
|
153
|
-
additionalProperties:
|
|
175
|
+
title: O.none,
|
|
176
|
+
type: O.some('string'),
|
|
177
|
+
additionalProperties: O.some(false),
|
|
154
178
|
}),
|
|
155
179
|
}),
|
|
156
|
-
additionalProperties:
|
|
180
|
+
additionalProperties: O.some(false),
|
|
157
181
|
}),
|
|
158
182
|
}),
|
|
159
|
-
additionalProperties:
|
|
183
|
+
additionalProperties: O.some(false),
|
|
160
184
|
}),
|
|
161
185
|
};
|
|
162
186
|
const result = (0, GenerateHandlerTest_1.generateHandlerTest)(input);
|
|
163
|
-
if (
|
|
187
|
+
if (E.isLeft(result)) {
|
|
164
188
|
console.log(result.left);
|
|
165
189
|
throw new Error('Expected right');
|
|
166
190
|
}
|
|
@@ -192,60 +216,60 @@ describe('GenerateHandlerTest', () => {
|
|
|
192
216
|
const input = {
|
|
193
217
|
operationNameCamelCase: 'listItems',
|
|
194
218
|
input: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
195
|
-
type:
|
|
196
|
-
properties:
|
|
219
|
+
type: O.some('object'),
|
|
220
|
+
properties: O.some({
|
|
197
221
|
ids: {
|
|
198
|
-
title:
|
|
199
|
-
type:
|
|
222
|
+
title: O.none,
|
|
223
|
+
type: O.some('array'),
|
|
200
224
|
items: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
201
|
-
title:
|
|
202
|
-
type:
|
|
203
|
-
additionalProperties:
|
|
225
|
+
title: O.none,
|
|
226
|
+
type: O.some('integer'),
|
|
227
|
+
additionalProperties: O.some(false),
|
|
204
228
|
}),
|
|
205
|
-
properties:
|
|
206
|
-
required:
|
|
207
|
-
additionalProperties:
|
|
208
|
-
allOf:
|
|
209
|
-
anyOf:
|
|
210
|
-
oneOf:
|
|
211
|
-
not:
|
|
212
|
-
in:
|
|
213
|
-
default:
|
|
214
|
-
nullable:
|
|
215
|
-
enum:
|
|
229
|
+
properties: O.none,
|
|
230
|
+
required: O.none,
|
|
231
|
+
additionalProperties: O.some(false),
|
|
232
|
+
allOf: O.none,
|
|
233
|
+
anyOf: O.none,
|
|
234
|
+
oneOf: O.none,
|
|
235
|
+
not: O.none,
|
|
236
|
+
in: O.none,
|
|
237
|
+
default: O.none,
|
|
238
|
+
nullable: O.none,
|
|
239
|
+
enum: O.none,
|
|
216
240
|
},
|
|
217
241
|
}),
|
|
218
|
-
additionalProperties:
|
|
242
|
+
additionalProperties: O.some(false),
|
|
219
243
|
}),
|
|
220
244
|
output: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
221
|
-
type:
|
|
222
|
-
properties:
|
|
245
|
+
type: O.some('object'),
|
|
246
|
+
properties: O.some({
|
|
223
247
|
parents: {
|
|
224
|
-
title:
|
|
225
|
-
type:
|
|
248
|
+
title: O.none,
|
|
249
|
+
type: O.some('array'),
|
|
226
250
|
items: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
227
|
-
title:
|
|
228
|
-
type:
|
|
229
|
-
additionalProperties:
|
|
251
|
+
title: O.none,
|
|
252
|
+
type: O.some('string'),
|
|
253
|
+
additionalProperties: O.some(false),
|
|
230
254
|
}),
|
|
231
|
-
properties:
|
|
232
|
-
required:
|
|
233
|
-
additionalProperties:
|
|
234
|
-
allOf:
|
|
235
|
-
anyOf:
|
|
236
|
-
oneOf:
|
|
237
|
-
not:
|
|
238
|
-
in:
|
|
239
|
-
default:
|
|
240
|
-
nullable:
|
|
241
|
-
enum:
|
|
255
|
+
properties: O.none,
|
|
256
|
+
required: O.none,
|
|
257
|
+
additionalProperties: O.some(false),
|
|
258
|
+
allOf: O.none,
|
|
259
|
+
anyOf: O.none,
|
|
260
|
+
oneOf: O.none,
|
|
261
|
+
not: O.none,
|
|
262
|
+
in: O.none,
|
|
263
|
+
default: O.none,
|
|
264
|
+
nullable: O.none,
|
|
265
|
+
enum: O.none,
|
|
242
266
|
},
|
|
243
267
|
}),
|
|
244
|
-
additionalProperties:
|
|
268
|
+
additionalProperties: O.some(false),
|
|
245
269
|
}),
|
|
246
270
|
};
|
|
247
271
|
const result = (0, GenerateHandlerTest_1.generateHandlerTest)(input);
|
|
248
|
-
if (
|
|
272
|
+
if (E.isLeft(result)) {
|
|
249
273
|
console.log(result.left);
|
|
250
274
|
throw new Error('Expected right');
|
|
251
275
|
}
|
|
@@ -278,55 +302,55 @@ describe('GenerateHandlerTest', () => {
|
|
|
278
302
|
operationNameCamelCase: 'listItems',
|
|
279
303
|
input: (0, SchemaGenerator_1.generateNonArraySchemaObject)({}),
|
|
280
304
|
output: {
|
|
281
|
-
type:
|
|
282
|
-
title:
|
|
283
|
-
properties:
|
|
305
|
+
type: O.some('object'),
|
|
306
|
+
title: O.none,
|
|
307
|
+
properties: O.some({
|
|
284
308
|
parents: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
285
|
-
type:
|
|
286
|
-
properties:
|
|
309
|
+
type: O.some('object'),
|
|
310
|
+
properties: O.some({
|
|
287
311
|
child: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
288
|
-
title:
|
|
289
|
-
type:
|
|
290
|
-
additionalProperties:
|
|
312
|
+
title: O.none,
|
|
313
|
+
type: O.some('string'),
|
|
314
|
+
additionalProperties: O.some(false),
|
|
291
315
|
}),
|
|
292
316
|
valueList: {
|
|
293
|
-
title:
|
|
294
|
-
type:
|
|
317
|
+
title: O.none,
|
|
318
|
+
type: O.some('array'),
|
|
295
319
|
items: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
296
|
-
title:
|
|
297
|
-
type:
|
|
298
|
-
additionalProperties:
|
|
320
|
+
title: O.none,
|
|
321
|
+
type: O.some('string'),
|
|
322
|
+
additionalProperties: O.some(false),
|
|
299
323
|
}),
|
|
300
|
-
properties:
|
|
301
|
-
required:
|
|
302
|
-
additionalProperties:
|
|
303
|
-
allOf:
|
|
304
|
-
anyOf:
|
|
305
|
-
oneOf:
|
|
306
|
-
not:
|
|
307
|
-
in:
|
|
308
|
-
default:
|
|
309
|
-
nullable:
|
|
310
|
-
enum:
|
|
324
|
+
properties: O.none,
|
|
325
|
+
required: O.none,
|
|
326
|
+
additionalProperties: O.some(false),
|
|
327
|
+
allOf: O.none,
|
|
328
|
+
anyOf: O.none,
|
|
329
|
+
oneOf: O.none,
|
|
330
|
+
not: O.none,
|
|
331
|
+
in: O.none,
|
|
332
|
+
default: O.none,
|
|
333
|
+
nullable: O.none,
|
|
334
|
+
enum: O.none,
|
|
311
335
|
},
|
|
312
336
|
}),
|
|
313
|
-
additionalProperties:
|
|
337
|
+
additionalProperties: O.some(false),
|
|
314
338
|
}),
|
|
315
339
|
}),
|
|
316
|
-
required:
|
|
317
|
-
additionalProperties:
|
|
318
|
-
allOf:
|
|
319
|
-
anyOf:
|
|
320
|
-
oneOf:
|
|
321
|
-
not:
|
|
322
|
-
in:
|
|
323
|
-
default:
|
|
324
|
-
nullable:
|
|
325
|
-
enum:
|
|
340
|
+
required: O.none,
|
|
341
|
+
additionalProperties: O.some(false),
|
|
342
|
+
allOf: O.none,
|
|
343
|
+
anyOf: O.none,
|
|
344
|
+
oneOf: O.none,
|
|
345
|
+
not: O.none,
|
|
346
|
+
in: O.none,
|
|
347
|
+
default: O.none,
|
|
348
|
+
nullable: O.none,
|
|
349
|
+
enum: O.none,
|
|
326
350
|
},
|
|
327
351
|
};
|
|
328
352
|
const result = (0, GenerateHandlerTest_1.generateHandlerTest)(input);
|
|
329
|
-
if (
|
|
353
|
+
if (E.isLeft(result)) {
|
|
330
354
|
console.log(result.left);
|
|
331
355
|
throw new Error('Expected right');
|
|
332
356
|
}
|
|
@@ -359,39 +383,39 @@ describe('GenerateHandlerTest', () => {
|
|
|
359
383
|
operationNameCamelCase: 'listItems',
|
|
360
384
|
input: (0, SchemaGenerator_1.generateNonArraySchemaObject)({}),
|
|
361
385
|
output: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
362
|
-
type:
|
|
363
|
-
properties:
|
|
386
|
+
type: O.some('object'),
|
|
387
|
+
properties: O.some({
|
|
364
388
|
parents: {
|
|
365
|
-
title:
|
|
366
|
-
type:
|
|
389
|
+
title: O.none,
|
|
390
|
+
type: O.some('array'),
|
|
367
391
|
items: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
368
|
-
type:
|
|
369
|
-
properties:
|
|
392
|
+
type: O.some('object'),
|
|
393
|
+
properties: O.some({
|
|
370
394
|
child: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
371
|
-
title:
|
|
372
|
-
type:
|
|
373
|
-
additionalProperties:
|
|
395
|
+
title: O.none,
|
|
396
|
+
type: O.some('string'),
|
|
397
|
+
additionalProperties: O.some(false),
|
|
374
398
|
}),
|
|
375
399
|
}),
|
|
376
400
|
}),
|
|
377
|
-
properties:
|
|
378
|
-
required:
|
|
379
|
-
additionalProperties:
|
|
380
|
-
allOf:
|
|
381
|
-
anyOf:
|
|
382
|
-
oneOf:
|
|
383
|
-
not:
|
|
384
|
-
in:
|
|
385
|
-
default:
|
|
386
|
-
nullable:
|
|
387
|
-
enum:
|
|
401
|
+
properties: O.none,
|
|
402
|
+
required: O.none,
|
|
403
|
+
additionalProperties: O.some(false),
|
|
404
|
+
allOf: O.none,
|
|
405
|
+
anyOf: O.none,
|
|
406
|
+
oneOf: O.none,
|
|
407
|
+
not: O.none,
|
|
408
|
+
in: O.none,
|
|
409
|
+
default: O.none,
|
|
410
|
+
nullable: O.none,
|
|
411
|
+
enum: O.none,
|
|
388
412
|
},
|
|
389
413
|
}),
|
|
390
|
-
additionalProperties:
|
|
414
|
+
additionalProperties: O.some(false),
|
|
391
415
|
}),
|
|
392
416
|
};
|
|
393
417
|
const result = (0, GenerateHandlerTest_1.generateHandlerTest)(input);
|
|
394
|
-
if (
|
|
418
|
+
if (E.isLeft(result)) {
|
|
395
419
|
console.log(result.left);
|
|
396
420
|
throw new Error('Expected right');
|
|
397
421
|
}
|
|
@@ -423,53 +447,53 @@ describe('GenerateHandlerTest', () => {
|
|
|
423
447
|
const input = {
|
|
424
448
|
operationNameCamelCase: 'listItems',
|
|
425
449
|
input: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
426
|
-
type:
|
|
427
|
-
properties:
|
|
450
|
+
type: O.some('object'),
|
|
451
|
+
properties: O.some({
|
|
428
452
|
parents: {
|
|
429
|
-
title:
|
|
430
|
-
type:
|
|
453
|
+
title: O.none,
|
|
454
|
+
type: O.some('array'),
|
|
431
455
|
items: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
432
|
-
type:
|
|
433
|
-
title:
|
|
434
|
-
properties:
|
|
456
|
+
type: O.some('object'),
|
|
457
|
+
title: O.some('Code interpreter tool'),
|
|
458
|
+
properties: O.some({
|
|
435
459
|
type: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
436
|
-
title:
|
|
437
|
-
type:
|
|
438
|
-
enum:
|
|
460
|
+
title: O.none,
|
|
461
|
+
type: O.some('string'),
|
|
462
|
+
enum: O.some(['code_interpreter']),
|
|
439
463
|
}),
|
|
440
464
|
}),
|
|
441
|
-
required:
|
|
465
|
+
required: O.some(['type']),
|
|
442
466
|
}),
|
|
443
|
-
properties:
|
|
444
|
-
required:
|
|
445
|
-
additionalProperties:
|
|
446
|
-
allOf:
|
|
447
|
-
anyOf:
|
|
448
|
-
oneOf:
|
|
449
|
-
not:
|
|
450
|
-
in:
|
|
451
|
-
default:
|
|
452
|
-
nullable:
|
|
453
|
-
enum:
|
|
467
|
+
properties: O.none,
|
|
468
|
+
required: O.none,
|
|
469
|
+
additionalProperties: O.some(false),
|
|
470
|
+
allOf: O.none,
|
|
471
|
+
anyOf: O.none,
|
|
472
|
+
oneOf: O.none,
|
|
473
|
+
not: O.none,
|
|
474
|
+
in: O.none,
|
|
475
|
+
default: O.none,
|
|
476
|
+
nullable: O.none,
|
|
477
|
+
enum: O.none,
|
|
454
478
|
},
|
|
455
479
|
}),
|
|
456
|
-
additionalProperties:
|
|
480
|
+
additionalProperties: O.some(false),
|
|
457
481
|
}),
|
|
458
482
|
output: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
459
|
-
type:
|
|
460
|
-
properties:
|
|
483
|
+
type: O.some('object'),
|
|
484
|
+
properties: O.some({
|
|
461
485
|
success: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
462
|
-
title:
|
|
463
|
-
type:
|
|
464
|
-
additionalProperties:
|
|
486
|
+
title: O.none,
|
|
487
|
+
type: O.some('boolean'),
|
|
488
|
+
additionalProperties: O.some(false),
|
|
465
489
|
}),
|
|
466
490
|
}),
|
|
467
|
-
required:
|
|
468
|
-
additionalProperties:
|
|
491
|
+
required: O.some(['success']),
|
|
492
|
+
additionalProperties: O.some(false),
|
|
469
493
|
}),
|
|
470
494
|
};
|
|
471
495
|
const result = (0, GenerateHandlerTest_1.generateHandlerTest)(input);
|
|
472
|
-
if (
|
|
496
|
+
if (E.isLeft(result)) {
|
|
473
497
|
console.log(result.left);
|
|
474
498
|
throw new Error('Expected right');
|
|
475
499
|
}
|
|
@@ -501,50 +525,50 @@ describe('GenerateHandlerTest', () => {
|
|
|
501
525
|
const input = {
|
|
502
526
|
operationNameCamelCase: 'listItems',
|
|
503
527
|
input: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
504
|
-
type:
|
|
505
|
-
properties:
|
|
528
|
+
type: O.some('object'),
|
|
529
|
+
properties: O.some({
|
|
506
530
|
parents: {
|
|
507
|
-
title:
|
|
508
|
-
type:
|
|
531
|
+
title: O.none,
|
|
532
|
+
type: O.some('array'),
|
|
509
533
|
items: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
510
|
-
oneOf:
|
|
534
|
+
oneOf: O.some([
|
|
511
535
|
(0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
512
|
-
type:
|
|
513
|
-
default:
|
|
536
|
+
type: O.some('string'),
|
|
537
|
+
default: O.some('generated'),
|
|
514
538
|
}),
|
|
515
|
-
(0, SchemaGenerator_1.generateNonArraySchemaObject)({ type:
|
|
539
|
+
(0, SchemaGenerator_1.generateNonArraySchemaObject)({ type: O.some('integer') }),
|
|
516
540
|
]),
|
|
517
541
|
}),
|
|
518
|
-
properties:
|
|
519
|
-
required:
|
|
520
|
-
additionalProperties:
|
|
521
|
-
allOf:
|
|
522
|
-
anyOf:
|
|
523
|
-
oneOf:
|
|
524
|
-
not:
|
|
525
|
-
in:
|
|
526
|
-
default:
|
|
527
|
-
nullable:
|
|
528
|
-
enum:
|
|
542
|
+
properties: O.none,
|
|
543
|
+
required: O.none,
|
|
544
|
+
additionalProperties: O.some(false),
|
|
545
|
+
allOf: O.none,
|
|
546
|
+
anyOf: O.none,
|
|
547
|
+
oneOf: O.none,
|
|
548
|
+
not: O.none,
|
|
549
|
+
in: O.none,
|
|
550
|
+
default: O.none,
|
|
551
|
+
nullable: O.none,
|
|
552
|
+
enum: O.none,
|
|
529
553
|
},
|
|
530
554
|
}),
|
|
531
|
-
additionalProperties:
|
|
555
|
+
additionalProperties: O.some(false),
|
|
532
556
|
}),
|
|
533
557
|
output: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
534
|
-
type:
|
|
535
|
-
properties:
|
|
558
|
+
type: O.some('object'),
|
|
559
|
+
properties: O.some({
|
|
536
560
|
success: (0, SchemaGenerator_1.generateNonArraySchemaObject)({
|
|
537
|
-
title:
|
|
538
|
-
type:
|
|
539
|
-
additionalProperties:
|
|
561
|
+
title: O.none,
|
|
562
|
+
type: O.some('boolean'),
|
|
563
|
+
additionalProperties: O.some(false),
|
|
540
564
|
}),
|
|
541
565
|
}),
|
|
542
|
-
required:
|
|
543
|
-
additionalProperties:
|
|
566
|
+
required: O.some(['success']),
|
|
567
|
+
additionalProperties: O.some(false),
|
|
544
568
|
}),
|
|
545
569
|
};
|
|
546
570
|
const result = (0, GenerateHandlerTest_1.generateHandlerTest)(input);
|
|
547
|
-
if (
|
|
571
|
+
if (E.isLeft(result)) {
|
|
548
572
|
console.log(result.left);
|
|
549
573
|
throw new Error('Expected right');
|
|
550
574
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as TE from 'fp-ts/TaskEither';
|
|
2
2
|
import { Path } from '../OpenApiTypeDescriptors';
|
|
3
|
-
export declare const generateOperationJson: (operationName: string, path: Path) =>
|
|
3
|
+
export declare const generateOperationJson: (operationName: string, path: Path) => TE.TaskEither<Error, string>;
|
|
4
4
|
//# sourceMappingURL=GenerateOperationJson.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateOperationJson.d.ts","sourceRoot":"","sources":["../../src/file-generators/GenerateOperationJson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"GenerateOperationJson.d.ts","sourceRoot":"","sources":["../../src/file-generators/GenerateOperationJson.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAIvC,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAEjD,eAAO,MAAM,qBAAqB,kBAClB,MAAM,QACf,IAAI,KACR,GAAG,UAAU,CAAC,KAAK,EAAE,MAAM,CAyB7B,CAAC"}
|