@kubb/adapter-oas 5.2.1 → 5.2.2
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.cjs
CHANGED
|
@@ -1394,10 +1394,7 @@ function convertUnion({ schema, name, nullable, defaultValue, rawOptions, parse,
|
|
|
1394
1394
|
};
|
|
1395
1395
|
const unionMembers = [...schema.oneOf ?? [], ...schema.anyOf ?? []];
|
|
1396
1396
|
const strategy = schema.oneOf ? "one" : "any";
|
|
1397
|
-
const
|
|
1398
|
-
discriminatorPropertyName: isDiscriminator(schema) ? schema.discriminator.propertyName : void 0,
|
|
1399
|
-
strategy
|
|
1400
|
-
};
|
|
1397
|
+
const explicitDiscriminatorPropertyName = isDiscriminator(schema) ? schema.discriminator.propertyName : void 0;
|
|
1401
1398
|
const discriminator = isDiscriminator(schema) ? schema.discriminator : void 0;
|
|
1402
1399
|
const { oneOf: _o, anyOf: _a, discriminator: _d, ...memberBaseSchema } = schema;
|
|
1403
1400
|
const sharedPropertiesNode = schema.properties ? parse({
|
|
@@ -1416,8 +1413,9 @@ function convertUnion({ schema, name, nullable, defaultValue, rawOptions, parse,
|
|
|
1416
1413
|
});
|
|
1417
1414
|
const unionNode = createNode(ctx, {
|
|
1418
1415
|
type: "union",
|
|
1419
|
-
|
|
1420
|
-
members
|
|
1416
|
+
strategy,
|
|
1417
|
+
members,
|
|
1418
|
+
discriminatorPropertyName: explicitDiscriminatorPropertyName ?? _kubb_ast.ast.inferDiscriminatorPropertyName(members)
|
|
1421
1419
|
});
|
|
1422
1420
|
if (!sharedPropertiesNode) return unionNode;
|
|
1423
1421
|
return createNode(ctx, {
|
|
@@ -1425,13 +1423,15 @@ function convertUnion({ schema, name, nullable, defaultValue, rawOptions, parse,
|
|
|
1425
1423
|
members: [unionNode, sharedPropertiesNode]
|
|
1426
1424
|
});
|
|
1427
1425
|
}
|
|
1426
|
+
const members = unionMembers.map((s) => parse({
|
|
1427
|
+
schema: s,
|
|
1428
|
+
name
|
|
1429
|
+
}, rawOptions));
|
|
1428
1430
|
const unionNode = createNode(ctx, {
|
|
1429
1431
|
type: "union",
|
|
1430
|
-
|
|
1431
|
-
members
|
|
1432
|
-
|
|
1433
|
-
name
|
|
1434
|
-
}, rawOptions))
|
|
1432
|
+
strategy,
|
|
1433
|
+
members,
|
|
1434
|
+
discriminatorPropertyName: explicitDiscriminatorPropertyName ?? _kubb_ast.ast.inferDiscriminatorPropertyName(members)
|
|
1435
1435
|
});
|
|
1436
1436
|
return _kubb_ast.ast.applyMacros(unionNode, [_kubb_kit.macroSimplifyUnion], { depth: "shallow" });
|
|
1437
1437
|
}
|