@kubb/adapter-oas 5.0.0-beta.91 → 5.0.0-beta.93
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 +51 -153
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -5
- package/dist/index.js +51 -153
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -33,13 +33,6 @@ let api_ref_bundler = require("api-ref-bundler");
|
|
|
33
33
|
//#region src/constants.ts
|
|
34
34
|
/**
|
|
35
35
|
* Default parser options applied when no explicit options are provided.
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```ts
|
|
39
|
-
* import { DEFAULT_PARSER_OPTIONS, parseOas } from '@kubb/adapter-oas'
|
|
40
|
-
*
|
|
41
|
-
* const { root } = parseOas(document, { ...DEFAULT_PARSER_OPTIONS, dateType: 'date' })
|
|
42
|
-
* ```
|
|
43
36
|
*/
|
|
44
37
|
const DEFAULT_PARSER_OPTIONS = {
|
|
45
38
|
dateType: "string",
|
|
@@ -78,14 +71,6 @@ const SUPPORTED_METHODS = /* @__PURE__ */ new Set([
|
|
|
78
71
|
*
|
|
79
72
|
* A fragment that contains any of these keys carries structural meaning of its own and must stay as a separate
|
|
80
73
|
* intersection member rather than being merged into the parent.
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* ```ts
|
|
84
|
-
* import { structuralKeys } from '@kubb/adapter-oas'
|
|
85
|
-
*
|
|
86
|
-
* const isStructural = Object.keys(fragment).some((key) => structuralKeys.has(key))
|
|
87
|
-
* // true when fragment has e.g. 'properties' or 'oneOf'
|
|
88
|
-
* ```
|
|
89
74
|
*/
|
|
90
75
|
const structuralKeys = /* @__PURE__ */ new Set([
|
|
91
76
|
"properties",
|
|
@@ -115,15 +100,6 @@ const specialCasedFormats = /* @__PURE__ */ new Set([
|
|
|
115
100
|
* Formats that depend on runtime options (`int64`, `date-time`, `date`, `time`) are handled
|
|
116
101
|
* separately in the parser. `ipv4` and `ipv6` map to their own dedicated schema types. `hostname`
|
|
117
102
|
* and `idn-hostname` map to `'url'` as the closest generic string-format type.
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* ```ts
|
|
121
|
-
* import { formatMap } from '@kubb/adapter-oas'
|
|
122
|
-
*
|
|
123
|
-
* formatMap['uuid'] // 'uuid'
|
|
124
|
-
* formatMap['binary'] // 'blob'
|
|
125
|
-
* formatMap['float'] // 'number'
|
|
126
|
-
* ```
|
|
127
103
|
*/
|
|
128
104
|
const formatMap = {
|
|
129
105
|
uuid: "uuid",
|
|
@@ -144,24 +120,10 @@ const formatMap = {
|
|
|
144
120
|
};
|
|
145
121
|
/**
|
|
146
122
|
* Vendor extension keys that attach human-readable labels to enum values, checked in priority order.
|
|
147
|
-
*
|
|
148
|
-
* @example
|
|
149
|
-
* ```ts
|
|
150
|
-
* import { enumExtensionKeys } from '@kubb/adapter-oas'
|
|
151
|
-
*
|
|
152
|
-
* const key = enumExtensionKeys.find((k) => k in schema) // 'x-enumNames' | 'x-enum-varnames' | undefined
|
|
153
|
-
* ```
|
|
154
123
|
*/
|
|
155
124
|
const enumExtensionKeys = ["x-enumNames", "x-enum-varnames"];
|
|
156
125
|
/**
|
|
157
126
|
* Vendor extension keys that attach human-readable descriptions to enum values, checked in priority order.
|
|
158
|
-
*
|
|
159
|
-
* @example
|
|
160
|
-
* ```ts
|
|
161
|
-
* import { enumDescriptionKeys } from '@kubb/adapter-oas'
|
|
162
|
-
*
|
|
163
|
-
* const key = enumDescriptionKeys.find((k) => k in schema) // 'x-enumDescriptions' | 'x-enum-descriptions' | undefined
|
|
164
|
-
* ```
|
|
165
127
|
*/
|
|
166
128
|
const enumDescriptionKeys = ["x-enumDescriptions", "x-enum-descriptions"];
|
|
167
129
|
//#endregion
|
|
@@ -565,6 +527,18 @@ function isDiscriminator(obj) {
|
|
|
565
527
|
const record = obj;
|
|
566
528
|
return !!obj && !!record["discriminator"] && typeof record["discriminator"] !== "string";
|
|
567
529
|
}
|
|
530
|
+
/**
|
|
531
|
+
* Returns `true` when a schema is a binary payload: an octet-stream string body.
|
|
532
|
+
*
|
|
533
|
+
* @example
|
|
534
|
+
* ```ts
|
|
535
|
+
* isBinary({ type: 'string', contentMediaType: 'application/octet-stream' }) // true
|
|
536
|
+
* isBinary({ type: 'string' }) // false
|
|
537
|
+
* ```
|
|
538
|
+
*/
|
|
539
|
+
function isBinary(schema) {
|
|
540
|
+
return schema.type === "string" && schema.contentMediaType === "application/octet-stream";
|
|
541
|
+
}
|
|
568
542
|
//#endregion
|
|
569
543
|
//#region src/mime.ts
|
|
570
544
|
/**
|
|
@@ -786,37 +760,6 @@ function getOperations(document) {
|
|
|
786
760
|
return operations;
|
|
787
761
|
}
|
|
788
762
|
//#endregion
|
|
789
|
-
//#region src/dialect.ts
|
|
790
|
-
/**
|
|
791
|
-
* The OpenAPI / Swagger dialect, the default used by `@kubb/adapter-oas`.
|
|
792
|
-
*
|
|
793
|
-
* Implements the spec-agnostic {@link ast.SchemaDialect} contract: it isolates the
|
|
794
|
-
* decisions that differ between specs (nullability, `$ref`, discriminator, binary,
|
|
795
|
-
* ref resolution) so the converter pipeline and dispatch rules stay shared. A
|
|
796
|
-
* future adapter (e.g. AsyncAPI) ships its own dialect, `type: ['null', …]`
|
|
797
|
-
* nullability, no discriminator object, binary via `contentEncoding` and reuses
|
|
798
|
-
* the rest unchanged.
|
|
799
|
-
*
|
|
800
|
-
* Formats (`uuid`, `email`, dates, …) are intentionally NOT here: they are shared
|
|
801
|
-
* JSON Schema vocabulary, so the converters keep that common case.
|
|
802
|
-
*
|
|
803
|
-
* @example
|
|
804
|
-
* ```ts
|
|
805
|
-
* const parser = createSchemaParser(context) // uses oasDialect
|
|
806
|
-
* const parser = createSchemaParser(context, oasDialect) // explicit
|
|
807
|
-
* ```
|
|
808
|
-
*/
|
|
809
|
-
const oasDialect = _kubb_ast.ast.defineDialect({
|
|
810
|
-
name: "oas",
|
|
811
|
-
schema: {
|
|
812
|
-
isNullable,
|
|
813
|
-
isReference,
|
|
814
|
-
isDiscriminator,
|
|
815
|
-
isBinary: (schema) => schema.type === "string" && schema.contentMediaType === "application/octet-stream",
|
|
816
|
-
resolveRef
|
|
817
|
-
}
|
|
818
|
-
});
|
|
819
|
-
//#endregion
|
|
820
763
|
//#region src/resolvers.ts
|
|
821
764
|
/**
|
|
822
765
|
* Reads the server URL from the document's `servers` array at `server.index`,
|
|
@@ -924,19 +867,10 @@ function getResponseBody(responseBody, contentType) {
|
|
|
924
867
|
if (!(contentType in body.content)) return false;
|
|
925
868
|
return body.content[contentType];
|
|
926
869
|
}
|
|
927
|
-
let availableContentType;
|
|
928
870
|
const contentTypes = Object.keys(body.content);
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
}
|
|
933
|
-
if (!availableContentType) availableContentType = contentTypes[0];
|
|
934
|
-
if (availableContentType) return [
|
|
935
|
-
availableContentType,
|
|
936
|
-
body.content[availableContentType],
|
|
937
|
-
...body.description ? [body.description] : []
|
|
938
|
-
];
|
|
939
|
-
return false;
|
|
871
|
+
const availableContentType = contentTypes.find(isJsonMimeType) ?? contentTypes[0];
|
|
872
|
+
if (!availableContentType) return false;
|
|
873
|
+
return body.content[availableContentType];
|
|
940
874
|
}
|
|
941
875
|
/**
|
|
942
876
|
* Returns the response schema for a given operation and HTTP status code.
|
|
@@ -965,7 +899,7 @@ function getResponseSchema(document, operation, statusCode, options = {}) {
|
|
|
965
899
|
statusCode
|
|
966
900
|
}), options.contentType);
|
|
967
901
|
if (responseBody === false) return {};
|
|
968
|
-
const schema =
|
|
902
|
+
const schema = responseBody.schema;
|
|
969
903
|
if (!schema) return {};
|
|
970
904
|
return dereferenceWithRef(document, schema);
|
|
971
905
|
}
|
|
@@ -1336,7 +1270,7 @@ function nameEnums(node, options) {
|
|
|
1336
1270
|
*
|
|
1337
1271
|
* @internal
|
|
1338
1272
|
*/
|
|
1339
|
-
function createSchemaParser(ctx
|
|
1273
|
+
function createSchemaParser(ctx) {
|
|
1340
1274
|
const document = ctx.document;
|
|
1341
1275
|
/**
|
|
1342
1276
|
* Tracks `$ref` paths that are currently being resolved to prevent infinite
|
|
@@ -1362,7 +1296,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1362
1296
|
if (!refExistence.has(refPath)) {
|
|
1363
1297
|
let exists = false;
|
|
1364
1298
|
try {
|
|
1365
|
-
exists = !!
|
|
1299
|
+
exists = !!resolveRef(document, refPath);
|
|
1366
1300
|
} catch {
|
|
1367
1301
|
exists = false;
|
|
1368
1302
|
}
|
|
@@ -1384,7 +1318,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1384
1318
|
if (refPath && !resolvingRefs.has(refPath)) {
|
|
1385
1319
|
if (!resolvedRefCache.has(refPath)) {
|
|
1386
1320
|
try {
|
|
1387
|
-
const referenced =
|
|
1321
|
+
const referenced = resolveRef(document, refPath);
|
|
1388
1322
|
if (referenced) {
|
|
1389
1323
|
resolvingRefs.add(refPath);
|
|
1390
1324
|
resolvedSchema = parseSchema({ schema: referenced }, rawOptions);
|
|
@@ -1437,13 +1371,13 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1437
1371
|
}
|
|
1438
1372
|
const filteredDiscriminantValues = [];
|
|
1439
1373
|
const allOfMembers = schema.allOf.filter((item) => {
|
|
1440
|
-
if (!
|
|
1441
|
-
const deref =
|
|
1442
|
-
if (!deref || !
|
|
1374
|
+
if (!isReference(item) || !name) return true;
|
|
1375
|
+
const deref = resolveRef(document, item.$ref);
|
|
1376
|
+
if (!deref || !isDiscriminator(deref)) return true;
|
|
1443
1377
|
const parentUnion = deref.oneOf ?? deref.anyOf;
|
|
1444
1378
|
if (!parentUnion) return true;
|
|
1445
1379
|
const childRef = `${SCHEMA_REF_PREFIX}${name}`;
|
|
1446
|
-
const inOneOf = parentUnion.some((oneOfItem) =>
|
|
1380
|
+
const inOneOf = parentUnion.some((oneOfItem) => isReference(oneOfItem) && oneOfItem.$ref === childRef);
|
|
1447
1381
|
const inMapping = Object.values(deref.discriminator.mapping ?? {}).some((v) => v === childRef);
|
|
1448
1382
|
if (inOneOf || inMapping) {
|
|
1449
1383
|
const discriminatorValue = findDiscriminator(deref.discriminator.mapping, childRef);
|
|
@@ -1464,9 +1398,9 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1464
1398
|
const missingRequired = schema.required.filter((key) => !outerKeys.has(key));
|
|
1465
1399
|
if (missingRequired.length) {
|
|
1466
1400
|
const resolvedMembers = schema.allOf.flatMap((item) => {
|
|
1467
|
-
if (!
|
|
1468
|
-
const deref =
|
|
1469
|
-
return deref && !
|
|
1401
|
+
if (!isReference(item)) return [item];
|
|
1402
|
+
const deref = resolveRef(document, item.$ref);
|
|
1403
|
+
return deref && !isReference(deref) ? [deref] : [];
|
|
1470
1404
|
});
|
|
1471
1405
|
for (const key of missingRequired) for (const resolved of resolvedMembers) if (resolved.properties?.[key]) {
|
|
1472
1406
|
allOfMembers.push(parseSchema({
|
|
@@ -1512,7 +1446,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1512
1446
|
return decodeURIComponent($ref.substring(1)).split("/").filter(Boolean).reduce((obj, key) => obj?.[key], document) ?? null;
|
|
1513
1447
|
}
|
|
1514
1448
|
function implicitDiscriminantValue(member) {
|
|
1515
|
-
if (!discriminator || discriminator.mapping || !
|
|
1449
|
+
if (!discriminator || discriminator.mapping || !isReference(member)) return null;
|
|
1516
1450
|
const value = (0, _kubb_ast.extractRefName)(member.$ref);
|
|
1517
1451
|
if (!value) return null;
|
|
1518
1452
|
const variant = resolveRefSilent(member.$ref);
|
|
@@ -1521,12 +1455,12 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1521
1455
|
const seen = /* @__PURE__ */ new Set([member.$ref]);
|
|
1522
1456
|
function constrains(v) {
|
|
1523
1457
|
const prop = v.properties?.[propertyName];
|
|
1524
|
-
const resolved = prop &&
|
|
1458
|
+
const resolved = prop && isReference(prop) ? resolveRefSilent(prop.$ref) : prop;
|
|
1525
1459
|
if (resolved && (Array.isArray(resolved.enum) || resolved.const !== void 0)) return true;
|
|
1526
1460
|
const composition = v.allOf ?? v.oneOf ?? v.anyOf;
|
|
1527
1461
|
if (!composition) return false;
|
|
1528
1462
|
return composition.some((m) => {
|
|
1529
|
-
if (!
|
|
1463
|
+
if (!isReference(m)) return constrains(m);
|
|
1530
1464
|
if (seen.has(m.$ref)) return false;
|
|
1531
1465
|
seen.add(m.$ref);
|
|
1532
1466
|
const r = resolveRefSilent(m.$ref);
|
|
@@ -1539,10 +1473,10 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1539
1473
|
const strategy = schema.oneOf ? "one" : "any";
|
|
1540
1474
|
const unionBase = {
|
|
1541
1475
|
...buildSchemaNode(schema, name, nullable, defaultValue),
|
|
1542
|
-
discriminatorPropertyName:
|
|
1476
|
+
discriminatorPropertyName: isDiscriminator(schema) ? schema.discriminator.propertyName : void 0,
|
|
1543
1477
|
strategy
|
|
1544
1478
|
};
|
|
1545
|
-
const discriminator =
|
|
1479
|
+
const discriminator = isDiscriminator(schema) ? schema.discriminator : void 0;
|
|
1546
1480
|
const { oneOf: _o, anyOf: _a, discriminator: _d, ...memberBaseSchema } = schema;
|
|
1547
1481
|
const sharedPropertiesNode = schema.properties ? parseSchema({
|
|
1548
1482
|
schema: memberBaseSchema,
|
|
@@ -1550,7 +1484,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1550
1484
|
}, rawOptions) : void 0;
|
|
1551
1485
|
if (sharedPropertiesNode || discriminator) {
|
|
1552
1486
|
const members = unionMembers.map((s) => {
|
|
1553
|
-
const ref =
|
|
1487
|
+
const ref = isReference(s) ? s.$ref : void 0;
|
|
1554
1488
|
const discriminatorValue = findDiscriminator(discriminator?.mapping, ref) ?? implicitDiscriminantValue(s);
|
|
1555
1489
|
const memberNode = parseSchema({
|
|
1556
1490
|
schema: s,
|
|
@@ -1640,39 +1574,15 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1640
1574
|
const specialType = getSchemaType(schema.format);
|
|
1641
1575
|
if (!specialType) return null;
|
|
1642
1576
|
const specialPrimitive = specialType === "number" || specialType === "integer" || specialType === "bigint" ? specialType : "string";
|
|
1643
|
-
|
|
1644
|
-
...base,
|
|
1645
|
-
primitive: specialPrimitive,
|
|
1646
|
-
type: specialType
|
|
1647
|
-
});
|
|
1648
|
-
if (specialType === "url") return _kubb_ast.ast.factory.createSchema({
|
|
1649
|
-
...base,
|
|
1650
|
-
primitive: "string",
|
|
1651
|
-
type: "url",
|
|
1652
|
-
min: schema.minLength,
|
|
1653
|
-
max: schema.maxLength
|
|
1654
|
-
});
|
|
1655
|
-
if (specialType === "ipv4") return _kubb_ast.ast.factory.createSchema({
|
|
1656
|
-
...base,
|
|
1657
|
-
primitive: "string",
|
|
1658
|
-
type: "ipv4"
|
|
1659
|
-
});
|
|
1660
|
-
if (specialType === "ipv6") return _kubb_ast.ast.factory.createSchema({
|
|
1661
|
-
...base,
|
|
1662
|
-
primitive: "string",
|
|
1663
|
-
type: "ipv6"
|
|
1664
|
-
});
|
|
1665
|
-
if (specialType === "uuid" || specialType === "email") return _kubb_ast.ast.factory.createSchema({
|
|
1666
|
-
...base,
|
|
1667
|
-
primitive: "string",
|
|
1668
|
-
type: specialType,
|
|
1669
|
-
min: schema.minLength,
|
|
1670
|
-
max: schema.maxLength
|
|
1671
|
-
});
|
|
1577
|
+
const hasLength = specialType === "url" || specialType === "uuid" || specialType === "email";
|
|
1672
1578
|
return _kubb_ast.ast.factory.createSchema({
|
|
1673
1579
|
...base,
|
|
1674
1580
|
primitive: specialPrimitive,
|
|
1675
|
-
type: specialType
|
|
1581
|
+
type: specialType,
|
|
1582
|
+
...hasLength ? {
|
|
1583
|
+
min: schema.minLength,
|
|
1584
|
+
max: schema.maxLength
|
|
1585
|
+
} : {}
|
|
1676
1586
|
});
|
|
1677
1587
|
}
|
|
1678
1588
|
/**
|
|
@@ -1692,16 +1602,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1692
1602
|
const enumBase = {
|
|
1693
1603
|
type: "enum",
|
|
1694
1604
|
primitive: enumPrimitive,
|
|
1695
|
-
name,
|
|
1696
|
-
title: schema.title,
|
|
1697
|
-
description: schema.description,
|
|
1698
|
-
deprecated: schema.deprecated,
|
|
1699
|
-
nullable: enumNullable,
|
|
1700
|
-
readOnly: schema.readOnly,
|
|
1701
|
-
writeOnly: schema.writeOnly,
|
|
1702
|
-
default: enumDefault,
|
|
1703
|
-
examples: extractExamples(schema),
|
|
1704
|
-
format: schema.format
|
|
1605
|
+
...buildSchemaNode(schema, name, enumNullable, enumDefault)
|
|
1705
1606
|
};
|
|
1706
1607
|
const extensionKey = enumExtensionKeys.find((key) => key in schema);
|
|
1707
1608
|
const descriptionKey = enumDescriptionKeys.find((key) => key in schema);
|
|
@@ -1738,7 +1639,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1738
1639
|
const properties = schema.properties ? Object.entries(schema.properties).map(([propName, propSchema]) => {
|
|
1739
1640
|
const required = Array.isArray(schema.required) ? schema.required.includes(propName) : !!schema.required;
|
|
1740
1641
|
const resolvedPropSchema = propSchema;
|
|
1741
|
-
const propNullable =
|
|
1642
|
+
const propNullable = isNullable(resolvedPropSchema);
|
|
1742
1643
|
const schemaNode = nameEnums(parseSchema({
|
|
1743
1644
|
schema: resolvedPropSchema,
|
|
1744
1645
|
name: (0, _kubb_ast.childName)(name, propName)
|
|
@@ -1775,7 +1676,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1775
1676
|
maxProperties: schema.maxProperties,
|
|
1776
1677
|
...buildSchemaNode(schema, name, nullable, defaultValue)
|
|
1777
1678
|
});
|
|
1778
|
-
if (
|
|
1679
|
+
if (isDiscriminator(schema) && schema.discriminator.mapping) {
|
|
1779
1680
|
const discPropName = schema.discriminator.propertyName;
|
|
1780
1681
|
const values = Object.keys(schema.discriminator.mapping);
|
|
1781
1682
|
const enumName = name ? (0, _kubb_ast.enumPropName)(name, discPropName, options.enumSuffix) : void 0;
|
|
@@ -1903,7 +1804,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1903
1804
|
*/
|
|
1904
1805
|
const schemaRules = [
|
|
1905
1806
|
{
|
|
1906
|
-
match: ({ schema }) =>
|
|
1807
|
+
match: ({ schema }) => isReference(schema),
|
|
1907
1808
|
convert: convertRef
|
|
1908
1809
|
},
|
|
1909
1810
|
{
|
|
@@ -1923,7 +1824,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1923
1824
|
convert: convertFormat
|
|
1924
1825
|
},
|
|
1925
1826
|
{
|
|
1926
|
-
match: ({ schema }) =>
|
|
1827
|
+
match: ({ schema }) => isBinary(schema),
|
|
1927
1828
|
convert: convertBlob
|
|
1928
1829
|
},
|
|
1929
1830
|
{
|
|
@@ -1992,7 +1893,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
1992
1893
|
schema: flattenedSchema,
|
|
1993
1894
|
name
|
|
1994
1895
|
}, rawOptions);
|
|
1995
|
-
const nullable =
|
|
1896
|
+
const nullable = isNullable(schema) || void 0;
|
|
1996
1897
|
const schemaCtx = {
|
|
1997
1898
|
schema,
|
|
1998
1899
|
name,
|
|
@@ -2062,7 +1963,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
2062
1963
|
const keys = [];
|
|
2063
1964
|
for (const key in schema.properties) {
|
|
2064
1965
|
const prop = schema.properties[key];
|
|
2065
|
-
if (prop && !
|
|
1966
|
+
if (prop && !isReference(prop) && prop[flag]) keys.push(key);
|
|
2066
1967
|
}
|
|
2067
1968
|
return keys.length ? keys : null;
|
|
2068
1969
|
}
|
|
@@ -2129,7 +2030,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
|
|
|
2129
2030
|
});
|
|
2130
2031
|
});
|
|
2131
2032
|
const pathItem = document.paths?.[operation.path];
|
|
2132
|
-
const pathItemDoc = pathItem && !
|
|
2033
|
+
const pathItemDoc = pathItem && !isReference(pathItem) ? pathItem : void 0;
|
|
2133
2034
|
const pickDoc = (key) => {
|
|
2134
2035
|
const own = operation.schema[key];
|
|
2135
2036
|
if (typeof own === "string") return own;
|
|
@@ -2321,13 +2222,10 @@ const adapterOas = (0, _kubb_core.createAdapter)((options) => {
|
|
|
2321
2222
|
function ensureSchemas(document) {
|
|
2322
2223
|
const cached = schemasCache.get(document);
|
|
2323
2224
|
if (cached) return cached;
|
|
2324
|
-
const
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
});
|
|
2329
|
-
schemasCache.set(document, promise);
|
|
2330
|
-
return promise;
|
|
2225
|
+
const result = getSchemas(document, { contentType });
|
|
2226
|
+
nameMapping = result.nameMapping;
|
|
2227
|
+
schemasCache.set(document, result.schemas);
|
|
2228
|
+
return result.schemas;
|
|
2331
2229
|
}
|
|
2332
2230
|
function ensureSchemaParser(document) {
|
|
2333
2231
|
const cached = schemaParserCache.get(document);
|
|
@@ -2443,7 +2341,7 @@ const adapterOas = (0, _kubb_core.createAdapter)((options) => {
|
|
|
2443
2341
|
const document = await ensureDocument(source);
|
|
2444
2342
|
return parseInput({
|
|
2445
2343
|
document,
|
|
2446
|
-
schemas:
|
|
2344
|
+
schemas: ensureSchemas(document),
|
|
2447
2345
|
parser: ensureSchemaParser(document)
|
|
2448
2346
|
});
|
|
2449
2347
|
}
|