@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.cjs +10 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -467,10 +467,14 @@ function buildResponseUnionSchema(node, resolver) {
|
|
|
467
467
|
}
|
|
468
468
|
return kubb_kit.ast.factory.createSchema({
|
|
469
469
|
type: "union",
|
|
470
|
-
members: responses.map((response) =>
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
470
|
+
members: responses.map((response) => {
|
|
471
|
+
const schema = (response.content?.length ?? 0) === 1 ? response.content?.[0]?.schema : void 0;
|
|
472
|
+
return kubb_kit.ast.factory.createSchema({
|
|
473
|
+
type: "ref",
|
|
474
|
+
name: resolver.response.status(node, response.statusCode),
|
|
475
|
+
schema
|
|
476
|
+
});
|
|
477
|
+
})
|
|
474
478
|
});
|
|
475
479
|
}
|
|
476
480
|
const SCALAR_TYPES$1 = /* @__PURE__ */ new Set([
|
|
@@ -1291,7 +1295,8 @@ const fakerGenerator = (0, kubb_kit.defineGenerator)({
|
|
|
1291
1295
|
type: "union",
|
|
1292
1296
|
members: variants.map((variant) => kubb_kit.ast.factory.createSchema({
|
|
1293
1297
|
type: "ref",
|
|
1294
|
-
name: variant.name
|
|
1298
|
+
name: variant.name,
|
|
1299
|
+
schema: variant.schema
|
|
1295
1300
|
}))
|
|
1296
1301
|
});
|
|
1297
1302
|
return [...variants.map((variant) => ({
|