@techspokes/typescript-wsdl-client 0.11.5 → 0.13.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.
Files changed (41) hide show
  1. package/README.md +2 -1
  2. package/dist/app/generateApp.js +1 -1
  3. package/dist/client/generateClient.d.ts.map +1 -1
  4. package/dist/client/generateClient.js +9 -1
  5. package/dist/client/generateOperations.d.ts.map +1 -1
  6. package/dist/client/generateOperations.js +11 -1
  7. package/dist/client/generateTypes.d.ts.map +1 -1
  8. package/dist/client/generateTypes.js +49 -6
  9. package/dist/compiler/schemaCompiler.d.ts +8 -0
  10. package/dist/compiler/schemaCompiler.d.ts.map +1 -1
  11. package/dist/compiler/schemaCompiler.js +125 -12
  12. package/dist/gateway/generators.d.ts +2 -0
  13. package/dist/gateway/generators.d.ts.map +1 -1
  14. package/dist/gateway/generators.js +57 -23
  15. package/dist/gateway/helpers.d.ts +13 -0
  16. package/dist/gateway/helpers.d.ts.map +1 -1
  17. package/dist/gateway/helpers.js +58 -0
  18. package/dist/openapi/generatePaths.d.ts.map +1 -1
  19. package/dist/openapi/generatePaths.js +5 -1
  20. package/dist/openapi/generateSchemas.d.ts.map +1 -1
  21. package/dist/openapi/generateSchemas.js +29 -5
  22. package/dist/pipeline.d.ts +1 -0
  23. package/dist/pipeline.d.ts.map +1 -1
  24. package/dist/pipeline.js +1 -0
  25. package/dist/test/generateTests.d.ts +1 -0
  26. package/dist/test/generateTests.d.ts.map +1 -1
  27. package/dist/test/generateTests.js +9 -4
  28. package/dist/test/generators.d.ts +12 -7
  29. package/dist/test/generators.d.ts.map +1 -1
  30. package/dist/test/generators.js +41 -37
  31. package/dist/test/mockData.d.ts +23 -10
  32. package/dist/test/mockData.d.ts.map +1 -1
  33. package/dist/test/mockData.js +44 -4
  34. package/dist/util/catalogMeta.d.ts +33 -0
  35. package/dist/util/catalogMeta.d.ts.map +1 -0
  36. package/dist/util/catalogMeta.js +95 -0
  37. package/docs/architecture.md +2 -0
  38. package/docs/concepts.md +2 -0
  39. package/docs/generated-code.md +31 -3
  40. package/docs/testing.md +10 -9
  41. package/package.json +7 -7
@@ -12,7 +12,8 @@
12
12
  */
13
13
  import fs from "node:fs";
14
14
  import path from "node:path";
