@kubb/plugin-fetch 5.7.1 → 5.7.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
@@ -725,25 +725,27 @@ function toKey(name, location) {
725
725
  return isValidVarName(key) ? key : JSON.stringify(key);
726
726
  }
727
727
  /**
728
- * Serializes one parameter's metadata into a `{ style, explode, allowReserved }` literal, or `null`
729
- * when the parameter carries none. Path and query carry the serialization `style`; header and cookie
730
- * use a fixed style (`simple` and `form`), so only `explode` is emitted for them. `allowReserved`
731
- * only applies to query parameters.
728
+ * Serializes one parameter's metadata into a `{ style, explode, allowReserved, contentType }`
729
+ * literal, or `null` when the parameter carries none. Path and query carry the serialization
730
+ * `style`; header and cookie use a fixed style (`simple` and `form`), so only `explode` is emitted
731
+ * for them. `allowReserved` only applies to query parameters, and `contentType` to every location
732
+ * except path.
732
733
  */
733
734
  function serializeParameter(parameter) {
734
735
  const parts = [];
735
736
  if ((parameter.in === "path" || parameter.in === "query") && parameter.style) parts.push(`style: '${parameter.style}'`);
736
737
  if (parameter.explode !== void 0) parts.push(`explode: ${parameter.explode}`);
737
738
  if (parameter.in === "query" && parameter.allowReserved !== void 0) parts.push(`allowReserved: ${parameter.allowReserved}`);
739
+ if (parameter.in !== "path" && parameter.contentType) parts.push(`contentType: '${parameter.contentType}'`);
738
740
  return parts.length > 0 ? `{ ${parts.join(", ")} }` : null;
739
741
  }
740
742
  /**
741
743
  * Builds the per-operation `styles` literal from the operation's parameters, grouped by location.
742
744
  * Path entries are keyed by the camelCased name to match the URL template placeholders; query,
743
745
  * header, and cookie entries keep the spec name to match the keys the runtime serializes.
744
- * Only parameters whose source defines `style`, `explode`, or `allowReserved` are emitted, so calls without
745
- * serialization metadata keep the runtime defaults and existing output is unchanged. Returns `null`
746
- * when no parameter carries metadata.
746
+ * Only parameters whose source defines `style`, `explode`, `allowReserved`, or `contentType` are
747
+ * emitted, so calls without serialization metadata keep the runtime defaults and existing output
748
+ * is unchanged. Returns `null` when no parameter carries metadata.
747
749
  *
748
750
  * @example
749
751
  * ```ts
@@ -1441,7 +1443,7 @@ var compatibility = {
1441
1443
  };
1442
1444
  //#endregion
1443
1445
  //#region package.json
1444
- var version = "5.7.1";
1446
+ var version = "5.7.2";
1445
1447
  //#endregion
1446
1448
  //#region src/templates.ts
1447
1449
  /** Absolute path to the fetch client template, copied into `.kubb/client.ts`. */
@@ -1515,32 +1517,6 @@ const pluginFetch = (0, kubb_kit.defineExtension)({
1515
1517
  } : void 0,
1516
1518
  resolver: userResolver ? kubb_kit.Resolver.merge(resolverClient, userResolver) : resolverClient
1517
1519
  };
1518
- const allowedReturnTypes = [
1519
- "full",
1520
- "data",
1521
- "plain"
1522
- ];
1523
- (0, kubb_kit.assertPluginOption)({
1524
- plugin: pluginFetchName,
1525
- option: "returnType",
1526
- value: returnType,
1527
- allowed: allowedReturnTypes
1528
- });
1529
- for (const [index, entry] of override.entries()) {
1530
- if (entry.options.returnType === void 0) continue;
1531
- (0, kubb_kit.assertPluginOption)({
1532
- plugin: pluginFetchName,
1533
- option: `override[${index}].options.returnType`,
1534
- value: entry.options.returnType,
1535
- allowed: allowedReturnTypes
1536
- });
1537
- }
1538
- if (resolved.sdk) (0, kubb_kit.assertPluginOption)({
1539
- plugin: pluginFetchName,
1540
- option: "sdk.mode",
1541
- value: resolved.sdk.mode,
1542
- allowed: ["tag", "flat"]
1543
- });
1544
1520
  (0, kubb_kit.setResolver)(resolved.resolver);
1545
1521
  (0, kubb_kit.setMacros)([...defaultMacros, ...options.macros ?? []]);
1546
1522
  (0, kubb_kit.addGenerator)(resolved.sdk ? createSdkGenerator() : clientGenerator);