@kubb/adapter-oas 5.8.4 → 5.9.1
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 +33 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +33 -71
- package/dist/index.js.map +1 -1
- package/docs/options.md +2 -2
- package/docs/overview.md +17 -7
- package/kubb-extension.json +2 -2
- package/package.json +2 -2
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.
|
|
15
|
+
var version = "5.9.1";
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/constants.ts
|
|
18
18
|
/**
|
|
@@ -39,6 +39,7 @@ const SCHEMA_REF_PREFIX = "#/components/schemas/";
|
|
|
39
39
|
/**
|
|
40
40
|
* HTTP methods that count as operations on an OpenAPI path item. Other keys
|
|
41
41
|
* (`parameters`, `summary`, `$ref`, vendor extensions) are skipped when iterating operations.
|
|
42
|
+
* `query` is the OpenAPI 3.2 field for the HTTP QUERY method (RFC 10008).
|
|
42
43
|
*/
|
|
43
44
|
const SUPPORTED_METHODS = /* @__PURE__ */ new Set([
|
|
44
45
|
"get",
|
|
@@ -48,7 +49,8 @@ const SUPPORTED_METHODS = /* @__PURE__ */ new Set([
|
|
|
48
49
|
"options",
|
|
49
50
|
"head",
|
|
50
51
|
"patch",
|
|
51
|
-
"trace"
|
|
52
|
+
"trace",
|
|
53
|
+
"query"
|
|
52
54
|
]);
|
|
53
55
|
/**
|
|
54
56
|
* Set of JSON Schema keywords that prevent a schema fragment from being inlined during `allOf` flattening.
|
|
@@ -262,74 +264,34 @@ function getErrorMessage(value) {
|
|
|
262
264
|
}
|
|
263
265
|
//#endregion
|
|
264
266
|
//#region ../../internals/utils/src/runtime.ts
|
|
267
|
+
const isBun = typeof Bun !== "undefined";
|
|
268
|
+
const isDeno = "Deno" in globalThis;
|
|
265
269
|
/**
|
|
266
|
-
*
|
|
270
|
+
* The JavaScript runtime executing the current process: its name, version and whether it is Bun.
|
|
267
271
|
*
|
|
268
|
-
*
|
|
272
|
+
* @example
|
|
273
|
+
* ```ts
|
|
274
|
+
* runtime.name // 'bun' when run with `bun kubb`, 'node' otherwise
|
|
275
|
+
* ```
|
|
269
276
|
*/
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
*
|
|
274
|
-
* Detection keys off the global `Bun` object rather than `process.versions`,
|
|
275
|
-
* because Bun polyfills `process.versions.node` for Node compatibility and would
|
|
276
|
-
* otherwise look like Node.
|
|
277
|
-
*
|
|
278
|
-
* @example
|
|
279
|
-
* ```ts
|
|
280
|
-
* if (runtime.isBun) {
|
|
281
|
-
* await Bun.write(path, data)
|
|
282
|
-
* }
|
|
283
|
-
* ```
|
|
284
|
-
*/
|
|
285
|
-
get isBun() {
|
|
286
|
-
return typeof Bun !== "undefined";
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* `true` when the current process is running under Deno.
|
|
290
|
-
*/
|
|
291
|
-
get isDeno() {
|
|
292
|
-
return typeof globalThis.Deno !== "undefined";
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* `true` when the current process is running under Node.
|
|
296
|
-
*
|
|
297
|
-
* Bun and Deno are excluded first so a polyfilled `process` does not register as Node.
|
|
298
|
-
*/
|
|
299
|
-
get isNode() {
|
|
300
|
-
return !this.isBun && !this.isDeno && typeof process !== "undefined" && process.versions?.node != null;
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Name of the runtime executing the current process.
|
|
304
|
-
*
|
|
305
|
-
* @example
|
|
306
|
-
* ```ts
|
|
307
|
-
* runtime.name // 'bun' when run with `bun kubb`, 'node' otherwise
|
|
308
|
-
* ```
|
|
309
|
-
*/
|
|
310
|
-
get name() {
|
|
311
|
-
if (this.isBun) return "bun";
|
|
312
|
-
if (this.isDeno) return "deno";
|
|
313
|
-
return "node";
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Version of the active runtime, or an empty string when it cannot be read.
|
|
317
|
-
*
|
|
318
|
-
* @example
|
|
319
|
-
* ```ts
|
|
320
|
-
* runtime.version // '1.3.11' under Bun, '22.22.2' under Node
|
|
321
|
-
* ```
|
|
322
|
-
*/
|
|
323
|
-
get version() {
|
|
324
|
-
if (this.isBun) return process.versions.bun ?? "";
|
|
325
|
-
if (this.isDeno) return globalThis.Deno?.version?.deno ?? "";
|
|
326
|
-
return process.versions?.node ?? "";
|
|
327
|
-
}
|
|
277
|
+
const runtime = {
|
|
278
|
+
isBun,
|
|
279
|
+
...detect()
|
|
328
280
|
};
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
281
|
+
function detect() {
|
|
282
|
+
if (isBun) return {
|
|
283
|
+
name: "bun",
|
|
284
|
+
version: process.versions.bun ?? ""
|
|
285
|
+
};
|
|
286
|
+
if (isDeno) return {
|
|
287
|
+
name: "deno",
|
|
288
|
+
version: globalThis.Deno?.version?.deno ?? ""
|
|
289
|
+
};
|
|
290
|
+
return {
|
|
291
|
+
name: "node",
|
|
292
|
+
version: process.versions?.node ?? ""
|
|
293
|
+
};
|
|
294
|
+
}
|
|
333
295
|
//#endregion
|
|
334
296
|
//#region ../../internals/utils/src/fs.ts
|
|
335
297
|
/**
|
|
@@ -2091,7 +2053,7 @@ function createSchemaParser(ctx) {
|
|
|
2091
2053
|
for (const rule of schemaRules) if (rule.match(context)) return rule.convert(context);
|
|
2092
2054
|
return createNode(context, { type: options.emptySchemaType });
|
|
2093
2055
|
}
|
|
2094
|
-
return
|
|
2056
|
+
return parseSchema;
|
|
2095
2057
|
}
|
|
2096
2058
|
//#endregion
|
|
2097
2059
|
//#region src/promoteEnums.ts
|
|
@@ -2360,7 +2322,8 @@ const adapterOas = (0, _kubb_kit.defineExtension)({
|
|
|
2360
2322
|
meta: {
|
|
2361
2323
|
name: "oas",
|
|
2362
2324
|
version,
|
|
2363
|
-
compatibility
|
|
2325
|
+
compatibility,
|
|
2326
|
+
issues: "https://github.com/kubb-labs/kubb/issues"
|
|
2364
2327
|
},
|
|
2365
2328
|
setup: ({ validate = true, contentType, server, discriminator = "preserve", enums = "inline", dateType = DEFAULT_PARSER_OPTIONS.dateType, integerType = DEFAULT_PARSER_OPTIONS.integerType, unknownType = DEFAULT_PARSER_OPTIONS.unknownType, enumSuffix = DEFAULT_PARSER_OPTIONS.enumSuffix, emptySchemaType = unknownType || DEFAULT_PARSER_OPTIONS.emptySchemaType }) => ({
|
|
2366
2329
|
validate,
|
|
@@ -2377,8 +2340,7 @@ const adapterOas = (0, _kubb_kit.defineExtension)({
|
|
|
2377
2340
|
build({ validate, contentType, server, discriminator, enums, ...parserOptions }) {
|
|
2378
2341
|
let parsedDocument = null;
|
|
2379
2342
|
const inputCache = /* @__PURE__ */ new WeakMap();
|
|
2380
|
-
function parseInput({ document, refs, schemas,
|
|
2381
|
-
const { parseSchema } = parser;
|
|
2343
|
+
function parseInput({ document, refs, schemas, parseSchema }) {
|
|
2382
2344
|
const parsedByName = /* @__PURE__ */ new Map();
|
|
2383
2345
|
const refAliasMap = /* @__PURE__ */ new Map();
|
|
2384
2346
|
const enumNames = [];
|
|
@@ -2466,7 +2428,7 @@ const adapterOas = (0, _kubb_kit.defineExtension)({
|
|
|
2466
2428
|
document,
|
|
2467
2429
|
refs,
|
|
2468
2430
|
schemas,
|
|
2469
|
-
|
|
2431
|
+
parseSchema: createSchemaParser({
|
|
2470
2432
|
document,
|
|
2471
2433
|
refs,
|
|
2472
2434
|
renames,
|