@kubb/adapter-oas 5.0.0-beta.21 → 5.0.0-beta.22
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 +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -340,12 +340,13 @@ var URLPath = class {
|
|
|
340
340
|
* @example
|
|
341
341
|
* new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
|
|
342
342
|
*/
|
|
343
|
-
toTemplateString({ prefix
|
|
344
|
-
|
|
343
|
+
toTemplateString({ prefix, replacer } = {}) {
|
|
344
|
+
const result = this.path.split(/\{([^}]+)\}/).map((part, i) => {
|
|
345
345
|
if (i % 2 === 0) return part;
|
|
346
346
|
const param = this.#transformParam(part);
|
|
347
347
|
return `\${${replacer ? replacer(param) : param}}`;
|
|
348
|
-
}).join("")
|
|
348
|
+
}).join("");
|
|
349
|
+
return `\`${prefix ?? ""}${result}\``;
|
|
349
350
|
}
|
|
350
351
|
/**
|
|
351
352
|
* Extracts all `{param}` segments from the path and returns them as a key-value map.
|