@kubb/adapter-oas 5.9.6 → 5.10.0

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
@@ -12,7 +12,7 @@ var compatibility = {
12
12
  };
13
13
  //#endregion
14
14
  //#region package.json
15
- var version = "5.9.6";
15
+ var version = "5.10.0";
16
16
  //#endregion
17
17
  //#region src/constants.ts
18
18
  /**
@@ -535,6 +535,13 @@ function isNullable(schema) {
535
535
  return false;
536
536
  }
537
537
  /**
538
+ * Returns the `x-*` keys of `source` as-is, or `undefined` when there are none.
539
+ */
540
+ function pickExtensions(source) {
541
+ const entries = Object.entries(source).filter(([key]) => key.startsWith("x-"));
542
+ return entries.length > 0 ? Object.fromEntries(entries) : void 0;
543
+ }
544
+ /**
538
545
  * Returns `true` when `obj` is an OpenAPI `$ref` pointer object.
539
546
  */
540
547
  function isReference(obj) {
@@ -1005,7 +1012,8 @@ function parseOperation({ operation, ...ctx }) {
1005
1012
  deprecated: operation.schema.deprecated || void 0,
1006
1013
  parameters,
1007
1014
  requestBody,
1008
- responses
1015
+ responses,
1016
+ extensions: pickExtensions(operation.schema)
1009
1017
  });
1010
1018
  }
1011
1019
  //#endregion
@@ -2338,18 +2346,21 @@ const adapterOas = (0, _kubb_kit.defineExtension)({
2338
2346
  server
2339
2347
  }),
2340
2348
  servers: (document.servers ?? []).filter((entry) => entry.url).map(({ url, description, variables }) => {
2349
+ const declared = variables && Object.keys(variables).length > 0 ? { variables } : {};
2341
2350
  try {
2342
2351
  return {
2343
2352
  url: resolveServerUrl({
2344
2353
  url,
2345
2354
  variables
2346
2355
  }),
2347
- description
2356
+ description,
2357
+ ...declared
2348
2358
  };
2349
2359
  } catch {
2350
2360
  return {
2351
2361
  url,
2352
- description
2362
+ description,
2363
+ ...declared
2353
2364
  };
2354
2365
  }
2355
2366
  }),
@@ -2366,7 +2377,8 @@ const adapterOas = (0, _kubb_kit.defineExtension)({
2366
2377
  }] : [];
2367
2378
  }),
2368
2379
  circularNames,
2369
- enumNames
2380
+ enumNames,
2381
+ extensions: pickExtensions(document)
2370
2382
  }
2371
2383
  });
2372
2384
  }