@kubb/adapter-oas 5.2.1 → 5.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/index.cjs +11 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1371,10 +1371,7 @@ function convertUnion({ schema, name, nullable, defaultValue, rawOptions, parse,
|
|
|
1371
1371
|
};
|
|
1372
1372
|
const unionMembers = [...schema.oneOf ?? [], ...schema.anyOf ?? []];
|
|
1373
1373
|
const strategy = schema.oneOf ? "one" : "any";
|
|
1374
|
-
const
|
|
1375
|
-
discriminatorPropertyName: isDiscriminator(schema) ? schema.discriminator.propertyName : void 0,
|
|
1376
|
-
strategy
|
|
1377
|
-
};
|
|
1374
|
+
const explicitDiscriminatorPropertyName = isDiscriminator(schema) ? schema.discriminator.propertyName : void 0;
|
|
1378
1375
|
const discriminator = isDiscriminator(schema) ? schema.discriminator : void 0;
|
|
1379
1376
|
const { oneOf: _o, anyOf: _a, discriminator: _d, ...memberBaseSchema } = schema;
|
|
1380
1377
|
const sharedPropertiesNode = schema.properties ? parse({
|
|
@@ -1393,8 +1390,9 @@ function convertUnion({ schema, name, nullable, defaultValue, rawOptions, parse,
|
|
|
1393
1390
|
});
|
|
1394
1391
|
const unionNode = createNode(ctx, {
|
|
1395
1392
|
type: "union",
|
|
1396
|
-
|
|
1397
|
-
members
|
|
1393
|
+
strategy,
|
|
1394
|
+
members,
|
|
1395
|
+
discriminatorPropertyName: explicitDiscriminatorPropertyName ?? ast.inferDiscriminatorPropertyName(members)
|
|
1398
1396
|
});
|
|
1399
1397
|
if (!sharedPropertiesNode) return unionNode;
|
|
1400
1398
|
return createNode(ctx, {
|
|
@@ -1402,13 +1400,15 @@ function convertUnion({ schema, name, nullable, defaultValue, rawOptions, parse,
|
|
|
1402
1400
|
members: [unionNode, sharedPropertiesNode]
|
|
1403
1401
|
});
|
|
1404
1402
|
}
|
|
1403
|
+
const members = unionMembers.map((s) => parse({
|
|
1404
|
+
schema: s,
|
|
1405
|
+
name
|
|
1406
|
+
}, rawOptions));
|
|
1405
1407
|
const unionNode = createNode(ctx, {
|
|
1406
1408
|
type: "union",
|
|
1407
|
-
|
|
1408
|
-
members
|
|
1409
|
-
|
|
1410
|
-
name
|
|
1411
|
-
}, rawOptions))
|
|
1409
|
+
strategy,
|
|
1410
|
+
members,
|
|
1411
|
+
discriminatorPropertyName: explicitDiscriminatorPropertyName ?? ast.inferDiscriminatorPropertyName(members)
|
|
1412
1412
|
});
|
|
1413
1413
|
return ast.applyMacros(unionNode, [macroSimplifyUnion], { depth: "shallow" });
|
|
1414
1414
|
}
|