@kubb/adapter-oas 5.14.1 → 5.14.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 +18 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ var compatibility = {
|
|
|
20
20
|
};
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region package.json
|
|
23
|
-
var version = "5.14.
|
|
23
|
+
var version = "5.14.2";
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region src/constants.ts
|
|
26
26
|
/**
|
|
@@ -1291,12 +1291,21 @@ function getParameters({ operation, refs }) {
|
|
|
1291
1291
|
for (const entry of [...pathLevelParams, ...operationParams]) if (entry.param.name && entry.param.in) paramMap.set(`${entry.param.in}:${entry.param.name}`, entry);
|
|
1292
1292
|
return Array.from(paramMap.values());
|
|
1293
1293
|
}
|
|
1294
|
-
|
|
1294
|
+
const PARAMETER_STYLES = /* @__PURE__ */ new Set([
|
|
1295
|
+
"matrix",
|
|
1296
|
+
"label",
|
|
1297
|
+
"form",
|
|
1298
|
+
"simple",
|
|
1299
|
+
"spaceDelimited",
|
|
1300
|
+
"pipeDelimited",
|
|
1301
|
+
"deepObject"
|
|
1302
|
+
]);
|
|
1303
|
+
/** The `encoding` of a media type, reduced to the entries that set a field Kubb carries. A `style` outside the OpenAPI set is dropped. */
|
|
1295
1304
|
function getEncoding(encoding) {
|
|
1296
1305
|
const entries = Object.entries(encoding ?? {}).flatMap(([property, { contentType, style, explode, allowReserved }]) => {
|
|
1297
1306
|
const node = {
|
|
1298
1307
|
...contentType !== void 0 ? { contentType } : {},
|
|
1299
|
-
...style !== void 0 ? { style } : {},
|
|
1308
|
+
...style !== void 0 && PARAMETER_STYLES.has(style) ? { style } : {},
|
|
1300
1309
|
...explode !== void 0 ? { explode } : {},
|
|
1301
1310
|
...allowReserved !== void 0 ? { allowReserved } : {}
|
|
1302
1311
|
};
|
|
@@ -1358,7 +1367,7 @@ function parseParameter({ param, pointer, parentName, options, parseSchema }) {
|
|
|
1358
1367
|
name: schemaName
|
|
1359
1368
|
}) : ast.factory.createSchema({ type: options.unknownType });
|
|
1360
1369
|
if (rawSchema) scanSchema(schema, contentType ? `${pointer}/content/${escapePointerToken(contentType)}/schema` : `${pointer}/schema`);
|
|
1361
|
-
const style = param.style;
|
|
1370
|
+
const style = param.style !== void 0 && PARAMETER_STYLES.has(param.style) ? param.style : void 0;
|
|
1362
1371
|
const explode = param.explode;
|
|
1363
1372
|
const allowReserved = param.allowReserved;
|
|
1364
1373
|
return ast.factory.createParameter({
|
|
@@ -2905,9 +2914,13 @@ const adapterOas = defineExtension({
|
|
|
2905
2914
|
}));
|
|
2906
2915
|
const promotedEnums = enums === "root" ? collectInlineEnums([...parsedByName.values(), ...operationNodes], new Set(Object.keys(schemas))) : null;
|
|
2907
2916
|
if (promotedEnums) for (const name of promotedEnums.keys()) enumNames.push(name);
|
|
2917
|
+
const aliasTargetOf = (name) => {
|
|
2918
|
+
const node = refAliasMap.get(name);
|
|
2919
|
+
return node?.ref ? ast.refName(node.ref) : node?.name;
|
|
2920
|
+
};
|
|
2908
2921
|
function isAliasCycle(name) {
|
|
2909
2922
|
const seen = /* @__PURE__ */ new Set([name]);
|
|
2910
|
-
for (let next =
|
|
2923
|
+
for (let next = aliasTargetOf(name); next; next = aliasTargetOf(next)) {
|
|
2911
2924
|
if (next === name) return true;
|
|
2912
2925
|
if (seen.has(next)) return false;
|
|
2913
2926
|
seen.add(next);
|