@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 CHANGED
@@ -36,7 +36,7 @@ var compatibility = {
36
36
  };
37
37
  //#endregion
38
38
  //#region package.json
39
- var version = "5.14.1";
39
+ var version = "5.14.2";
40
40
  //#endregion
41
41
  //#region src/constants.ts
42
42
  /**
@@ -1307,12 +1307,21 @@ function getParameters({ operation, refs }) {
1307
1307
  for (const entry of [...pathLevelParams, ...operationParams]) if (entry.param.name && entry.param.in) paramMap.set(`${entry.param.in}:${entry.param.name}`, entry);
1308
1308
  return Array.from(paramMap.values());
1309
1309
  }
1310
- /** The `encoding` of a media type, reduced to the entries that set a field Kubb carries. */
1310
+ const PARAMETER_STYLES = /* @__PURE__ */ new Set([
1311
+ "matrix",
1312
+ "label",
1313
+ "form",
1314
+ "simple",
1315
+ "spaceDelimited",
1316
+ "pipeDelimited",
1317
+ "deepObject"
1318
+ ]);
1319
+ /** The `encoding` of a media type, reduced to the entries that set a field Kubb carries. A `style` outside the OpenAPI set is dropped. */
1311
1320
  function getEncoding(encoding) {
1312
1321
  const entries = Object.entries(encoding ?? {}).flatMap(([property, { contentType, style, explode, allowReserved }]) => {
1313
1322
  const node = {
1314
1323
  ...contentType !== void 0 ? { contentType } : {},
1315
- ...style !== void 0 ? { style } : {},
1324
+ ...style !== void 0 && PARAMETER_STYLES.has(style) ? { style } : {},
1316
1325
  ...explode !== void 0 ? { explode } : {},
1317
1326
  ...allowReserved !== void 0 ? { allowReserved } : {}
1318
1327
  };
@@ -1374,7 +1383,7 @@ function parseParameter({ param, pointer, parentName, options, parseSchema }) {
1374
1383
  name: schemaName
1375
1384
  }) : _kubb_kit.ast.factory.createSchema({ type: options.unknownType });
1376
1385
  if (rawSchema) scanSchema(schema, contentType ? `${pointer}/content/${escapePointerToken(contentType)}/schema` : `${pointer}/schema`);
1377
- const style = param.style;
1386
+ const style = param.style !== void 0 && PARAMETER_STYLES.has(param.style) ? param.style : void 0;
1378
1387
  const explode = param.explode;
1379
1388
  const allowReserved = param.allowReserved;
1380
1389
  return _kubb_kit.ast.factory.createParameter({
@@ -2920,9 +2929,13 @@ const adapterOas = (0, _kubb_core.defineExtension)({
2920
2929
  }));
2921
2930
  const promotedEnums = enums === "root" ? collectInlineEnums([...parsedByName.values(), ...operationNodes], new Set(Object.keys(schemas))) : null;
2922
2931
  if (promotedEnums) for (const name of promotedEnums.keys()) enumNames.push(name);
2932
+ const aliasTargetOf = (name) => {
2933
+ const node = refAliasMap.get(name);
2934
+ return node?.ref ? _kubb_kit.ast.refName(node.ref) : node?.name;
2935
+ };
2923
2936
  function isAliasCycle(name) {
2924
2937
  const seen = /* @__PURE__ */ new Set([name]);
2925
- for (let next = refAliasMap.get(name)?.name; next; next = refAliasMap.get(next)?.name) {
2938
+ for (let next = aliasTargetOf(name); next; next = aliasTargetOf(next)) {
2926
2939
  if (next === name) return true;
2927
2940
  if (seen.has(next)) return false;
2928
2941
  seen.add(next);