@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.cjs
CHANGED
|
@@ -366,12 +366,13 @@ var URLPath = class {
|
|
|
366
366
|
* @example
|
|
367
367
|
* new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
|
|
368
368
|
*/
|
|
369
|
-
toTemplateString({ prefix
|
|
370
|
-
|
|
369
|
+
toTemplateString({ prefix, replacer } = {}) {
|
|
370
|
+
const result = this.path.split(/\{([^}]+)\}/).map((part, i) => {
|
|
371
371
|
if (i % 2 === 0) return part;
|
|
372
372
|
const param = this.#transformParam(part);
|
|
373
373
|
return `\${${replacer ? replacer(param) : param}}`;
|
|
374
|
-
}).join("")
|
|
374
|
+
}).join("");
|
|
375
|
+
return `\`${prefix ?? ""}${result}\``;
|
|
375
376
|
}
|
|
376
377
|
/**
|
|
377
378
|
* Extracts all `{param}` segments from the path and returns them as a key-value map.
|