15
- import { flattenAllOf, rewriteSchemaRefs, slugName, } from "./helpers.js";
15
+ import { flattenAllOf, measureSchemaRefComplexity, rewriteSchemaRefs, slugName, } from "./helpers.js";
16
+ import { detectArrayWrappers as detectArrayWrappersShared } from "../util/catalogMeta.js";
16
17
  /**
17
18
  * Emits individual JSON Schema files for each OpenAPI component schema
18
19
  *
@@ -174,12 +175,29 @@ export function emitOperationSchemas(doc, opsDir, versionSlug, serviceSlug, sche
174
175
  opSchema.querystring = querySchema;
175
176
  if (headersSchema)
176
177
  opSchema.headers = headersSchema;
178
+ // Check response schema $ref complexity — fast-json-stringify stack-overflows
179
+ // on deeply nested $ref graphs (typically > 150 unique schema references).
180
+ const REF_COMPLEXITY_LIMIT = 150;
181
+ let skipResponseSchema = false;
182
+ const allSchemas = doc.components?.schemas ?? {};
183
+ for (const code of Object.keys(responseObj)) {
184
+ const refId = responseObj[code]?.$ref;
185
+ if (!refId)
186
+ continue;
187
+ // Extract component name from URN: look up inverse of schemaIdByName
188
+ const schemaName = Object.keys(schemaIdByName).find(n => schemaIdByName[n] + "#" === refId);
189
+ if (schemaName && measureSchemaRefComplexity(schemaName, allSchemas, REF_COMPLEXITY_LIMIT) >= REF_COMPLEXITY_LIMIT) {
190
+ skipResponseSchema = true;
191
+ break;
192
+ }
193
+ }
177
194
  const opOutPath = path.join(opsDir, `${operationSlug}.json`);
178
195
  fs.writeFileSync(opOutPath, JSON.stringify(opSchema, null, 2), "utf8");
179
196
  operations.push({
180
197
  operationSlug,
181
198
  method: lowerMethod,
182
199
  path: p,
200
+ skipResponseSchema,
183
201
  });
184
202
  }
185
203
  }
@@ -255,10 +273,22 @@ export function emitRouteFiles(outDir, routesDir, versionSlug, serviceSlug, oper
255
273
  routeTs += `import type { FastifyInstance } from "fastify";\n`;
256
274
  routeTs += `import schema from "../schemas/operations/${op.operationSlug}.json" with { type: "json" };\n\n`;
257
275
  routeTs += `export async function ${fnName}(fastify: FastifyInstance) {\n`;
258
- routeTs += ` fastify.route({\n`;
259
- routeTs += ` method: "${op.method.toUpperCase()}",\n`;
260
- routeTs += ` url: "${op.path}",\n`;
261
- routeTs += ` schema: schema as any,\n`;
276
+ if (op.skipResponseSchema) {
277
+ // Response schema too complex for fast-json-stringify — strip it so Fastify
278
+ // falls back to JSON.stringify for response serialization.
279
+ routeTs += ` // Response schema omitted: $ref graph exceeds fast-json-stringify depth limit\n`;
280
+ routeTs += ` const { response: _response, ...routeSchema } = schema as Record<string, unknown>;\n`;
281
+ routeTs += ` fastify.route({\n`;
282
+ routeTs += ` method: "${op.method.toUpperCase()}",\n`;
283
+ routeTs += ` url: "${op.path}",\n`;
284
+ routeTs += ` schema: routeSchema as any,\n`;
285
+ }
286
+ else {
287
+ routeTs += ` fastify.route({\n`;
288
+ routeTs += ` method: "${op.method.toUpperCase()}",\n`;
289
+ routeTs += ` url: "${op.path}",\n`;
290
+ routeTs += ` schema: schema as any,\n`;
291
+ }
262
292
  routeTs += ` handler: async (request, reply) => {\n`;
263
293
  routeTs += ` throw new Error("Not implemented");\n`;
264
294
  routeTs += ` }\n`;
@@ -291,25 +321,13 @@ export function emitRouteFiles(outDir, routesDir, versionSlug, serviceSlug, oper
291
321
  /**
292
322
  * Detects ArrayOf* wrapper types from catalog type metadata.
293
323
  *
294
- * An ArrayOf* wrapper has exactly one element with max "unbounded" (or > 1)
295
- * and no attributes — mirroring the logic in generateSchemas.ts isArrayWrapper().
324
+ * Delegates to the shared utility in src/util/catalogMeta.ts.
296
325
  *
297
326
  * @param catalog - Compiled catalog object
298
327
  * @returns Record mapping wrapper type name to inner element property name
299
328
  */
300
329
  function detectArrayWrappers(catalog) {
301
- const wrappers = {};
302
- for (const t of catalog.types || []) {
303
- if (t.attrs && t.attrs.length !== 0)
304
- continue;
305
- if (!t.elems || t.elems.length !== 1)
306
- continue;
307
- const e = t.elems[0];
308
- if (e.max !== "unbounded" && !(e.max > 1))
309
- continue;
310
- wrappers[t.name] = e.name;
311
- }
312
- return wrappers;
330
+ return detectArrayWrappersShared(catalog.types || []);
313
331
  }
