@trayio/tray-openapi 4.2.1 → 4.2.3
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/OpenApiTypeDescriptors.d.ts +1 -0
- package/dist/OpenApiTypeDescriptors.d.ts.map +1 -1
- package/dist/OpenApiTypeDescriptors.js +6 -0
- package/dist/file-generators/GenerateHandler.d.ts.map +1 -1
- package/dist/file-generators/GenerateHandler.test.js +18 -0
- package/dist/file-generators/GenerateHandlerTest.d.ts.map +1 -1
- package/dist/file-generators/GenerateHandlerTest.js +22 -5
- package/dist/file-generators/GenerateHandlerTest.test.js +43 -10
- package/dist/file-generators/types/GenerateInputSchema.d.ts.map +1 -1
- package/dist/file-generators/types/GenerateInputSchema.js +3 -0
- package/dist/file-generators/types/GenerateInputSchema.test.js +9 -0
- package/dist/file-generators/types/GenerateInputType.test.js +22 -0
- package/dist/file-generators/types/GenerateOutput.d.ts.map +1 -1
- package/dist/file-generators/types/GenerateOutput.js +1 -0
- package/dist/file-generators/types/GenerateOutput.test.js +10 -0
- package/package.json +1 -1
|
@@ -100,6 +100,7 @@ export type BaseSchemaObject = {
|
|
|
100
100
|
anyOf: O.Option<SchemaObject[]>;
|
|
101
101
|
not: O.Option<SchemaObject>;
|
|
102
102
|
in: O.Option<string>;
|
|
103
|
+
default: O.Option<string | number | boolean | Array<string | number | boolean>>;
|
|
103
104
|
};
|
|
104
105
|
export declare const baseSchemaObjectSchemaTypeDescriptor: t.Type<BaseSchemaObject, unknown>;
|
|
105
106
|
export declare const schemaObjectTypeDescriptor: t.Type<SchemaObject, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenApiTypeDescriptors.d.ts","sourceRoot":"","sources":["../src/OpenApiTypeDescriptors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAE3B,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAKlC,MAAM,MAAM,Q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', () => t
|
|
|
45
45
|
anyOf: (0, io_ts_types_1.optionFromNullable)(t.array(exports.schemaObjectTypeDescriptor)),
|
|
46
46
|
not: (0, io_ts_types_1.optionFromNullable)(exports.schemaObjectTypeDescriptor),
|
|
47
47
|
in: (0, io_ts_types_1.optionFromNullable)(t.string),
|
|
48
|
+
default: (0, io_ts_types_1.optionFromNullable)(t.union([
|
|
49
|
+
t.string,
|
|
50
|
+
t.number,
|
|
51
|
+
t.boolean,
|
|
52
|
+
t.array(t.union([t.string, t.number, t.boolean])),
|
|
53
|
+
])),
|
|
48
54
|
}));
|
|
49
55
|
const arraySchemaObjectSchemaTypeDescriptor = t.recursion('ArraySchema', () => t.intersection([
|
|
50
56
|
exports.baseSchemaObjectSchemaTypeDescriptor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateHandler.d.ts","sourceRoot":"","sources":["../../src/file-generators/GenerateHandler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"GenerateHandler.d.ts","sourceRoot":"","sources":["../../src/file-generators/GenerateHandler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAoB,MAAM,2BAA2B,CAAC;AAE3E,KAAK,iBAAiB,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAErE,MAAM,MAAM,oBAAoB,GAAG;IAClC,uBAAuB,EAAE,MAAM,CAAC;IAChC,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;CACpB,CAAC;AAiHF,eAAO,MAAM,eAAe,wHAQzB,oBAAoB,KAAG,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAoB9C,CAAC"}
|
|
@@ -43,6 +43,7 @@ const getGenerateHandlerInput = (input) => ({
|
|
|
43
43
|
not: O.none,
|
|
44
44
|
in: O.none,
|
|
45
45
|
type: O.none,
|
|
46
|
+
default: O.none,
|
|
46
47
|
},
|
|
47
48
|
httpPath: '/photos',
|
|
48
49
|
...input,
|
|
@@ -85,6 +86,7 @@ describe('GenerateHandler', () => {
|
|
|
85
86
|
oneOf: O.none,
|
|
86
87
|
anyOf: O.none,
|
|
87
88
|
not: O.none,
|
|
89
|
+
default: O.none,
|
|
88
90
|
},
|
|
89
91
|
}),
|
|
90
92
|
required: O.some(['photoId']),
|
|
@@ -94,6 +96,7 @@ describe('GenerateHandler', () => {
|
|
|
94
96
|
anyOf: O.none,
|
|
95
97
|
not: O.none,
|
|
96
98
|
in: O.none,
|
|
99
|
+
default: O.none,
|
|
97
100
|
};
|
|
98
101
|
const payload = getGenerateHandlerInput({
|
|
99
102
|
input,
|
|
@@ -134,6 +137,7 @@ describe('GenerateHandler', () => {
|
|
|
134
137
|
oneOf: O.none,
|
|
135
138
|
anyOf: O.none,
|
|
136
139
|
not: O.none,
|
|
140
|
+
default: O.none,
|
|
137
141
|
},
|
|
138
142
|
}),
|
|
139
143
|
required: O.some(['photoId']),
|
|
@@ -143,6 +147,7 @@ describe('GenerateHandler', () => {
|
|
|
143
147
|
anyOf: O.none,
|
|
144
148
|
not: O.none,
|
|
145
149
|
in: O.none,
|
|
150
|
+
default: O.none,
|
|
146
151
|
};
|
|
147
152
|
const payload = getGenerateHandlerInput({ input });
|
|
148
153
|
const generatedHandler = (0, GenerateHandler_1.generateHandler)(payload);
|
|
@@ -180,6 +185,7 @@ describe('GenerateHandler', () => {
|
|
|
180
185
|
oneOf: O.none,
|
|
181
186
|
anyOf: O.none,
|
|
182
187
|
not: O.none,
|
|
188
|
+
default: O.none,
|
|
183
189
|
},
|
|
184
190
|
}),
|
|
185
191
|
required: O.some(['id']),
|
|
@@ -189,6 +195,7 @@ describe('GenerateHandler', () => {
|
|
|
189
195
|
anyOf: O.none,
|
|
190
196
|
not: O.none,
|
|
191
197
|
in: O.none,
|
|
198
|
+
default: O.none,
|
|
192
199
|
};
|
|
193
200
|
const payload = getGenerateHandlerInput({ input });
|
|
194
201
|
const generatedHandler = (0, GenerateHandler_1.generateHandler)(payload);
|
|
@@ -226,6 +233,7 @@ describe('GenerateHandler', () => {
|
|
|
226
233
|
oneOf: O.none,
|
|
227
234
|
anyOf: O.none,
|
|
228
235
|
not: O.none,
|
|
236
|
+
default: O.none,
|
|
229
237
|
},
|
|
230
238
|
}),
|
|
231
239
|
required: O.some(['photoId']),
|
|
@@ -235,6 +243,7 @@ describe('GenerateHandler', () => {
|
|
|
235
243
|
anyOf: O.none,
|
|
236
244
|
not: O.none,
|
|
237
245
|
in: O.none,
|
|
246
|
+
default: O.none,
|
|
238
247
|
};
|
|
239
248
|
const payload = getGenerateHandlerInput({ input });
|
|
240
249
|
const generatedHandler = (0, GenerateHandler_1.generateHandler)(payload);
|
|
@@ -272,6 +281,7 @@ describe('GenerateHandler', () => {
|
|
|
272
281
|
oneOf: O.none,
|
|
273
282
|
anyOf: O.none,
|
|
274
283
|
not: O.none,
|
|
284
|
+
default: O.none,
|
|
275
285
|
},
|
|
276
286
|
}),
|
|
277
287
|
required: O.none,
|
|
@@ -281,6 +291,7 @@ describe('GenerateHandler', () => {
|
|
|
281
291
|
anyOf: O.none,
|
|
282
292
|
not: O.none,
|
|
283
293
|
in: O.none,
|
|
294
|
+
default: O.none,
|
|
284
295
|
};
|
|
285
296
|
const payload = getGenerateHandlerInput({ input });
|
|
286
297
|
const generatedHandler = (0, GenerateHandler_1.generateHandler)(payload);
|
|
@@ -318,6 +329,7 @@ describe('GenerateHandler', () => {
|
|
|
318
329
|
oneOf: O.none,
|
|
319
330
|
anyOf: O.none,
|
|
320
331
|
not: O.none,
|
|
332
|
+
default: O.none,
|
|
321
333
|
},
|
|
322
334
|
photoId: {
|
|
323
335
|
title: O.none,
|
|
@@ -330,6 +342,7 @@ describe('GenerateHandler', () => {
|
|
|
330
342
|
oneOf: O.none,
|
|
331
343
|
anyOf: O.none,
|
|
332
344
|
not: O.none,
|
|
345
|
+
default: O.none,
|
|
333
346
|
},
|
|
334
347
|
commentId: {
|
|
335
348
|
title: O.none,
|
|
@@ -342,6 +355,7 @@ describe('GenerateHandler', () => {
|
|
|
342
355
|
oneOf: O.none,
|
|
343
356
|
anyOf: O.none,
|
|
344
357
|
not: O.none,
|
|
358
|
+
default: O.none,
|
|
345
359
|
},
|
|
346
360
|
}),
|
|
347
361
|
required: O.some(['photoId']),
|
|
@@ -351,6 +365,7 @@ describe('GenerateHandler', () => {
|
|
|
351
365
|
anyOf: O.none,
|
|
352
366
|
not: O.none,
|
|
353
367
|
in: O.none,
|
|
368
|
+
default: O.none,
|
|
354
369
|
};
|
|
355
370
|
const payload = getGenerateHandlerInput({
|
|
356
371
|
input,
|
|
@@ -391,6 +406,7 @@ describe('GenerateHandler', () => {
|
|
|
391
406
|
oneOf: O.none,
|
|
392
407
|
anyOf: O.none,
|
|
393
408
|
not: O.none,
|
|
409
|
+
default: O.none,
|
|
394
410
|
},
|
|
395
411
|
photoId: {
|
|
396
412
|
title: O.none,
|
|
@@ -403,6 +419,7 @@ describe('GenerateHandler', () => {
|
|
|
403
419
|
oneOf: O.none,
|
|
404
420
|
anyOf: O.none,
|
|
405
421
|
not: O.none,
|
|
422
|
+
default: O.none,
|
|
406
423
|
},
|
|
407
424
|
}),
|
|
408
425
|
required: O.some(['id', 'photoId']),
|
|
@@ -412,6 +429,7 @@ describe('GenerateHandler', () => {
|
|
|
412
429
|
anyOf: O.none,
|
|
413
430
|
not: O.none,
|
|
414
431
|
in: O.none,
|
|
432
|
+
default: O.none,
|
|
415
433
|
};
|
|
416
434
|
const payload = getGenerateHandlerInput({ input });
|
|
417
435
|
const generatedHandler = (0, GenerateHandler_1.generateHandler)(payload);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateHandlerTest.d.ts","sourceRoot":"","sources":["../../src/file-generators/GenerateHandlerTest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"GenerateHandlerTest.d.ts","sourceRoot":"","sources":["../../src/file-generators/GenerateHandlerTest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,OAAO,EAAqB,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE5E,MAAM,MAAM,wBAAwB,GAAG;IACtC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;CACrB,CAAC;AAwEF,eAAO,MAAM,mBAAmB,+CAI7B,wBAAwB,KAAG,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAqClD,CAAC"}
|
|
@@ -26,7 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.generateHandlerTest = void 0;
|
|
27
27
|
const E = __importStar(require("fp-ts/Either"));
|
|
28
28
|
const O = __importStar(require("fp-ts/Option"));
|
|
29
|
-
const
|
|
29
|
+
const function_1 = require("fp-ts/function");
|
|
30
|
+
const getDefaultValue = (prop) => (0, function_1.pipe)(prop.default, O.fold(() => O.fold(() => `'test_value'`, (type) => {
|
|
30
31
|
switch (type) {
|
|
31
32
|
case 'string':
|
|
32
33
|
return `'test'`;
|
|
@@ -34,7 +35,7 @@ const getDefaultValue = (prop) => O.fold(() => `'test_value'`, (type) => {
|
|
|
34
35
|
case 'integer':
|
|
35
36
|
return 2;
|
|
36
37
|
case 'boolean':
|
|
37
|
-
return
|
|
38
|
+
return true;
|
|
38
39
|
case 'array':
|
|
39
40
|
const arrayProp = prop;
|
|
40
41
|
return arrayProp.items
|
|
@@ -45,14 +46,30 @@ const getDefaultValue = (prop) => O.fold(() => `'test_value'`, (type) => {
|
|
|
45
46
|
default:
|
|
46
47
|
return `'test_value'`;
|
|
47
48
|
}
|
|
48
|
-
})(prop.type)
|
|
49
|
+
})(prop.type), (defaultEntry) => {
|
|
50
|
+
if (Array.isArray(defaultEntry)) {
|
|
51
|
+
if (defaultEntry.length === 0) {
|
|
52
|
+
return getDefaultValue({ ...prop, default: O.none });
|
|
53
|
+
}
|
|
54
|
+
return defaultEntry[0];
|
|
55
|
+
}
|
|
56
|
+
switch (typeof defaultEntry) {
|
|
57
|
+
case 'string':
|
|
58
|
+
return `'${defaultEntry}'`;
|
|
59
|
+
case 'number':
|
|
60
|
+
case 'boolean':
|
|
61
|
+
return defaultEntry;
|
|
62
|
+
default:
|
|
63
|
+
return `'test_value'`;
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
49
66
|
// TODO: make handleInput and handleOutput accept an option and do the fold inside, will make the code cleaner in the template and switch case
|
|
50
67
|
const handleInput = (inputs) => {
|
|
51
|
-
const populatedTestInputs = Object.entries(inputs).map(([key, prop]) =>
|
|
68
|
+
const populatedTestInputs = Object.entries(inputs).map(([key, prop]) => `'${key}': ${getDefaultValue(prop)}`);
|
|
52
69
|
return `{ ${populatedTestInputs.join(', ')} }`;
|
|
53
70
|
};
|
|
54
71
|
const handleOutput = (outputs) => {
|
|
55
|
-
const expectations = Object.entries(outputs).map(([key, prop]) => `expect(outputValue
|
|
72
|
+
const expectations = Object.entries(outputs).map(([key, prop]) => `expect(outputValue['${key}']).toEqual(${getDefaultValue(prop)});`);
|
|
56
73
|
return expectations.join('\n');
|
|
57
74
|
};
|
|
58
75
|
const generateHandlerTest = ({ operationNameCamelCase, input, output, }) => E.tryCatch(() => `import { OperationHandlerTestSetup } from '@trayio/cdk-dsl/connector/operation/OperationHandlerTest';
|
|
@@ -46,6 +46,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
46
46
|
oneOf: O.none,
|
|
47
47
|
not: O.none,
|
|
48
48
|
in: O.none,
|
|
49
|
+
default: O.none,
|
|
49
50
|
},
|
|
50
51
|
name: {
|
|
51
52
|
title: O.none,
|
|
@@ -58,6 +59,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
58
59
|
oneOf: O.none,
|
|
59
60
|
not: O.none,
|
|
60
61
|
in: O.none,
|
|
62
|
+
default: O.none,
|
|
61
63
|
},
|
|
62
64
|
}),
|
|
63
65
|
required: O.some(['id', 'name']),
|
|
@@ -67,6 +69,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
67
69
|
oneOf: O.none,
|
|
68
70
|
not: O.none,
|
|
69
71
|
in: O.none,
|
|
72
|
+
default: O.none,
|
|
70
73
|
},
|
|
71
74
|
output: {
|
|
72
75
|
type: O.some('object'),
|
|
@@ -84,6 +87,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
84
87
|
oneOf: O.none,
|
|
85
88
|
not: O.none,
|
|
86
89
|
in: O.none,
|
|
90
|
+
default: O.none,
|
|
87
91
|
},
|
|
88
92
|
name: {
|
|
89
93
|
title: O.none,
|
|
@@ -96,6 +100,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
96
100
|
oneOf: O.none,
|
|
97
101
|
not: O.none,
|
|
98
102
|
in: O.none,
|
|
103
|
+
default: O.none,
|
|
99
104
|
},
|
|
100
105
|
}),
|
|
101
106
|
required: O.some(['id']),
|
|
@@ -105,6 +110,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
105
110
|
oneOf: O.none,
|
|
106
111
|
not: O.none,
|
|
107
112
|
in: O.none,
|
|
113
|
+
default: O.none,
|
|
108
114
|
},
|
|
109
115
|
};
|
|
110
116
|
const result = (0, GenerateHandlerTest_1.generateHandlerTest)(input);
|
|
@@ -124,13 +130,13 @@ describe('GenerateHandlerTest', () => {
|
|
|
124
130
|
.testCase('should ${input.operationNameCamelCase}', (testCase) =>
|
|
125
131
|
testCase
|
|
126
132
|
.givenNothing()
|
|
127
|
-
.when(() => ({ id: 2, name: 'test' }))
|
|
133
|
+
.when(() => ({ 'id': 2, 'name': 'test' }))
|
|
128
134
|
.then(({ output }) => {
|
|
129
135
|
// console.log(output);
|
|
130
136
|
const outputValue =
|
|
131
137
|
OperationHandlerResult.getSuccessfulValueOrFail(output);
|
|
132
|
-
expect(outputValue
|
|
133
|
-
expect(outputValue
|
|
138
|
+
expect(outputValue['id']).toEqual(2);
|
|
139
|
+
expect(outputValue['name']).toEqual('test');
|
|
134
140
|
})
|
|
135
141
|
.finallyDoNothing()
|
|
136
142
|
)
|
|
@@ -151,6 +157,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
151
157
|
oneOf: O.none,
|
|
152
158
|
not: O.none,
|
|
153
159
|
in: O.none,
|
|
160
|
+
default: O.none,
|
|
154
161
|
},
|
|
155
162
|
output: {
|
|
156
163
|
type: O.some('object'),
|
|
@@ -167,6 +174,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
167
174
|
oneOf: O.none,
|
|
168
175
|
not: O.none,
|
|
169
176
|
in: O.none,
|
|
177
|
+
default: O.none,
|
|
170
178
|
},
|
|
171
179
|
}),
|
|
172
180
|
required: O.some(['success']),
|
|
@@ -176,6 +184,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
176
184
|
oneOf: O.none,
|
|
177
185
|
not: O.none,
|
|
178
186
|
in: O.none,
|
|
187
|
+
default: O.none,
|
|
179
188
|
},
|
|
180
189
|
};
|
|
181
190
|
const result = (0, GenerateHandlerTest_1.generateHandlerTest)(input);
|
|
@@ -200,7 +209,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
200
209
|
// console.log(output);
|
|
201
210
|
const outputValue =
|
|
202
211
|
OperationHandlerResult.getSuccessfulValueOrFail(output);
|
|
203
|
-
expect(outputValue
|
|
212
|
+
expect(outputValue['success']).toEqual(true);
|
|
204
213
|
})
|
|
205
214
|
.finallyDoNothing()
|
|
206
215
|
)
|
|
@@ -229,6 +238,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
229
238
|
oneOf: O.none,
|
|
230
239
|
not: O.none,
|
|
231
240
|
in: O.none,
|
|
241
|
+
default: O.none,
|
|
232
242
|
},
|
|
233
243
|
age: {
|
|
234
244
|
title: O.none,
|
|
@@ -241,6 +251,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
241
251
|
oneOf: O.none,
|
|
242
252
|
not: O.none,
|
|
243
253
|
in: O.none,
|
|
254
|
+
default: O.none,
|
|
244
255
|
},
|
|
245
256
|
}),
|
|
246
257
|
required: O.none,
|
|
@@ -250,6 +261,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
250
261
|
oneOf: O.none,
|
|
251
262
|
not: O.none,
|
|
252
263
|
in: O.none,
|
|
264
|
+
default: O.none,
|
|
253
265
|
},
|
|
254
266
|
}),
|
|
255
267
|
required: O.none,
|
|
@@ -259,6 +271,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
259
271
|
oneOf: O.none,
|
|
260
272
|
not: O.none,
|
|
261
273
|
in: O.none,
|
|
274
|
+
default: O.none,
|
|
262
275
|
},
|
|
263
276
|
output: {
|
|
264
277
|
title: O.none,
|
|
@@ -279,6 +292,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
279
292
|
oneOf: O.none,
|
|
280
293
|
not: O.none,
|
|
281
294
|
in: O.none,
|
|
295
|
+
default: O.none,
|
|
282
296
|
},
|
|
283
297
|
}),
|
|
284
298
|
required: O.none,
|
|
@@ -288,6 +302,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
288
302
|
oneOf: O.none,
|
|
289
303
|
not: O.none,
|
|
290
304
|
in: O.none,
|
|
305
|
+
default: O.none,
|
|
291
306
|
},
|
|
292
307
|
}),
|
|
293
308
|
required: O.none,
|
|
@@ -297,6 +312,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
297
312
|
oneOf: O.none,
|
|
298
313
|
not: O.none,
|
|
299
314
|
in: O.none,
|
|
315
|
+
default: O.none,
|
|
300
316
|
},
|
|
301
317
|
};
|
|
302
318
|
const result = (0, GenerateHandlerTest_1.generateHandlerTest)(input);
|
|
@@ -316,12 +332,12 @@ describe('GenerateHandlerTest', () => {
|
|
|
316
332
|
.testCase('should ${input.operationNameCamelCase}', (testCase) =>
|
|
317
333
|
testCase
|
|
318
334
|
.givenNothing()
|
|
319
|
-
.when(() => ({ metadata: { name: 'test', age: 2 }}))
|
|
335
|
+
.when(() => ({ 'metadata': { 'name': 'test', 'age': 2 }}))
|
|
320
336
|
.then(({ output }) => {
|
|
321
337
|
// console.log(output);
|
|
322
338
|
const outputValue =
|
|
323
339
|
OperationHandlerResult.getSuccessfulValueOrFail(output);
|
|
324
|
-
expect(outputValue
|
|
340
|
+
expect(outputValue['parents']).toEqual({'child': 'test'});
|
|
325
341
|
})
|
|
326
342
|
.finallyDoNothing()
|
|
327
343
|
)
|
|
@@ -349,6 +365,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
349
365
|
oneOf: O.none,
|
|
350
366
|
not: O.none,
|
|
351
367
|
in: O.none,
|
|
368
|
+
default: O.none,
|
|
352
369
|
},
|
|
353
370
|
properties: O.none,
|
|
354
371
|
required: O.none,
|
|
@@ -358,6 +375,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
358
375
|
oneOf: O.none,
|
|
359
376
|
not: O.none,
|
|
360
377
|
in: O.none,
|
|
378
|
+
default: O.none,
|
|
361
379
|
},
|
|
362
380
|
}),
|
|
363
381
|
required: O.none,
|
|
@@ -367,6 +385,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
367
385
|
oneOf: O.none,
|
|
368
386
|
not: O.none,
|
|
369
387
|
in: O.none,
|
|
388
|
+
default: O.none,
|
|
370
389
|
},
|
|
371
390
|
output: {
|
|
372
391
|
type: O.some('object'),
|
|
@@ -386,6 +405,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
386
405
|
oneOf: O.none,
|
|
387
406
|
not: O.none,
|
|
388
407
|
in: O.none,
|
|
408
|
+
default: O.none,
|
|
389
409
|
},
|
|
390
410
|
properties: O.none,
|
|
391
411
|
required: O.none,
|
|
@@ -395,6 +415,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
395
415
|
oneOf: O.none,
|
|
396
416
|
not: O.none,
|
|
397
417
|
in: O.none,
|
|
418
|
+
default: O.none,
|
|
398
419
|
},
|
|
399
420
|
}),
|
|
400
421
|
required: O.none,
|
|
@@ -404,6 +425,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
404
425
|
oneOf: O.none,
|
|
405
426
|
not: O.none,
|
|
406
427
|
in: O.none,
|
|
428
|
+
default: O.none,
|
|
407
429
|
},
|
|
408
430
|
};
|
|
409
431
|
const result = (0, GenerateHandlerTest_1.generateHandlerTest)(input);
|
|
@@ -423,12 +445,12 @@ describe('GenerateHandlerTest', () => {
|
|
|
423
445
|
.testCase('should ${input.operationNameCamelCase}', (testCase) =>
|
|
424
446
|
testCase
|
|
425
447
|
.givenNothing()
|
|
426
|
-
.when(() => ({ ids: [2] }))
|
|
448
|
+
.when(() => ({ 'ids': [2] }))
|
|
427
449
|
.then(({ output }) => {
|
|
428
450
|
// console.log(output);
|
|
429
451
|
const outputValue =
|
|
430
452
|
OperationHandlerResult.getSuccessfulValueOrFail(output);
|
|
431
|
-
expect(outputValue
|
|
453
|
+
expect(outputValue['parents']).toEqual(['test']);
|
|
432
454
|
})
|
|
433
455
|
.finallyDoNothing()
|
|
434
456
|
)
|
|
@@ -449,6 +471,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
449
471
|
oneOf: O.none,
|
|
450
472
|
not: O.none,
|
|
451
473
|
in: O.none,
|
|
474
|
+
default: O.none,
|
|
452
475
|
},
|
|
453
476
|
output: {
|
|
454
477
|
type: O.some('object'),
|
|
@@ -469,6 +492,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
469
492
|
oneOf: O.none,
|
|
470
493
|
not: O.none,
|
|
471
494
|
in: O.none,
|
|
495
|
+
default: O.none,
|
|
472
496
|
},
|
|
473
497
|
valueList: {
|
|
474
498
|
title: O.none,
|
|
@@ -484,6 +508,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
484
508
|
oneOf: O.none,
|
|
485
509
|
not: O.none,
|
|
486
510
|
in: O.none,
|
|
511
|
+
default: O.none,
|
|
487
512
|
},
|
|
488
513
|
properties: O.none,
|
|
489
514
|
required: O.none,
|
|
@@ -493,6 +518,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
493
518
|
oneOf: O.none,
|
|
494
519
|
not: O.none,
|
|
495
520
|
in: O.none,
|
|
521
|
+
default: O.none,
|
|
496
522
|
},
|
|
497
523
|
}),
|
|
498
524
|
required: O.none,
|
|
@@ -502,6 +528,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
502
528
|
oneOf: O.none,
|
|
503
529
|
not: O.none,
|
|
504
530
|
in: O.none,
|
|
531
|
+
default: O.none,
|
|
505
532
|
},
|
|
506
533
|
}),
|
|
507
534
|
required: O.none,
|
|
@@ -511,6 +538,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
511
538
|
oneOf: O.none,
|
|
512
539
|
not: O.none,
|
|
513
540
|
in: O.none,
|
|
541
|
+
default: O.none,
|
|
514
542
|
},
|
|
515
543
|
};
|
|
516
544
|
const result = (0, GenerateHandlerTest_1.generateHandlerTest)(input);
|
|
@@ -535,7 +563,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
535
563
|
// console.log(output);
|
|
536
564
|
const outputValue =
|
|
537
565
|
OperationHandlerResult.getSuccessfulValueOrFail(output);
|
|
538
|
-
expect(outputValue
|
|
566
|
+
expect(outputValue['parents']).toEqual({'child': 'test', 'valueList': ['test']});
|
|
539
567
|
})
|
|
540
568
|
.finallyDoNothing()
|
|
541
569
|
)
|
|
@@ -556,6 +584,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
556
584
|
oneOf: O.none,
|
|
557
585
|
not: O.none,
|
|
558
586
|
in: O.none,
|
|
587
|
+
default: O.none,
|
|
559
588
|
},
|
|
560
589
|
output: {
|
|
561
590
|
title: O.none,
|
|
@@ -579,6 +608,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
579
608
|
oneOf: O.none,
|
|
580
609
|
not: O.none,
|
|
581
610
|
in: O.none,
|
|
611
|
+
default: O.none,
|
|
582
612
|
},
|
|
583
613
|
}),
|
|
584
614
|
required: O.none,
|
|
@@ -588,6 +618,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
588
618
|
oneOf: O.none,
|
|
589
619
|
not: O.none,
|
|
590
620
|
in: O.none,
|
|
621
|
+
default: O.none,
|
|
591
622
|
},
|
|
592
623
|
properties: O.none,
|
|
593
624
|
required: O.none,
|
|
@@ -597,6 +628,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
597
628
|
oneOf: O.none,
|
|
598
629
|
not: O.none,
|
|
599
630
|
in: O.none,
|
|
631
|
+
default: O.none,
|
|
600
632
|
},
|
|
601
633
|
}),
|
|
602
634
|
required: O.none,
|
|
@@ -606,6 +638,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
606
638
|
oneOf: O.none,
|
|
607
639
|
not: O.none,
|
|
608
640
|
in: O.none,
|
|
641
|
+
default: O.none,
|
|
609
642
|
},
|
|
610
643
|
};
|
|
611
644
|
const result = (0, GenerateHandlerTest_1.generateHandlerTest)(input);
|
|
@@ -630,7 +663,7 @@ describe('GenerateHandlerTest', () => {
|
|
|
630
663
|
// console.log(output);
|
|
631
664
|
const outputValue =
|
|
632
665
|
OperationHandlerResult.getSuccessfulValueOrFail(output);
|
|
633
|
-
expect(outputValue
|
|
666
|
+
expect(outputValue['parents']).toEqual([{'child': 'test'}]);
|
|
634
667
|
})
|
|
635
668
|
.finallyDoNothing()
|
|
636
669
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateInputSchema.d.ts","sourceRoot":"","sources":["../../../src/file-generators/types/GenerateInputSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAQlC,OAAO,EACN,IAAI,EAGJ,YAAY,EAEZ,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"GenerateInputSchema.d.ts","sourceRoot":"","sources":["../../../src/file-generators/types/GenerateInputSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAQlC,OAAO,EACN,IAAI,EAGJ,YAAY,EAEZ,MAAM,8BAA8B,CAAC;AA+ItC,eAAO,MAAM,mBAAmB,aACrB,IAAI,KACZ,EAAE,MAAM,CAAC,KAAK,EAAE,YAAY,CAiC9B,CAAC"}
|
|
@@ -55,6 +55,7 @@ const mergeParamsAndBody = (params, body) => ({
|
|
|
55
55
|
oneOf: O.none,
|
|
56
56
|
not: O.none,
|
|
57
57
|
in: O.none,
|
|
58
|
+
default: O.none,
|
|
58
59
|
});
|
|
59
60
|
const transformInput = (parameters) => {
|
|
60
61
|
const transformedParameters = {};
|
|
@@ -89,6 +90,7 @@ const transformInput = (parameters) => {
|
|
|
89
90
|
oneOf: O.none,
|
|
90
91
|
not: O.none,
|
|
91
92
|
in: O.none,
|
|
93
|
+
default: O.none,
|
|
92
94
|
};
|
|
93
95
|
};
|
|
94
96
|
/**
|
|
@@ -118,6 +120,7 @@ const blankOutputSchema = () => ({
|
|
|
118
120
|
oneOf: O.none,
|
|
119
121
|
not: O.none,
|
|
120
122
|
in: O.none,
|
|
123
|
+
default: O.none,
|
|
121
124
|
});
|
|
122
125
|
const getApplicationJsonMediaType = (content) => {
|
|
123
126
|
if (!Object.keys(content).length)
|
|
@@ -52,6 +52,7 @@ describe('GenerateInputSchema', () => {
|
|
|
52
52
|
oneOf: O.none,
|
|
53
53
|
not: O.none,
|
|
54
54
|
in: O.none,
|
|
55
|
+
default: O.none,
|
|
55
56
|
},
|
|
56
57
|
additionalProperties: O.none,
|
|
57
58
|
},
|
|
@@ -73,6 +74,7 @@ describe('GenerateInputSchema', () => {
|
|
|
73
74
|
oneOf: O.none,
|
|
74
75
|
not: O.none,
|
|
75
76
|
in: O.none,
|
|
77
|
+
default: O.none,
|
|
76
78
|
},
|
|
77
79
|
additionalProperties: O.none,
|
|
78
80
|
},
|
|
@@ -126,6 +128,7 @@ describe('GenerateInputSchema', () => {
|
|
|
126
128
|
oneOf: O.none,
|
|
127
129
|
not: O.none,
|
|
128
130
|
in: O.none,
|
|
131
|
+
default: O.none,
|
|
129
132
|
},
|
|
130
133
|
userId: {
|
|
131
134
|
type: O.some('integer'),
|
|
@@ -138,6 +141,7 @@ describe('GenerateInputSchema', () => {
|
|
|
138
141
|
oneOf: O.none,
|
|
139
142
|
not: O.none,
|
|
140
143
|
in: O.none,
|
|
144
|
+
default: O.none,
|
|
141
145
|
},
|
|
142
146
|
title: {
|
|
143
147
|
type: O.some('string'),
|
|
@@ -150,6 +154,7 @@ describe('GenerateInputSchema', () => {
|
|
|
150
154
|
oneOf: O.none,
|
|
151
155
|
not: O.none,
|
|
152
156
|
in: O.none,
|
|
157
|
+
default: O.none,
|
|
153
158
|
},
|
|
154
159
|
body: {
|
|
155
160
|
type: O.some('string'),
|
|
@@ -162,6 +167,7 @@ describe('GenerateInputSchema', () => {
|
|
|
162
167
|
oneOf: O.none,
|
|
163
168
|
not: O.none,
|
|
164
169
|
in: O.none,
|
|
170
|
+
default: O.none,
|
|
165
171
|
},
|
|
166
172
|
}),
|
|
167
173
|
additionalProperties: O.some(false),
|
|
@@ -170,6 +176,7 @@ describe('GenerateInputSchema', () => {
|
|
|
170
176
|
oneOf: O.none,
|
|
171
177
|
not: O.none,
|
|
172
178
|
in: O.none,
|
|
179
|
+
default: O.none,
|
|
173
180
|
}),
|
|
174
181
|
},
|
|
175
182
|
},
|
|
@@ -219,6 +226,7 @@ describe('GenerateInputSchema', () => {
|
|
|
219
226
|
oneOf: O.none,
|
|
220
227
|
not: O.none,
|
|
221
228
|
in: O.none,
|
|
229
|
+
default: O.none,
|
|
222
230
|
},
|
|
223
231
|
properties: O.none,
|
|
224
232
|
additionalProperties: O.some(false),
|
|
@@ -228,6 +236,7 @@ describe('GenerateInputSchema', () => {
|
|
|
228
236
|
oneOf: O.none,
|
|
229
237
|
not: O.none,
|
|
230
238
|
in: O.none,
|
|
239
|
+
default: O.none,
|
|
231
240
|
},
|
|
232
241
|
additionalProperties: O.none,
|
|
233
242
|
},
|
|
@@ -55,6 +55,7 @@ describe('GenerateInputType', () => {
|
|
|
55
55
|
oneOf: O.none,
|
|
56
56
|
not: O.none,
|
|
57
57
|
in: O.none,
|
|
58
|
+
default: O.none,
|
|
58
59
|
},
|
|
59
60
|
userId: {
|
|
60
61
|
title: O.none,
|
|
@@ -67,6 +68,7 @@ describe('GenerateInputType', () => {
|
|
|
67
68
|
oneOf: O.none,
|
|
68
69
|
not: O.none,
|
|
69
70
|
in: O.none,
|
|
71
|
+
default: O.none,
|
|
70
72
|
},
|
|
71
73
|
title: {
|
|
72
74
|
title: O.none,
|
|
@@ -79,6 +81,7 @@ describe('GenerateInputType', () => {
|
|
|
79
81
|
oneOf: O.none,
|
|
80
82
|
not: O.none,
|
|
81
83
|
in: O.none,
|
|
84
|
+
default: O.none,
|
|
82
85
|
},
|
|
83
86
|
body: {
|
|
84
87
|
title: O.none,
|
|
@@ -91,6 +94,7 @@ describe('GenerateInputType', () => {
|
|
|
91
94
|
oneOf: O.none,
|
|
92
95
|
not: O.none,
|
|
93
96
|
in: O.none,
|
|
97
|
+
default: O.none,
|
|
94
98
|
},
|
|
95
99
|
}),
|
|
96
100
|
additionalProperties: O.some(false),
|
|
@@ -99,6 +103,7 @@ describe('GenerateInputType', () => {
|
|
|
99
103
|
oneOf: O.none,
|
|
100
104
|
not: O.none,
|
|
101
105
|
in: O.none,
|
|
106
|
+
default: O.none,
|
|
102
107
|
}),
|
|
103
108
|
},
|
|
104
109
|
},
|
|
@@ -124,6 +129,7 @@ describe('GenerateInputType', () => {
|
|
|
124
129
|
oneOf: O.none,
|
|
125
130
|
not: O.none,
|
|
126
131
|
in: O.some('body'),
|
|
132
|
+
default: O.none,
|
|
127
133
|
},
|
|
128
134
|
userId: {
|
|
129
135
|
title: O.none,
|
|
@@ -136,6 +142,7 @@ describe('GenerateInputType', () => {
|
|
|
136
142
|
oneOf: O.none,
|
|
137
143
|
not: O.none,
|
|
138
144
|
in: O.some('body'),
|
|
145
|
+
default: O.none,
|
|
139
146
|
},
|
|
140
147
|
title: {
|
|
141
148
|
title: O.none,
|
|
@@ -148,6 +155,7 @@ describe('GenerateInputType', () => {
|
|
|
148
155
|
oneOf: O.none,
|
|
149
156
|
not: O.none,
|
|
150
157
|
in: O.some('body'),
|
|
158
|
+
default: O.none,
|
|
151
159
|
},
|
|
152
160
|
body: {
|
|
153
161
|
title: O.none,
|
|
@@ -160,6 +168,7 @@ describe('GenerateInputType', () => {
|
|
|
160
168
|
oneOf: O.none,
|
|
161
169
|
not: O.none,
|
|
162
170
|
in: O.some('body'),
|
|
171
|
+
default: O.none,
|
|
163
172
|
},
|
|
164
173
|
}),
|
|
165
174
|
additionalProperties: O.some(false),
|
|
@@ -168,6 +177,7 @@ describe('GenerateInputType', () => {
|
|
|
168
177
|
oneOf: O.none,
|
|
169
178
|
not: O.none,
|
|
170
179
|
in: O.none,
|
|
180
|
+
default: O.none,
|
|
171
181
|
};
|
|
172
182
|
expect(inputSchema).toEqual(expectedInputSchema);
|
|
173
183
|
});
|
|
@@ -195,6 +205,7 @@ describe('GenerateInputType', () => {
|
|
|
195
205
|
oneOf: O.none,
|
|
196
206
|
not: O.none,
|
|
197
207
|
in: O.none,
|
|
208
|
+
default: O.none,
|
|
198
209
|
},
|
|
199
210
|
},
|
|
200
211
|
{
|
|
@@ -214,6 +225,7 @@ describe('GenerateInputType', () => {
|
|
|
214
225
|
oneOf: O.none,
|
|
215
226
|
not: O.none,
|
|
216
227
|
in: O.none,
|
|
228
|
+
default: O.none,
|
|
217
229
|
},
|
|
218
230
|
},
|
|
219
231
|
]),
|
|
@@ -236,6 +248,7 @@ describe('GenerateInputType', () => {
|
|
|
236
248
|
oneOf: O.none,
|
|
237
249
|
not: O.none,
|
|
238
250
|
in: O.none,
|
|
251
|
+
default: O.none,
|
|
239
252
|
},
|
|
240
253
|
title: {
|
|
241
254
|
title: O.none,
|
|
@@ -248,6 +261,7 @@ describe('GenerateInputType', () => {
|
|
|
248
261
|
oneOf: O.none,
|
|
249
262
|
not: O.none,
|
|
250
263
|
in: O.none,
|
|
264
|
+
default: O.none,
|
|
251
265
|
},
|
|
252
266
|
body: {
|
|
253
267
|
title: O.none,
|
|
@@ -260,6 +274,7 @@ describe('GenerateInputType', () => {
|
|
|
260
274
|
oneOf: O.none,
|
|
261
275
|
not: O.none,
|
|
262
276
|
in: O.none,
|
|
277
|
+
default: O.none,
|
|
263
278
|
},
|
|
264
279
|
}),
|
|
265
280
|
additionalProperties: O.some(false),
|
|
@@ -268,6 +283,7 @@ describe('GenerateInputType', () => {
|
|
|
268
283
|
oneOf: O.none,
|
|
269
284
|
not: O.none,
|
|
270
285
|
in: O.none,
|
|
286
|
+
default: O.none,
|
|
271
287
|
}),
|
|
272
288
|
},
|
|
273
289
|
},
|
|
@@ -339,6 +355,7 @@ describe('GenerateInputType', () => {
|
|
|
339
355
|
oneOf: O.none,
|
|
340
356
|
not: O.none,
|
|
341
357
|
in: O.none,
|
|
358
|
+
default: O.none,
|
|
342
359
|
}),
|
|
343
360
|
},
|
|
344
361
|
},
|
|
@@ -384,6 +401,7 @@ describe('GenerateInputType', () => {
|
|
|
384
401
|
oneOf: O.none,
|
|
385
402
|
not: O.none,
|
|
386
403
|
in: O.none,
|
|
404
|
+
default: O.none,
|
|
387
405
|
},
|
|
388
406
|
userId: {
|
|
389
407
|
title: O.none,
|
|
@@ -396,6 +414,7 @@ describe('GenerateInputType', () => {
|
|
|
396
414
|
oneOf: O.none,
|
|
397
415
|
not: O.none,
|
|
398
416
|
in: O.none,
|
|
417
|
+
default: O.none,
|
|
399
418
|
},
|
|
400
419
|
title: {
|
|
401
420
|
title: O.none,
|
|
@@ -408,6 +427,7 @@ describe('GenerateInputType', () => {
|
|
|
408
427
|
oneOf: O.none,
|
|
409
428
|
not: O.none,
|
|
410
429
|
in: O.none,
|
|
430
|
+
default: O.none,
|
|
411
431
|
},
|
|
412
432
|
body: {
|
|
413
433
|
title: O.none,
|
|
@@ -420,6 +440,7 @@ describe('GenerateInputType', () => {
|
|
|
420
440
|
oneOf: O.none,
|
|
421
441
|
not: O.none,
|
|
422
442
|
in: O.none,
|
|
443
|
+
default: O.none,
|
|
423
444
|
},
|
|
424
445
|
}),
|
|
425
446
|
additionalProperties: O.some(false),
|
|
@@ -428,6 +449,7 @@ describe('GenerateInputType', () => {
|
|
|
428
449
|
oneOf: O.none,
|
|
429
450
|
not: O.none,
|
|
430
451
|
in: O.none,
|
|
452
|
+
default: O.none,
|
|
431
453
|
}),
|
|
432
454
|
},
|
|
433
455
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateOutput.d.ts","sourceRoot":"","sources":["../../../src/file-generators/types/GenerateOutput.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAKlC,OAAO,EACN,SAAS,EAET,eAAe,EACf,YAAY,EAEZ,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"GenerateOutput.d.ts","sourceRoot":"","sources":["../../../src/file-generators/types/GenerateOutput.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAKlC,OAAO,EACN,SAAS,EAET,eAAe,EACf,YAAY,EAEZ,MAAM,8BAA8B,CAAC;AAyCtC,eAAO,MAAM,2BAA2B,YAC9B,OAAO,MAAM,EAAE,eAAe,CAAC,KACtC,EAAE,MAAM,CAAC,KAAK,EAAE,eAAe,CAWjC,CAAC;AAEF,eAAO,MAAM,oBAAoB,cACrB,EAAE,MAAM,CAAC,SAAS,CAAC,KAC5B,GAAG,UAAU,CAAC,KAAK,EAAE,YAAY,CAelC,CAAC;AAWH,eAAO,MAAM,mBAAmB,2BACP,MAAM,gBAChB,YAAY,KACxB,GAAG,UAAU,CAAC,KAAK,EAAE,MAAM,CAgB7B,CAAC"}
|
|
@@ -52,6 +52,7 @@ const blankOutputSchema = () => ({
|
|
|
52
52
|
oneOf: O.none,
|
|
53
53
|
not: O.none,
|
|
54
54
|
in: O.none,
|
|
55
|
+
default: O.none,
|
|
55
56
|
});
|
|
56
57
|
const getContent = (response) => O.fold(() => ({ 'application/json': { schema: O.some(blankOutputSchema()) } }), (content) => content)(response.content);
|
|
57
58
|
const getApplicationJsonMediaType = (content) => {
|
|
@@ -61,6 +61,7 @@ describe('Generate output: ', () => {
|
|
|
61
61
|
oneOf: O.none,
|
|
62
62
|
not: O.none,
|
|
63
63
|
in: O.none,
|
|
64
|
+
default: O.none,
|
|
64
65
|
},
|
|
65
66
|
userId: {
|
|
66
67
|
title: O.none,
|
|
@@ -73,6 +74,7 @@ describe('Generate output: ', () => {
|
|
|
73
74
|
oneOf: O.none,
|
|
74
75
|
not: O.none,
|
|
75
76
|
in: O.none,
|
|
77
|
+
default: O.none,
|
|
76
78
|
},
|
|
77
79
|
title: {
|
|
78
80
|
title: O.none,
|
|
@@ -85,6 +87,7 @@ describe('Generate output: ', () => {
|
|
|
85
87
|
oneOf: O.none,
|
|
86
88
|
not: O.none,
|
|
87
89
|
in: O.none,
|
|
90
|
+
default: O.none,
|
|
88
91
|
},
|
|
89
92
|
body: {
|
|
90
93
|
title: O.none,
|
|
@@ -97,6 +100,7 @@ describe('Generate output: ', () => {
|
|
|
97
100
|
oneOf: O.none,
|
|
98
101
|
not: O.none,
|
|
99
102
|
in: O.none,
|
|
103
|
+
default: O.none,
|
|
100
104
|
},
|
|
101
105
|
}),
|
|
102
106
|
additionalProperties: O.some(false),
|
|
@@ -105,6 +109,7 @@ describe('Generate output: ', () => {
|
|
|
105
109
|
oneOf: O.none,
|
|
106
110
|
not: O.none,
|
|
107
111
|
in: O.none,
|
|
112
|
+
default: O.none,
|
|
108
113
|
}),
|
|
109
114
|
},
|
|
110
115
|
}),
|
|
@@ -142,6 +147,7 @@ describe('Generate output: ', () => {
|
|
|
142
147
|
oneOf: O.none,
|
|
143
148
|
not: O.none,
|
|
144
149
|
in: O.none,
|
|
150
|
+
default: O.none,
|
|
145
151
|
},
|
|
146
152
|
userId: {
|
|
147
153
|
title: O.none,
|
|
@@ -154,6 +160,7 @@ describe('Generate output: ', () => {
|
|
|
154
160
|
oneOf: O.none,
|
|
155
161
|
not: O.none,
|
|
156
162
|
in: O.none,
|
|
163
|
+
default: O.none,
|
|
157
164
|
},
|
|
158
165
|
title: {
|
|
159
166
|
title: O.none,
|
|
@@ -166,6 +173,7 @@ describe('Generate output: ', () => {
|
|
|
166
173
|
oneOf: O.none,
|
|
167
174
|
not: O.none,
|
|
168
175
|
in: O.none,
|
|
176
|
+
default: O.none,
|
|
169
177
|
},
|
|
170
178
|
body: {
|
|
171
179
|
title: O.none,
|
|
@@ -178,6 +186,7 @@ describe('Generate output: ', () => {
|
|
|
178
186
|
oneOf: O.none,
|
|
179
187
|
not: O.none,
|
|
180
188
|
in: O.none,
|
|
189
|
+
default: O.none,
|
|
181
190
|
},
|
|
182
191
|
}),
|
|
183
192
|
additionalProperties: O.some(false),
|
|
@@ -186,6 +195,7 @@ describe('Generate output: ', () => {
|
|
|
186
195
|
oneOf: O.none,
|
|
187
196
|
not: O.none,
|
|
188
197
|
in: O.none,
|
|
198
|
+
default: O.none,
|
|
189
199
|
}),
|
|
190
200
|
},
|
|
191
201
|
}),
|