@kubb/adapter-oas 5.0.0-beta.21 → 5.0.0-beta.23

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
@@ -366,12 +366,13 @@ var URLPath = class {
366
366
  * @example
367
367
  * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
368
368
  */
369
- toTemplateString({ prefix = "", replacer } = {}) {
370
- return `\`${prefix}${this.path.split(/\{([^}]+)\}/).map((part, i) => {
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.
@@ -2030,14 +2031,17 @@ function createInputStream({ schemas, parseSchema, parseOperation, baseOas, pars
2030
2031
  //#endregion
2031
2032
  //#region src/adapter.ts
2032
2033
  /**
2033
- * Stable string identifier for the OAS adapter used in Kubb's adapter registry.
2034
+ * Canonical adapter name for `@kubb/adapter-oas`. Used for driver lookups.
2034
2035
  */
2035
2036
  const adapterOasName = "oas";
2036
2037
  /**
2037
- * Creates the default OpenAPI / Swagger adapter for Kubb.
2038
+ * Default Kubb adapter for OpenAPI 2.0, 3.0, and 3.1 specifications. Reads the
2039
+ * file at `input.path`, validates it, resolves the base URL, and converts every
2040
+ * schema and operation into the universal AST that every downstream plugin
2041
+ * consumes.
2038
2042
  *
2039
- * Parses the spec, optionally validates it, resolves the base URL, and converts
2040
- * everything into an `InputNode` that downstream plugins consume.
2043
+ * Configure once on `defineConfig`. The adapter's choices (date representation,
2044
+ * integer width, server URL) apply to every plugin in the build.
2041
2045
  *
2042
2046
  * @example
2043
2047
  * ```ts
@@ -2046,8 +2050,13 @@ const adapterOasName = "oas";
2046
2050
  * import { pluginTs } from '@kubb/plugin-ts'
2047
2051
  *
2048
2052
  * export default defineConfig({
2049
- * adapter: adapterOas({ dateType: 'date', serverIndex: 0 }),
2050
- * input: { path: './openapi.yaml' },
2053
+ * input: { path: './petStore.yaml' },
2054
+ * output: { path: './src/gen' },
2055
+ * adapter: adapterOas({
2056
+ * serverIndex: 0,
2057
+ * discriminator: 'inherit',
2058
+ * dateType: 'date',
2059
+ * }),
2051
2060
  * plugins: [pluginTs()],
2052
2061
  * })
2053
2062
  * ```