@kubb/plugin-faker 5.0.5 → 5.0.6

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/index.js CHANGED
@@ -463,10 +463,14 @@ function buildResponseUnionSchema(node, resolver) {
463
463
  }
464
464
  return ast.factory.createSchema({
465
465
  type: "union",
466
- members: responses.map((response) => ast.factory.createSchema({
467
- type: "ref",
468
- name: resolver.response.status(node, response.statusCode)
469
- }))
466
+ members: responses.map((response) => {
467
+ const schema = (response.content?.length ?? 0) === 1 ? response.content?.[0]?.schema : void 0;
468
+ return ast.factory.createSchema({
469
+ type: "ref",
470
+ name: resolver.response.status(node, response.statusCode),
471
+ schema
472
+ });
473
+ })
470
474
  });
471
475
  }
472
476
  const SCALAR_TYPES$1 = /* @__PURE__ */ new Set([
@@ -1287,7 +1291,8 @@ const fakerGenerator = defineGenerator({
1287
1291
  type: "union",
1288
1292
  members: variants.map((variant) => ast.factory.createSchema({
1289
1293
  type: "ref",
1290
- name: variant.name
1294
+ name: variant.name,
1295
+ schema: variant.schema
1291
1296
  }))
1292
1297
  });
1293
1298
  return [...variants.map((variant) => ({