314
332
  export function emitRuntimeModule(outDir, versionSlug, serviceSlug, catalog) {
315
333
  const vSlug = slugName(versionSlug);
@@ -351,7 +369,13 @@ export function unwrapArrayWrappers(data: unknown, typeName: string): unknown {
351
369
  // If this type is itself a wrapper, unwrap it
352
370
  if (typeName in ARRAY_WRAPPERS) {
353
371
  const innerKey = ARRAY_WRAPPERS[typeName];
354
- return (data as Record<string, unknown>)[innerKey] ?? [];
372
+ const arr = (data as Record<string, unknown>)[innerKey] ?? [];
373
+ // Recurse into each item using the element's type from CHILDREN_TYPES
374
+ if (Array.isArray(arr) && typeName in CHILDREN_TYPES) {
375
+ const elemType = CHILDREN_TYPES[typeName][innerKey];
376
+ if (elemType) return arr.map(item => unwrapArrayWrappers(item, elemType));
377
+ }
378
+ return arr;
355
379
  }
356
380
 
357
381
  // Recurse into children whose types may contain wrappers
@@ -360,7 +384,11 @@ export function unwrapArrayWrappers(data: unknown, typeName: string): unknown {
360
384
  for (const [propName, propType] of Object.entries(children)) {
361
385
  const val = (data as Record<string, unknown>)[propName];
362
386
  if (val !== undefined) {
363
- (data as Record<string, unknown>)[propName] = unwrapArrayWrappers(val, propType);
387
+ if (Array.isArray(val)) {
388
+ (data as Record<string, unknown>)[propName] = val.map(item => unwrapArrayWrappers(item, propType));
389
+ } else {
390
+ (data as Record<string, unknown>)[propName] = unwrapArrayWrappers(val, propType);
391
+ }
364
392
  }
365
393
  }
366
394
  }
@@ -746,6 +774,12 @@ export function emitRouteFilesWithHandlers(outDir, routesDir, versionSlug, servi
746
774
  ? `return buildSuccessEnvelope(unwrapArrayWrappers(result.response, "${resTypeName}"));`
747
775
  : `return buildSuccessEnvelope(result.response);`;
748
776
  // Note: op.path comes from OpenAPI and already includes any base path
777
+ const schemaBinding = op.skipResponseSchema
778
+ ? `\n// Response schema omitted: $ref graph exceeds fast-json-stringify depth limit\nconst { response: _response, ...routeSchema } = schema as Record<string, unknown>;\n`
779
+ : "";
780
+ const schemaLine = op.skipResponseSchema
781
+ ? " schema: routeSchema,"
782
+ : " schema,";
749
783
  let routeTs = `/**
750
784
  * Route: ${op.method.toUpperCase()} ${op.path}
751
785
  * Operation: ${op.operationId || op.operationSlug}
@@ -756,12 +790,12 @@ export function emitRouteFilesWithHandlers(outDir, routesDir, versionSlug, servi
756
790
  import type { FastifyInstance } from "fastify";
757
791
  ${typeImport}import schema from "../schemas/operations/${op.operationSlug}.json" with { type: "json" };
758
792
  ${runtimeImport}
759
-
793
+ ${schemaBinding}
760
794
  export async function ${fnName}(fastify: FastifyInstance) {
761
795
  fastify.route${routeGeneric}({
762
796
  method: "${op.method.toUpperCase()}",
763
797
  url: "${op.path}",
764
- schema,
798
+ ${schemaLine}
765
799
  handler: async (request) => {
766
800
  const client = fastify.${clientMeta.decoratorName};
767
801
  const result = await client.${clientMethod}(${bodyArg});
@@ -222,4 +222,17 @@ export declare function resolveOperationMeta(operationId: string, operationSlug:
222
222
  inputTypeName?: string;
223
223
  outputTypeName?: string;
224
224
  }>): ResolvedOperationMeta;
225
+ /**
226
+ * Measures the $ref graph complexity of a schema component.
227
+ *
228
+ * Walks all $ref chains from the starting schema and counts the number of
229
+ * unique schemas referenced. Used to detect response schemas that are too
230
+ * complex for fast-json-stringify to compile without stack overflow.
231
+ *
232
+ * @param startSchemaName - Name of the schema component to start from
233
+ * @param allSchemas - All component schemas (from doc.components.schemas)
234
+ * @param limit - Stop walking after this many unique refs (default 200)
235
+ * @returns Number of unique schema components reachable via $ref
236
+ */
237
+ export declare function measureSchemaRefComplexity(startSchemaName: string, allSchemas: Record<string, any>, limit?: number): number;
225
238
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":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C;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;CACnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,UAAU,CAkD3F;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,iBAAiB,CAAC,EAAE,KAAK,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC,GACD,qBAAqB,CAmBvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/B,KAAK,GAAE,MAAY,GAClB,MAAM,CAsCR"}
@@ -428,3 +428,61 @@ export function resolveOperationMeta(operationId, operationSlug, method, path, c
428
428
  responseTypeName,
429
429
  };
430
430
  }
431
+ /**
432
+ * Measures the $ref graph complexity of a schema component.
433
+ *
434
+ * Walks all $ref chains from the starting schema and counts the number of
435
+ * unique schemas referenced. Used to detect response schemas that are too
436
+ * complex for fast-json-stringify to compile without stack overflow.
437
+ *
438
+ * @param startSchemaName - Name of the schema component to start from
439
+ * @param allSchemas - All component schemas (from doc.components.schemas)
440
+ * @param limit - Stop walking after this many unique refs (default 200)
441
+ * @returns Number of unique schema components reachable via $ref
442
+ */
443
+ export function measureSchemaRefComplexity(startSchemaName, allSchemas, limit = 200) {
444
+ const visited = new Set();
445
+ function walkSchema(node) {
446
+ if (!node || typeof node !== "object" || visited.size >= limit)
447
+ return;
448
+ if (Array.isArray(node)) {
449
+ for (const item of node)
450
+ walkSchema(item);
451
+ return;
452
+ }
453
+ if (node.$ref && typeof node.$ref === "string") {
454
+ const prefix = "#/components/schemas/";
455
+ if (node.$ref.startsWith(prefix)) {
456
+ const refName = node.$ref.slice(prefix.length);
457
+ if (!visited.has(refName)) {
458
+ visited.add(refName);
459
+ if (allSchemas[refName])
460
+ walkSchema(allSchemas[refName]);
461
+ }
462
+ }
463
+ return;
464
+ }
465
+ if (node.properties) {
466
+ for (const propSchema of Object.values(node.properties))
467
+ walkSchema(propSchema);
468
+ }
469
+ if (node.items)
470
+ walkSchema(node.items);
471
+ if (node.additionalProperties && typeof node.additionalProperties === "object") {
472
+ walkSchema(node.additionalProperties);
473
+ }
474
+ if (node.allOf)
475
+ for (const m of node.allOf)
476
+ walkSchema(m);
477
+ if (node.anyOf)
478
+ for (const m of node.anyOf)
479
+ walkSchema(m);
480
+ if (node.oneOf)
481
+ for (const m of node.oneOf)
482
+ walkSchema(m);
483
+ }
484
+ visited.add(startSchemaName);
485
+ if (allSchemas[startSchemaName])
486
+ walkSchema(allSchemas[startSchemaName]);
487
+ return visited.size;
488
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"generatePaths.d.ts","sourceRoot":"","sources":["../../src/openapi/generatePaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAG3C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,gBAAgB;IAC/B,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAE9B,CAAC,MAAM,EAAE,MAAM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ACtB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC,CAAC;IAC9C,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC9C;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,oBAAoB,uBA6DlF"}
@@ -42,8 +42,12 @@ export function generatePaths(compiled, opts) {
42
42
  };
43
43
  if (override.summary)
44
44
  operationObject.summary = override.summary;
45
- if (override.description)
45
+ if (override.description) {
46
46
  operationObject.description = override.description;
47
+ }
48
+ else if (op.doc) {
49
+ operationObject.description = op.doc;
50
+ }
47
51
  if (override.deprecated)
48
52
  operationObject.deprecated = true;
49
53
  if (parameters.length)
@@ -1 +1 @@
1
- {"version":3,"file":"generateSchemas.d.ts","sourceRoot":"","sources":["../../src/openapi/generateSchemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAgB,eAAe,EAAe,MAAM,+BAA+B,CAAC;AAEhG;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAwIpD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,sBAAsB,GAAG,iBAAiB,CA+C1G"}
1
+ {"version":3,"file":"generateSchemas.d.ts","sourceRoot":"","sources":["../../src/openapi/generateSchemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAgB,eAAe,EAAe,MAAM,+BAA+B,CAAC;AAEhG;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAgKpD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,sBAAsB,GAAG,iBAAiB,CA+C1G"}
@@ -28,14 +28,24 @@ function primitiveSchema(ts) {
28
28
  function buildAliasSchema(a) {
29
29
  const lit = isLiteralUnion(a.tsType);
30
30
  if (lit) {
31
- return { type: "string", enum: lit };
31
+ return {
32
+ type: "string",
33
+ enum: lit,
34
+ ...(a.doc ? { description: a.doc } : {}),
35
+ };
32
36
  }
33
37
  // If alias wraps primitive
34
38
  if (["string", "number", "boolean", "any"].includes(a.tsType) || a.tsType.endsWith("[]")) {
35
- return primitiveSchema(a.tsType);
39
+ return {
40
+ ...primitiveSchema(a.tsType),
41
+ ...(a.doc ? { description: a.doc } : {}),
42
+ };
36
43
  }
37
44
  // alias of another complex/alias type -> allOf wrapper preserves name
38
- return { allOf: [{ $ref: `#/components/schemas/${a.tsType}` }] };
45
+ return {
46
+ allOf: [{ $ref: `#/components/schemas/${a.tsType}` }],
47
+ ...(a.doc ? { description: a.doc } : {}),
48
+ };
39
49
  }
40
50
  function isArrayWrapper(t) {
41
51
  if (t.attrs.length !== 0)
@@ -80,13 +90,21 @@ function buildComplexSchema(t, closed, knownTypeNames, aliasNames, flattenWrappe
80
90
  const arrayWrap = flattenWrappers ? isArrayWrapper(t) : null;
81
91
  if (arrayWrap) {
82
92
  const item = refOrPrimitive(String(arrayWrap.itemType));
83
- return { type: "array", items: item };
93
+ return {
94
+ type: "array",
95
+ items: item,
96
+ ...(t.doc ? { description: t.doc } : {}),
97
+ };
84
98
  }
85
99
  const properties = {};
86
100
  const required = [];
87
101
  // attributes
88
102
  for (const a of t.attrs) {
89
- properties[a.name] = refOrPrimitive(a.tsType);
103
+ const propSchema = refOrPrimitive(a.tsType);
104
+ if (a.doc) {
105
+ propSchema.description = a.doc;
106
+ }
107
+ properties[a.name] = propSchema;
90
108
  if (a.use === "required")
91
109
  required.push(a.name);
92
110
  }
@@ -100,6 +118,9 @@ function buildComplexSchema(t, closed, knownTypeNames, aliasNames, flattenWrappe
100
118
  if (e.nillable) {
101
119
  schema = { anyOf: [schema, { type: "null" }] };
102
120
  }
121
+ if (e.doc) {
122
+ schema.description = e.doc;
123
+ }
103
124
  properties[e.name] = schema;
104
125
  if (e.name === "$value") {
105
126
  // never required
@@ -130,6 +151,9 @@ function buildComplexSchema(t, closed, knownTypeNames, aliasNames, flattenWrappe
130
151
  if (!closed)
131
152
  delete obj.additionalProperties; // put closed only on leaf part
132
153
  }
154
+ if (t.doc) {
155
+ obj.description = t.doc;
156
+ }
133
157
  return obj;
134
158
  }
135
159
  /**
@@ -43,6 +43,7 @@ export interface PipelineOptions {
43
43
  test?: {
44
44
  testDir: string;
45
45
  force?: boolean;
46
+ flattenArrayWrappers?: boolean;
46
47
  };
47
48
  }
48
49
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../src/pipeline.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAkB,KAAK,sBAAsB,EAAC,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAkB,KAAK,sBAAsB,EAAC,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAC,KAAK,eAAe,EAAyB,MAAM,aAAa,CAAC;AAGzE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,C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GAiBG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,MAAM,GAAG,aAAa,GAAG,iBAAiB,CAAC,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1G,OAAO,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,aAAa,GAAG,iBAAiB,CAAC,GAAG;QAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;QACnC,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,IAAI,CAAC,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;CACH;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,GAAG,CAAC;IAAC,UAAU,CAAC,EAAE,GAAG,CAAC;CAAE,CAAC,CAiJhH"}
package/dist/pipeline.js CHANGED
@@ -143,6 +143,7 @@ export async function runGenerationPipeline(opts) {
143
143
  force: opts.test.force,
144
144
  versionSlug: opts.gateway.versionSlug,
145
145
  serviceSlug: opts.gateway.serviceSlug,
146
+ flattenArrayWrappers: opts.test.flattenArrayWrappers ?? opts.openapi?.flattenArrayWrappers,
146
147
  });
147
148
  }
148
149
  // Return the compiled catalog and OpenAPI doc for potential further processing
@@ -10,6 +10,7 @@ export interface GenerateTestsOptions {
10
10
  force?: boolean;
11
11
  versionSlug?: string;
12
12
  serviceSlug?: string;
13
+ flattenArrayWrappers?: boolean;
13
14
  }
14
15
  /**
15
16
  * Generates a complete Vitest test suite for the generated gateway artifacts.
@@ -1 +1 @@
1
- {"version":3,"file":"generateTests.d.ts","sourceRoot":"","sources":["../../src/test/generateTests.ts"],"names":[],"mappings":"AAgCA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAuBD;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4J7E"}
1
+ {"version":3,"file":"generateTests.d.ts","sourceRoot":"","sources":["../../src/test/generateTests.ts"],"names":[],"mappings":"AAiCA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAuBD;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiK7E"}
@@ -15,6 +15,7 @@ import fs from "node:fs";
15
15
  import path from "node:path";
16
16
  import { info, success } from "../util/cli.js";
17
17
  import { resolveClientMeta, resolveOperationMeta } from "../gateway/helpers.js";
18
+ import { generateAllOperationMocks } from "./mockData.js";
18
19
  import { emitVitestConfig, emitMockClientHelper, emitTestAppHelper, emitRoutesTest, emitErrorsTest, emitEnvelopeTest, emitValidationTest, emitClassifyErrorTest, emitEnvelopeBuildersTest, emitUnwrapTest, } from "./generators.js";
19
20
  /**
20
21
  * Checks whether a test file should be written.
@@ -109,18 +110,22 @@ export async function generateTests(opts) {
109
110
  fs.mkdirSync(path.join(testDir, "helpers"), { recursive: true });
110
111
  fs.mkdirSync(path.join(testDir, "gateway"), { recursive: true });
111
112
  fs.mkdirSync(path.join(testDir, "runtime"), { recursive: true });
113
+ // Compute mock data once for all emitters
114
+ const mocks = generateAllOperationMocks(catalog, {
115
+ flattenArrayWrappers: opts.flattenArrayWrappers,
116
+ });
112
117
  // Emit vitest.config.ts
113
118
  writeTestFile(path.join(testDir, "vitest.config.ts"), emitVitestConfig(), force);
114
119
  // Emit helpers/mock-client.ts
115
- writeTestFile(path.join(testDir, "helpers", "mock-client.ts"), emitMockClientHelper(testDir, clientDir, importsMode, clientMeta, operations, catalog), force);
120
+ writeTestFile(path.join(testDir, "helpers", "mock-client.ts"), emitMockClientHelper(testDir, clientDir, importsMode, clientMeta, operations, mocks), force);
116
121
  // Emit helpers/test-app.ts
117
122
  writeTestFile(path.join(testDir, "helpers", "test-app.ts"), emitTestAppHelper(testDir, gatewayDir, importsMode, clientMeta), force);
118
123
  // Emit gateway/routes.test.ts
119
- writeTestFile(path.join(testDir, "gateway", "routes.test.ts"), emitRoutesTest(testDir, importsMode, operations, catalog), force);
124
+ writeTestFile(path.join(testDir, "gateway", "routes.test.ts"), emitRoutesTest(testDir, importsMode, operations, mocks), force);
120
125
  // Emit gateway/errors.test.ts
121
- writeTestFile(path.join(testDir, "gateway", "errors.test.ts"), emitErrorsTest(testDir, importsMode, operations, catalog), force);
126
+ writeTestFile(path.join(testDir, "gateway", "errors.test.ts"), emitErrorsTest(testDir, importsMode, operations, mocks), force);
122
127
  // Emit gateway/envelope.test.ts
123
- writeTestFile(path.join(testDir, "gateway", "envelope.test.ts"), emitEnvelopeTest(testDir, importsMode, operations, catalog), force);
128
+ writeTestFile(path.join(testDir, "gateway", "envelope.test.ts"), emitEnvelopeTest(testDir, importsMode, operations, mocks), force);
124
129
  // Emit gateway/validation.test.ts
125
130
  writeTestFile(path.join(testDir, "gateway", "validation.test.ts"), emitValidationTest(testDir, importsMode, operations), force);
126
131
  // Emit runtime/classify-error.test.ts
@@ -1,5 +1,10 @@
1
1
  import type { ClientMeta, ResolvedOperationMeta } from "../gateway/helpers.js";
2
2
  import type { CatalogForMocks } from "./mockData.js";
3
+ /** Pre-computed mock data map passed from the orchestrator to all emitters. */
4
+ export type OperationMocksMap = Map<string, {
5
+ request: Record<string, unknown>;
6
+ response: Record<string, unknown>;
7
+ }>;
3
8
  /**
4
9
  * Emits vitest.config.ts content.
5
10
  *
@@ -15,9 +20,9 @@ export declare function emitVitestConfig(): string;
15
20
  * @param importsMode - Import extension mode
16
21
  * @param clientMeta - Client metadata
17
22
  * @param operations - Resolved operation metadata
18
- * @param catalog - Compiled catalog for mock data generation
23
+ * @param mocks - Pre-computed mock data map
19
24
  */
20
- export declare function emitMockClientHelper(testDir: string, clientDir: string, importsMode: "js" | "ts" | "bare", clientMeta: ClientMeta, operations: ResolvedOperationMeta[], catalog: CatalogForMocks): string;
25
+ export declare function emitMockClientHelper(testDir: string, clientDir: string, importsMode: "js" | "ts" | "bare", clientMeta: ClientMeta, operations: ResolvedOperationMeta[], mocks: OperationMocksMap): string;
21
26
  /**
22
27
  * Emits helpers/test-app.ts content.
23
28
  *
@@ -33,22 +38,22 @@ export declare function emitTestAppHelper(testDir: string, gatewayDir: string, i
33
38
  * @param testDir - Absolute path to test output directory
34
39
  * @param importsMode - Import extension mode
35
40
  * @param operations - Resolved operation metadata
36
- * @param catalog - Compiled catalog for mock data generation
41
+ * @param mocks - Pre-computed mock data map
37
42
  */
38
- export declare function emitRoutesTest(testDir: string, importsMode: "js" | "ts" | "bare", operations: ResolvedOperationMeta[], catalog: CatalogForMocks): string;
43
+ export declare function emitRoutesTest(testDir: string, importsMode: "js" | "ts" | "bare", operations: ResolvedOperationMeta[], mocks: OperationMocksMap): string;
39
44
  /**
40
45
  * Emits gateway/errors.test.ts with error classification tests through Fastify.
41
46
  *
42
47
  * @param testDir - Absolute path to test output directory
43
48
  * @param importsMode - Import extension mode
44
49
  * @param operations - Resolved operation metadata (uses first operation for error tests)
45
- * @param catalog - Compiled catalog for mock data generation
50
+ * @param mocks - Pre-computed mock data map
46
51
  */
47
- export declare function emitErrorsTest(testDir: string, importsMode: "js" | "ts" | "bare", operations: ResolvedOperationMeta[], catalog: CatalogForMocks): string;
52
+ export declare function emitErrorsTest(testDir: string, importsMode: "js" | "ts" | "bare", operations: ResolvedOperationMeta[], mocks: OperationMocksMap): string;
48
53
  /**
49
54
  * Emits gateway/envelope.test.ts with SUCCESS/ERROR structure assertions.
50
55
  */
51
- export declare function emitEnvelopeTest(testDir: string, importsMode: "js" | "ts" | "bare", operations: ResolvedOperationMeta[], catalog: CatalogForMocks): string;
56
+ export declare function emitEnvelopeTest(testDir: string, importsMode: "js" | "ts" | "bare", operations: ResolvedOperationMeta[], mocks: OperationMocksMap): string;
52
57
  /**
53
58
  * Emits gateway/validation.test.ts with invalid payload tests per route.
54
59
  */
@@ -1 +1 @@
1
- {"version":3,"file":"generators.d.ts","sourceRoot":"","sources":["../../src/test/generators.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAC,UAAU,EAAE,qBAAqB,EAAC,MAAM,uBAAuB,CA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