@kubb/plugin-oas 2.25.1 → 3.0.0-alpha.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/{OperationGenerator-BV6QRtkW.d.cts → OperationGenerator-CeM_9pxW.d.cts} +1 -1
- package/dist/{OperationGenerator-DO5tNGuT.d.ts → OperationGenerator-DhUhvRJE.d.ts} +1 -1
- package/dist/{chunk-M62LERKB.cjs → chunk-CJXRFYEF.cjs} +24 -21
- package/dist/chunk-CJXRFYEF.cjs.map +1 -0
- package/dist/{chunk-NLQIW5KR.cjs → chunk-DRLYORTT.cjs} +23 -23
- package/dist/{chunk-NLQIW5KR.cjs.map → chunk-DRLYORTT.cjs.map} +1 -1
- package/dist/{chunk-KGR7UP2W.js → chunk-K6KUETAI.js} +5 -2
- package/dist/chunk-K6KUETAI.js.map +1 -0
- package/dist/{chunk-6QFVU3BI.js → chunk-LEACSHKT.js} +3 -3
- package/dist/{chunk-PHNRHM3I.cjs → chunk-P42X362U.cjs} +3 -3
- package/dist/chunk-P42X362U.cjs.map +1 -0
- package/dist/{chunk-DHPXS6V7.cjs → chunk-QLJIL3U5.cjs} +3 -3
- package/dist/{chunk-DHPXS6V7.cjs.map → chunk-QLJIL3U5.cjs.map} +1 -1
- package/dist/{chunk-E4NYDEAU.js → chunk-UB552H4J.js} +3 -3
- package/dist/chunk-UB552H4J.js.map +1 -0
- package/dist/{chunk-7BYOJGO3.js → chunk-Y4V7HHX7.js} +2 -2
- package/dist/components.cjs +5 -5
- package/dist/components.d.cts +2 -2
- package/dist/components.d.ts +2 -2
- package/dist/components.js +3 -3
- package/dist/hooks.cjs +13 -13
- package/dist/hooks.d.cts +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +3 -3
- package/dist/index.cjs +20 -20
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{types-Db0qp8u-.d.ts → types-Dte3MA6H.d.cts} +1 -6
- package/dist/{types-Db0qp8u-.d.cts → types-Dte3MA6H.d.ts} +1 -6
- package/dist/utils.cjs +8 -8
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +2 -2
- package/package.json +12 -12
- package/src/SchemaGenerator.ts +5 -1
- package/src/types.ts +1 -7
- package/dist/chunk-E4NYDEAU.js.map +0 -1
- package/dist/chunk-KGR7UP2W.js.map +0 -1
- package/dist/chunk-M62LERKB.cjs.map +0 -1
- package/dist/chunk-PHNRHM3I.cjs.map +0 -1
- /package/dist/{chunk-6QFVU3BI.js.map → chunk-LEACSHKT.js.map} +0 -0
- /package/dist/{chunk-7BYOJGO3.js.map → chunk-Y4V7HHX7.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _kubb_core from '@kubb/core';
|
|
2
2
|
import { FileMetaBase, ResolveNameParams, PluginFactoryOptions, Generator, PluginManager, Plugin } from '@kubb/core';
|
|
3
|
-
import { O as Options, P as PluginOas, a as OperationSchema, R as Refs, b as Override } from './types-
|
|
4
|
-
export { A as API, E as Exclude, I as Include, f as OperationSchemas, g as OperationsByMethod, d as Ref, c as ResolvePathOptions, e as Resolver } from './types-
|
|
5
|
-
export { G as GetOperationGeneratorOptions, a as OperationGenerator, O as OperationMethodResult } from './OperationGenerator-
|
|
3
|
+
import { O as Options, P as PluginOas, a as OperationSchema, R as Refs, b as Override } from './types-Dte3MA6H.js';
|
|
4
|
+
export { A as API, E as Exclude, I as Include, f as OperationSchemas, g as OperationsByMethod, d as Ref, c as ResolvePathOptions, e as Resolver } from './types-Dte3MA6H.js';
|
|
5
|
+
export { G as GetOperationGeneratorOptions, a as OperationGenerator, O as OperationMethodResult } from './OperationGenerator-DhUhvRJE.js';
|
|
6
6
|
import * as KubbFile from '@kubb/fs/types';
|
|
7
7
|
import { SchemaObject, Oas, contentType } from '@kubb/oas';
|
|
8
8
|
import { S as Schema, a as SchemaKeywordMapper } from './SchemaMapper-CsBQ6eEx.js';
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseFromConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Y4V7HHX7.js";
|
|
4
4
|
import {
|
|
5
5
|
SchemaGenerator,
|
|
6
6
|
isKeyword,
|
|
7
7
|
schemaKeywords
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-K6KUETAI.js";
|
|
9
9
|
import {
|
|
10
10
|
__privateAdd,
|
|
11
11
|
__privateGet,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
__privateSet,
|
|
14
14
|
getSchemas,
|
|
15
15
|
init_esm_shims
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UB552H4J.js";
|
|
17
17
|
|
|
18
18
|
// src/index.ts
|
|
19
19
|
init_esm_shims();
|
|
@@ -60,7 +60,7 @@ type Options = {
|
|
|
60
60
|
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
61
61
|
*
|
|
62
62
|
* `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
63
|
-
* @example import a type(
|
|
63
|
+
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
64
64
|
*/
|
|
65
65
|
type Ref = {
|
|
66
66
|
propertyName: string;
|
|
@@ -139,10 +139,5 @@ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaN
|
|
|
139
139
|
options: Partial<TOptions>;
|
|
140
140
|
};
|
|
141
141
|
type PluginOas = PluginFactoryOptions<'plugin-oas', Options, Options, API, never>;
|
|
142
|
-
declare module '@kubb/core' {
|
|
143
|
-
interface _Register {
|
|
144
|
-
['@kubb/plugin-oas']: PluginOas;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
142
|
|
|
148
143
|
export { type API as A, type Exclude as E, type GetSchemasProps as G, type Include as I, type Options as O, type PluginOas as P, type Refs as R, type OperationSchema as a, type Override as b, type ResolvePathOptions as c, type Ref as d, type Resolver as e, type OperationSchemas as f, type OperationsByMethod as g, getSchemas as h };
|
|
@@ -60,7 +60,7 @@ type Options = {
|
|
|
60
60
|
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
61
61
|
*
|
|
62
62
|
* `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
63
|
-
* @example import a type(
|
|
63
|
+
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
64
64
|
*/
|
|
65
65
|
type Ref = {
|
|
66
66
|
propertyName: string;
|
|
@@ -139,10 +139,5 @@ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaN
|
|
|
139
139
|
options: Partial<TOptions>;
|
|
140
140
|
};
|
|
141
141
|
type PluginOas = PluginFactoryOptions<'plugin-oas', Options, Options, API, never>;
|
|
142
|
-
declare module '@kubb/core' {
|
|
143
|
-
interface _Register {
|
|
144
|
-
['@kubb/plugin-oas']: PluginOas;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
142
|
|
|
148
143
|
export { type API as A, type Exclude as E, type GetSchemasProps as G, type Include as I, type Options as O, type PluginOas as P, type Refs as R, type OperationSchema as a, type Override as b, type ResolvePathOptions as c, type Ref as d, type Resolver as e, type OperationSchemas as f, type OperationsByMethod as g, getSchemas as h };
|
package/dist/utils.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkQLJIL3U5cjs = require('./chunk-QLJIL3U5.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkP42X362Ucjs = require('./chunk-P42X362U.cjs');
|
|
9
9
|
|
|
10
10
|
// src/utils/index.ts
|
|
11
|
-
|
|
11
|
+
_chunkP42X362Ucjs.init_cjs_shims.call(void 0, );
|
|
12
12
|
|
|
13
13
|
// src/utils/getComments.ts
|
|
14
|
-
|
|
14
|
+
_chunkP42X362Ucjs.init_cjs_shims.call(void 0, );
|
|
15
15
|
var _transformers = require('@kubb/core/transformers'); var _transformers2 = _interopRequireDefault(_transformers);
|
|
16
16
|
var _utils = require('@kubb/core/utils');
|
|
17
17
|
function getComments(operation) {
|
|
@@ -24,7 +24,7 @@ function getComments(operation) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// src/utils/getGroupedByTagFiles.ts
|
|
27
|
-
|
|
27
|
+
_chunkP42X362Ucjs.init_cjs_shims.call(void 0, );
|
|
28
28
|
var _path = require('path');
|
|
29
29
|
var _core = require('@kubb/core');
|
|
30
30
|
|
|
@@ -69,7 +69,7 @@ async function getGroupedByTagFiles({ logger, files, plugin, template, exportAs,
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
// src/utils/getParams.ts
|
|
72
|
-
|
|
72
|
+
_chunkP42X362Ucjs.init_cjs_shims.call(void 0, );
|
|
73
73
|
var _oas = require('@kubb/oas');
|
|
74
74
|
|
|
75
75
|
function getASTParams(operationSchema, {
|
|
@@ -104,7 +104,7 @@ function getPathParams(operationSchema, options = {}) {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
// src/utils/refSorter.ts
|
|
107
|
-
|
|
107
|
+
_chunkP42X362Ucjs.init_cjs_shims.call(void 0, );
|
|
108
108
|
function refsSorter(a, b) {
|
|
109
109
|
if (_optionalChain([Object, 'access', _10 => _10.keys, 'call', _11 => _11(a.import.refs), 'optionalAccess', _12 => _12.length]) < _optionalChain([Object, 'access', _13 => _13.keys, 'call', _14 => _14(b.import.refs), 'optionalAccess', _15 => _15.length])) {
|
|
110
110
|
return -1;
|
|
@@ -123,5 +123,5 @@ function refsSorter(a, b) {
|
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
|
|
126
|
-
exports.getASTParams = getASTParams; exports.getComments = getComments; exports.getGroupedByTagFiles = getGroupedByTagFiles; exports.getPathParams = getPathParams; exports.getSchemaFactory =
|
|
126
|
+
exports.getASTParams = getASTParams; exports.getComments = getComments; exports.getGroupedByTagFiles = getGroupedByTagFiles; exports.getPathParams = getPathParams; exports.getSchemaFactory = _chunkP42X362Ucjs.getSchemaFactory; exports.getSchemas = _chunkP42X362Ucjs.getSchemas; exports.parseFromConfig = _chunkQLJIL3U5cjs.parseFromConfig; exports.refsSorter = refsSorter;
|
|
127
127
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/utils.d.cts
CHANGED
|
@@ -4,8 +4,8 @@ import { Logger } from '@kubb/core/logger';
|
|
|
4
4
|
import * as KubbFile from '@kubb/fs/types';
|
|
5
5
|
import { FunctionParamsAST } from '@kubb/core/utils';
|
|
6
6
|
import { Params } from '@kubb/react';
|
|
7
|
-
import { a as OperationSchema, R as Refs } from './types-
|
|
8
|
-
export { G as GetSchemasProps, h as getSchemas } from './types-
|
|
7
|
+
import { a as OperationSchema, R as Refs } from './types-Dte3MA6H.cjs';
|
|
8
|
+
export { G as GetSchemasProps, h as getSchemas } from './types-Dte3MA6H.cjs';
|
|
9
9
|
import { FormatOptions } from '@kubb/oas/parser';
|
|
10
10
|
|
|
11
11
|
declare function getComments(operation: Operation): string[];
|
package/dist/utils.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { Logger } from '@kubb/core/logger';
|
|
|
4
4
|
import * as KubbFile from '@kubb/fs/types';
|
|
5
5
|
import { FunctionParamsAST } from '@kubb/core/utils';
|
|
6
6
|
import { Params } from '@kubb/react';
|
|
7
|
-
import { a as OperationSchema, R as Refs } from './types-
|
|
8
|
-
export { G as GetSchemasProps, h as getSchemas } from './types-
|
|
7
|
+
import { a as OperationSchema, R as Refs } from './types-Dte3MA6H.js';
|
|
8
|
+
export { G as GetSchemasProps, h as getSchemas } from './types-Dte3MA6H.js';
|
|
9
9
|
import { FormatOptions } from '@kubb/oas/parser';
|
|
10
10
|
|
|
11
11
|
declare function getComments(operation: Operation): string[];
|
package/dist/utils.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseFromConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Y4V7HHX7.js";
|
|
4
4
|
import {
|
|
5
5
|
getSchemaFactory,
|
|
6
6
|
getSchemas,
|
|
7
7
|
init_esm_shims
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-UB552H4J.js";
|
|
9
9
|
|
|
10
10
|
// src/utils/index.ts
|
|
11
11
|
init_esm_shims();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-oas",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.1",
|
|
4
4
|
"description": "Generator swagger",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -67,27 +67,27 @@
|
|
|
67
67
|
],
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@stoplight/yaml": "^4.3.0",
|
|
70
|
-
"remeda": "^2.
|
|
71
|
-
"@kubb/core": "
|
|
72
|
-
"@kubb/fs": "
|
|
73
|
-
"@kubb/oas": "
|
|
74
|
-
"@kubb/react": "
|
|
70
|
+
"remeda": "^2.11.0",
|
|
71
|
+
"@kubb/core": "3.0.0-alpha.1",
|
|
72
|
+
"@kubb/fs": "3.0.0-alpha.1",
|
|
73
|
+
"@kubb/oas": "3.0.0-alpha.1",
|
|
74
|
+
"@kubb/react": "3.0.0-alpha.1"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@types/react": "^18.3.
|
|
77
|
+
"@types/react": "^18.3.4",
|
|
78
78
|
"@types/react-dom": "^18.3.0",
|
|
79
79
|
"react": "^18.3.1",
|
|
80
80
|
"tsup": "^8.2.4",
|
|
81
81
|
"typescript": "^5.5.4",
|
|
82
|
-
"@kubb/config-biome": "
|
|
83
|
-
"@kubb/config-ts": "
|
|
84
|
-
"@kubb/config-tsup": "
|
|
82
|
+
"@kubb/config-biome": "3.0.0-alpha.1",
|
|
83
|
+
"@kubb/config-ts": "3.0.0-alpha.1",
|
|
84
|
+
"@kubb/config-tsup": "3.0.0-alpha.1"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
|
-
"@kubb/react": "
|
|
87
|
+
"@kubb/react": "3.0.0-alpha.1"
|
|
88
88
|
},
|
|
89
89
|
"engines": {
|
|
90
|
-
"node": ">=
|
|
90
|
+
"node": ">=20"
|
|
91
91
|
},
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public",
|
package/src/SchemaGenerator.ts
CHANGED
|
@@ -85,7 +85,7 @@ export abstract class SchemaGenerator<
|
|
|
85
85
|
const defaultSchemas = this.#parseSchemaObject(props)
|
|
86
86
|
const schemas = options.transformers?.schema?.(props, defaultSchemas) || defaultSchemas || []
|
|
87
87
|
|
|
88
|
-
return uniqueWith
|
|
88
|
+
return uniqueWith(schemas, isDeepEqual)
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][] {
|
|
@@ -809,6 +809,10 @@ export abstract class SchemaGenerator<
|
|
|
809
809
|
].filter(Boolean)
|
|
810
810
|
}
|
|
811
811
|
|
|
812
|
+
if (!['boolean', 'object', 'number', 'string', 'integer'].includes(schema.type)) {
|
|
813
|
+
this.context.pluginManager.logger.emit('warning', `Schema type '${schema.type}' is not valid for schema ${parentName}.${name}`)
|
|
814
|
+
}
|
|
815
|
+
|
|
812
816
|
// 'string' | 'number' | 'integer' | 'boolean'
|
|
813
817
|
return [{ keyword: schema.type }, ...baseItems]
|
|
814
818
|
}
|
package/src/types.ts
CHANGED
|
@@ -60,7 +60,7 @@ export type Options = {
|
|
|
60
60
|
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
61
61
|
*
|
|
62
62
|
* `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
63
|
-
* @example import a type(
|
|
63
|
+
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
64
64
|
*/
|
|
65
65
|
|
|
66
66
|
export type Ref = {
|
|
@@ -142,9 +142,3 @@ export type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | By
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
export type PluginOas = PluginFactoryOptions<'plugin-oas', Options, Options, API, never>
|
|
145
|
-
|
|
146
|
-
declare module '@kubb/core' {
|
|
147
|
-
export interface _Register {
|
|
148
|
-
['@kubb/plugin-oas']: PluginOas
|
|
149
|
-
}
|
|
150
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.47.5_@types+node@20.14.14__jiti@1.21.6_postcss@8.4.40_typescript@5.5.4_yaml@2.4.5/node_modules/tsup/assets/esm_shims.js","../src/utils/getSchemas.ts","../src/utils/getSchemaFactory.ts"],"sourcesContent":["// Shim globals in esm bundle\nimport { fileURLToPath } from 'url'\nimport path from 'path'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","import type { Oas, OasTypes, contentType } from '@kubb/oas'\n\ntype Mode = 'schemas' | 'responses' | 'requestBodies'\n\nexport type GetSchemasProps = {\n oas: Oas\n contentType?: contentType\n includes?: Mode[]\n}\n\nexport function getSchemas({ oas, contentType, includes = ['schemas', 'requestBodies', 'responses'] }: GetSchemasProps): Record<string, OasTypes.SchemaObject> {\n const components = oas.getDefinition().components\n\n let schemas: Record<string, OasTypes.SchemaObject> = {}\n\n if (includes.includes('schemas')) {\n schemas = {\n ...schemas,\n ...((components?.schemas as Record<string, OasTypes.SchemaObject>) || {}),\n }\n }\n\n const requestBodies = components?.requestBodies || {}\n if (includes.includes('responses')) {\n const responses = components?.responses || {}\n\n Object.entries(responses).forEach(([name, response]: [string, OasTypes.ResponseObject]) => {\n if (response.content && !schemas[name]) {\n const firstContentType = Object.keys(response.content)[0] || 'application/json'\n schemas[name] = response.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n if (includes.includes('requestBodies')) {\n Object.entries(requestBodies).forEach(([name, request]: [string, OasTypes.RequestBodyObject]) => {\n if (request.content && !schemas[name]) {\n const firstContentType = Object.keys(request.content)[0] || 'application/json'\n schemas[name] = request.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n return schemas\n}\n","import { isOpenApiV3_1Document } from '@kubb/oas'\n\nimport type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'\n\n/**\n * Make it possible to narrow down the schema based on a specific version(3 or 3.1)\n */\ntype SchemaResult<TWithRef extends boolean = false> =\n | {\n schema?: (TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.0'\n }\n | {\n schema?: (TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.1'\n }\n\nexport function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef> {\n return (schema?: SchemaObject) => {\n const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'\n\n return {\n schema,\n version,\n } as SchemaResult<TWithRef>\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAUO,SAAS,WAAW,EAAE,KAAK,aAAa,WAAW,CAAC,WAAW,iBAAiB,WAAW,EAAE,GAA2D;AAC7J,QAAM,aAAa,IAAI,cAAc,EAAE;AAEvC,MAAI,UAAiD,CAAC;AAEtD,MAAI,SAAS,SAAS,SAAS,GAAG;AAChC,cAAU;AAAA,MACR,GAAG;AAAA,MACH,GAAK,YAAY,WAAqD,CAAC;AAAA,IACzE;AAAA,EACF;AAEA,QAAM,gBAAgB,YAAY,iBAAiB,CAAC;AACpD,MAAI,SAAS,SAAS,WAAW,GAAG;AAClC,UAAM,YAAY,YAAY,aAAa,CAAC;AAE5C,WAAO,QAAQ,SAAS,EAAE,QAAQ,CAAC,CAAC,MAAM,QAAQ,MAAyC;AACzF,UAAI,SAAS,WAAW,CAAC,QAAQ,IAAI,GAAG;AACtC,cAAM,mBAAmB,OAAO,KAAK,SAAS,OAAO,EAAE,CAAC,KAAK;AAC7D,gBAAQ,IAAI,IAAI,SAAS,UAAU,eAAe,gBAAgB,GAAG;AAAA,MACvE;AAAA,IACF,CAAC;AAAA,EACH;AAEA,MAAI,SAAS,SAAS,eAAe,GAAG;AACtC,WAAO,QAAQ,aAAa,EAAE,QAAQ,CAAC,CAAC,MAAM,OAAO,MAA4C;AAC/F,UAAI,QAAQ,WAAW,CAAC,QAAQ,IAAI,GAAG;AACrC,cAAM,mBAAmB,OAAO,KAAK,QAAQ,OAAO,EAAE,CAAC,KAAK;AAC5D,gBAAQ,IAAI,IAAI,QAAQ,UAAU,eAAe,gBAAgB,GAAG;AAAA,MACtE;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;;;AC5CA;AAAA,SAAS,6BAA6B;AAuB/B,SAAS,iBAAmD,KAA6D;AAC9H,SAAO,CAAC,WAA0B;AAChC,UAAM,UAAU,sBAAsB,IAAI,GAAG,IAAI,QAAQ;AAEzD,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/SchemaMapper.ts","../src/SchemaGenerator.ts"],"sourcesContent":["import type * as KubbFile from '@kubb/fs/types'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: Schema[]\n strict?: boolean\n }\n }\n strict: { keyword: 'strict' }\n url: { keyword: 'url' }\n readOnly: { keyword: 'readOnly' }\n uuid: { keyword: 'uuid' }\n email: { keyword: 'email' }\n firstName: { keyword: 'firstName' }\n lastName: { keyword: 'lastName' }\n phone: { keyword: 'phone' }\n password: { keyword: 'password' }\n date: { keyword: 'date'; args: { type?: 'date' | 'string' } }\n time: { keyword: 'time'; args: { type?: 'date' | 'string' } }\n datetime: { keyword: 'datetime'; args: { offset?: boolean; local?: boolean } }\n tuple: { keyword: 'tuple'; args: { items: Schema[]; min?: number; max?: number } }\n array: {\n keyword: 'array'\n args: { items: Schema[]; min?: number; max?: number }\n }\n enum: {\n keyword: 'enum'\n args: {\n name: string\n typeName: string\n asConst: boolean\n items: Array<{\n name: string | number\n format: 'string' | 'number'\n value?: string | number\n }>\n }\n }\n and: { keyword: 'and'; args: Schema[] }\n const: {\n keyword: 'const'\n args: {\n name: string | number\n format: 'string' | 'number'\n value?: string | number\n }\n }\n union: { keyword: 'union'; args: Schema[] }\n ref: {\n keyword: 'ref'\n args: { name: string; path: KubbFile.OptionalPath; isTypeOnly?: boolean }\n }\n matches: { keyword: 'matches'; args?: string }\n boolean: { keyword: 'boolean' }\n default: { keyword: 'default'; args: string | number | boolean }\n string: { keyword: 'string' }\n integer: { keyword: 'integer' }\n number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; args: number }\n describe: { keyword: 'describe'; args: string }\n example: { keyword: 'example'; args: string }\n deprecated: { keyword: 'deprecated' }\n optional: { keyword: 'optional' }\n undefined: { keyword: 'undefined' }\n nullish: { keyword: 'nullish' }\n nullable: { keyword: 'nullable' }\n null: { keyword: 'null' }\n any: { keyword: 'any' }\n unknown: { keyword: 'unknown' }\n blob: { keyword: 'blob' }\n schema: { keyword: 'schema'; args: { type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; format?: string } }\n name: { keyword: 'name'; args: string }\n catchall: { keyword: 'catchall' }\n}\n\nexport const schemaKeywords = {\n any: 'any',\n strict: 'strict',\n unknown: 'unknown',\n number: 'number',\n integer: 'integer',\n string: 'string',\n boolean: 'boolean',\n undefined: 'undefined',\n nullable: 'nullable',\n null: 'null',\n nullish: 'nullish',\n array: 'array',\n tuple: 'tuple',\n enum: 'enum',\n union: 'union',\n datetime: 'datetime',\n date: 'date',\n email: 'email',\n uuid: 'uuid',\n url: 'url',\n /* intersection */\n default: 'default',\n const: 'const',\n and: 'and',\n describe: 'describe',\n min: 'min',\n max: 'max',\n optional: 'optional',\n readOnly: 'readOnly',\n\n // custom ones\n object: 'object',\n ref: 'ref',\n matches: 'matches',\n firstName: 'firstName',\n lastName: 'lastName',\n password: 'password',\n phone: 'phone',\n blob: 'blob',\n deprecated: 'deprecated',\n example: 'example',\n schema: 'schema',\n catchall: 'catchall',\n time: 'time',\n name: 'name',\n} satisfies {\n [K in keyof SchemaKeywordMapper]: SchemaKeywordMapper[K]['keyword']\n}\n\nexport type SchemaKeyword = keyof SchemaKeywordMapper\n\nexport type SchemaMapper<T = string | null | undefined> = {\n [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined\n}\n\nexport type SchemaKeywordBase<T> = {\n keyword: SchemaKeyword\n args: T\n}\n\nexport type Schema = { keyword: string } | SchemaKeywordMapper[keyof SchemaKeywordMapper]\n\nexport function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]> {\n return meta.keyword === keyword\n}\n","import { type FileMetaBase, Generator } from '@kubb/core'\nimport transformers, { pascalCase } from '@kubb/core/transformers'\nimport { getUniqueName } from '@kubb/core/utils'\n\nimport { isReference } from '@kubb/oas'\nimport { isDeepEqual, isNumber, uniqueWith } from 'remeda'\nimport { isKeyword, schemaKeywords } from './SchemaMapper.ts'\nimport { getSchemaFactory } from './utils/getSchemaFactory.ts'\nimport { getSchemas } from './utils/getSchemas.ts'\n\nimport type { Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\n\nimport type { Oas, OpenAPIV3, SchemaObject, contentType } from '@kubb/oas'\nimport type { Schema, SchemaKeywordMapper } from './SchemaMapper.ts'\nimport type { OperationSchema, Override, Refs } from './types.ts'\n\nexport type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never\n\nexport type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>\n\ntype Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {\n oas: Oas\n pluginManager: PluginManager\n /**\n * Current plugin\n */\n plugin: Plugin<TPluginOptions>\n mode: KubbFile.Mode\n include?: Array<'schemas' | 'responses' | 'requestBodies'>\n override: Array<Override<TOptions>> | undefined\n contentType?: contentType\n output?: string\n}\n\nexport type SchemaGeneratorOptions = {\n dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date'\n unknownType: 'any' | 'unknown'\n enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n enumSuffix?: string\n usedEnumNames?: Record<string, number>\n mapper?: Record<string, string>\n typed?: boolean\n transformers: {\n /**\n * Customize the names based on the type that is provided by the plugin.\n */\n name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string\n /**\n * Receive schema and name(propertName) and return FakerMeta array\n * TODO TODO add docs\n * @beta\n */\n schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined\n }\n}\n\nexport type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>\n\ntype SchemaProps = {\n schema?: SchemaObject\n name?: string\n parentName?: string\n}\n\nexport abstract class SchemaGenerator<\n TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions,\n TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n TFileMeta extends FileMetaBase = FileMetaBase,\n> extends Generator<TOptions, Context<TOptions, TPluginOptions>> {\n // Collect the types of all referenced schemas, so we can export them later\n refs: Refs = {}\n\n // Keep track of already used type aliases\n #usedAliasNames: Record<string, number> = {}\n\n /**\n * Creates a type node from a given schema.\n * Delegates to getBaseTypeFromSchema internally and\n * optionally adds a union with null.\n */\n parse(props: SchemaProps): Schema[] {\n const options = this.#getOptions(props)\n\n const defaultSchemas = this.#parseSchemaObject(props)\n const schemas = options.transformers?.schema?.(props, defaultSchemas) || defaultSchemas || []\n\n return uniqueWith<Schema>(schemas, isDeepEqual)\n }\n\n deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][] {\n return SchemaGenerator.deepSearch<T>(tree, keyword)\n }\n\n find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n return SchemaGenerator.find<T>(tree, keyword)\n }\n\n static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][] {\n const foundItems: SchemaKeywordMapper[T][] = []\n\n tree?.forEach((schema) => {\n if (schema.keyword === keyword) {\n foundItems.push(schema as SchemaKeywordMapper[T])\n }\n\n if (schema.keyword === schemaKeywords.object) {\n const subItem = schema as SchemaKeywordMapper['object']\n\n Object.values(subItem.args?.properties || {}).forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>(entrySchema, keyword))\n })\n\n Object.values(subItem.args?.additionalProperties || {}).forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.array) {\n const subItem = schema as SchemaKeywordMapper['array']\n\n subItem.args.items.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.and) {\n const subItem = schema as SchemaKeywordMapper['and']\n\n subItem.args.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.tuple) {\n const subItem = schema as SchemaKeywordMapper['tuple']\n\n subItem.args.items.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.union) {\n const subItem = schema as SchemaKeywordMapper['union']\n\n subItem.args.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n })\n\n return foundItems\n }\n\n static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n let foundItem: SchemaKeywordMapper[T] | undefined = undefined\n\n tree?.forEach((schema) => {\n if (!foundItem && schema.keyword === keyword) {\n foundItem = schema as SchemaKeywordMapper[T]\n }\n\n if (schema.keyword === schemaKeywords.object) {\n const subItem = schema as SchemaKeywordMapper['object']\n\n Object.values(subItem.args?.properties || {}).forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>(entrySchema, keyword)\n }\n })\n\n Object.values(subItem.args?.additionalProperties || {}).forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n })\n\n return foundItem\n }\n\n static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n let foundItem: SchemaKeywordMapper[T] | undefined = undefined\n\n tree?.forEach((schema) => {\n if (!foundItem && schema.keyword === keyword) {\n foundItem = schema as SchemaKeywordMapper[T]\n }\n\n if (schema.keyword === schemaKeywords.array) {\n const subItem = schema as SchemaKeywordMapper['array']\n\n subItem.args.items.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (schema.keyword === schemaKeywords.and) {\n const subItem = schema as SchemaKeywordMapper['and']\n\n subItem.args.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (schema.keyword === schemaKeywords.tuple) {\n const subItem = schema as SchemaKeywordMapper['tuple']\n\n subItem.args.items.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (schema.keyword === schemaKeywords.union) {\n const subItem = schema as SchemaKeywordMapper['union']\n\n subItem.args.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n })\n\n return foundItem\n }\n\n #getUsedEnumNames(props: SchemaProps) {\n const options = this.#getOptions(props)\n\n return options.usedEnumNames || {}\n }\n\n #getOptions({ name }: SchemaProps): Partial<TOptions> {\n const { override = [] } = this.context\n\n return {\n ...this.options,\n ...(override.find(({ pattern, type }) => {\n if (name && type === 'schemaName') {\n return !!name.match(pattern)\n }\n\n return false\n })?.options || {}),\n }\n }\n\n #getUnknownReturn(props: SchemaProps) {\n const options = this.#getOptions(props)\n\n if (options.unknownType === 'any') {\n return schemaKeywords.any\n }\n\n return schemaKeywords.unknown\n }\n\n /**\n * Recursively creates a type literal with the given props.\n */\n #parseProperties({ schema, name }: SchemaProps): Schema[] {\n const properties = schema?.properties || {}\n const additionalProperties = schema?.additionalProperties\n const required = schema?.required\n\n const propertiesSchemas = Object.keys(properties)\n .map((propertyName) => {\n const validationFunctions: Schema[] = []\n const propertySchema = properties[propertyName] as SchemaObject\n\n const isRequired = Array.isArray(required) ? required?.includes(propertyName) : !!required\n const nullable = propertySchema.nullable ?? propertySchema['x-nullable'] ?? false\n\n validationFunctions.push(...this.parse({ schema: propertySchema, name: propertyName, parentName: name }))\n\n validationFunctions.push({\n keyword: schemaKeywords.name,\n args: propertyName,\n })\n\n if (!isRequired && nullable) {\n validationFunctions.push({ keyword: schemaKeywords.nullish })\n } else if (!isRequired) {\n validationFunctions.push({ keyword: schemaKeywords.optional })\n }\n\n return {\n [propertyName]: validationFunctions,\n }\n })\n .reduce((acc, curr) => ({ ...acc, ...curr }), {})\n let additionalPropertiesSchemas: Schema[] = []\n\n if (additionalProperties) {\n additionalPropertiesSchemas =\n additionalProperties === true\n ? [{ keyword: this.#getUnknownReturn({ schema, name }) }]\n : this.parse({ schema: additionalProperties as SchemaObject, parentName: name })\n }\n\n return [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: propertiesSchemas,\n additionalProperties: additionalPropertiesSchemas,\n },\n },\n ]\n }\n\n /**\n * Create a type alias for the schema referenced by the given ReferenceObject\n */\n #getRefAlias(obj: OpenAPIV3.ReferenceObject): Schema[] {\n const { $ref } = obj\n let ref = this.refs[$ref]\n\n const originalName = getUniqueName($ref.replace(/.+\\//, ''), this.#usedAliasNames)\n const propertyName = this.context.pluginManager.resolveName({\n name: originalName,\n pluginKey: this.context.plugin.key,\n type: 'function',\n })\n\n if (ref) {\n return [\n {\n keyword: schemaKeywords.ref,\n args: { name: ref.propertyName, path: ref.path },\n },\n ]\n }\n\n const fileName = this.context.pluginManager.resolveName({\n name: originalName,\n pluginKey: this.context.plugin.key,\n type: 'file',\n })\n const file = this.context.pluginManager.getFile({\n name: fileName,\n pluginKey: this.context.plugin.key,\n extName: '.ts',\n })\n\n ref = this.refs[$ref] = {\n propertyName,\n originalName,\n path: file.path,\n }\n\n return [\n {\n keyword: schemaKeywords.ref,\n args: { name: ref.propertyName, path: ref?.path, isTypeOnly: false },\n },\n ]\n }\n\n #getParsedSchemaObject(schema?: SchemaObject) {\n const parsedSchema = getSchemaFactory(this.context.oas)(schema)\n return parsedSchema\n }\n\n /**\n * This is the very core of the OpenAPI to TS conversion - it takes a\n * schema and returns the appropriate type.\n */\n #parseSchemaObject({ schema: _schema, name, parentName }: SchemaProps): Schema[] {\n const options = this.#getOptions({ schema: _schema, name })\n const unknownReturn = this.#getUnknownReturn({ schema: _schema, name })\n const { schema, version } = this.#getParsedSchemaObject(_schema)\n const resolvedName = this.context.pluginManager.resolveName({\n name: `${parentName || ''} ${name}`,\n pluginKey: this.context.plugin.key,\n type: 'type',\n })\n\n if (!schema) {\n return [{ keyword: unknownReturn }]\n }\n\n const baseItems: Schema[] = [\n {\n keyword: schemaKeywords.schema,\n args: {\n type: schema.type as any,\n format: schema.format,\n },\n },\n ]\n const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined\n const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined\n const nullable = schema.nullable ?? schema['x-nullable'] ?? false\n\n if (schema.default !== undefined && !Array.isArray(schema.default)) {\n if (typeof schema.default === 'string') {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: transformers.stringify(schema.default),\n })\n }\n if (typeof schema.default === 'boolean') {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: schema.default ?? false,\n })\n }\n }\n\n if (schema.description) {\n baseItems.push({\n keyword: schemaKeywords.describe,\n args: schema.description,\n })\n }\n\n if (schema.pattern) {\n baseItems.unshift({\n keyword: schemaKeywords.matches,\n args: schema.pattern,\n })\n }\n\n if (max !== undefined) {\n baseItems.unshift({ keyword: schemaKeywords.max, args: max })\n }\n\n if (min !== undefined) {\n baseItems.unshift({ keyword: schemaKeywords.min, args: min })\n }\n\n if (nullable) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n\n if (schema.type && Array.isArray(schema.type)) {\n const [_schema, nullable] = schema.type\n\n if (nullable === 'null') {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n }\n\n if (schema.readOnly) {\n baseItems.push({ keyword: schemaKeywords.readOnly })\n }\n\n if (isReference(schema)) {\n return [\n ...this.#getRefAlias(schema),\n nullable && { keyword: schemaKeywords.nullable },\n {\n keyword: schemaKeywords.schema,\n args: {\n type: schema.type as any,\n format: schema.format,\n },\n },\n ].filter(Boolean)\n }\n\n if (schema.oneOf) {\n // union\n const schemaWithoutOneOf = { ...schema, oneOf: undefined }\n\n const union: Schema = {\n keyword: schemaKeywords.union,\n args: schema.oneOf\n .map((item) => {\n return item && this.parse({ schema: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => {\n return item && item.keyword !== unknownReturn\n }),\n }\n if (schemaWithoutOneOf.properties) {\n return [...this.parse({ schema: schemaWithoutOneOf, name, parentName }), union, ...baseItems]\n }\n\n return [union, ...baseItems]\n }\n\n if (schema.anyOf) {\n // union\n const schemaWithoutAnyOf = { ...schema, anyOf: undefined }\n\n const union: Schema = {\n keyword: schemaKeywords.union,\n args: schema.anyOf\n .map((item) => {\n return item && this.parse({ schema: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => {\n return item && item.keyword !== unknownReturn\n })\n .map((item) => {\n if (isKeyword(item, schemaKeywords.object)) {\n return {\n ...item,\n args: {\n ...item.args,\n strict: true,\n },\n }\n }\n return item\n }),\n }\n if (schemaWithoutAnyOf.properties) {\n return [...this.parse({ schema: schemaWithoutAnyOf, name, parentName }), union, ...baseItems]\n }\n\n return [union, ...baseItems]\n }\n if (schema.allOf) {\n // intersection/add\n const schemaWithoutAllOf = { ...schema, allOf: undefined }\n\n const and: Schema = {\n keyword: schemaKeywords.and,\n args: schema.allOf\n .map((item) => {\n return item && this.parse({ schema: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => {\n return item && item.keyword !== unknownReturn\n }),\n }\n\n if (schemaWithoutAllOf.properties) {\n return [\n {\n ...and,\n args: [...(and.args || []), ...this.parse({ schema: schemaWithoutAllOf, name, parentName })],\n },\n ...baseItems,\n ]\n }\n\n return [and, ...baseItems]\n }\n\n if (schema.enum) {\n const enumName = getUniqueName(pascalCase([parentName, name, options.enumSuffix].join(' ')), this.#getUsedEnumNames({ schema, name }))\n const typeName = this.context.pluginManager.resolveName({\n name: enumName,\n pluginKey: this.context.plugin.key,\n type: 'type',\n })\n\n const nullableEnum = schema.enum.includes(null)\n if (nullableEnum) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n const filteredValues = schema.enum.filter((value) => value !== null)\n\n // x-enumNames has priority\n const extensionEnums = ['x-enumNames', 'x-enum-varnames']\n .filter((extensionKey) => extensionKey in schema)\n .map((extensionKey) => {\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name,\n typeName,\n asConst: false,\n items: [...new Set(schema[extensionKey as keyof typeof schema] as string[])].map((name: string | number, index) => ({\n name: transformers.stringify(name),\n value: schema.enum?.[index] as string | number,\n format: isNumber(schema.enum?.[index]) ? 'number' : 'string',\n })),\n },\n },\n ...baseItems.filter(\n (item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches,\n ),\n ]\n })\n\n if (schema.type === 'number' || schema.type === 'integer') {\n // we cannot use z.enum when enum type is number/integer\n const enumNames = extensionEnums[0]?.find((item) => isKeyword(item, schemaKeywords.enum)) as unknown as SchemaKeywordMapper['enum']\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: enumName,\n typeName,\n asConst: true,\n items: enumNames?.args?.items\n ? [...new Set(enumNames.args.items)].map(({ name, value }) => ({\n name,\n value,\n format: 'number',\n }))\n : [...new Set(filteredValues)].map((value: string) => {\n return {\n name: value,\n value,\n format: 'number',\n }\n }),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches),\n ]\n }\n\n if (extensionEnums.length > 0 && extensionEnums[0]) {\n return extensionEnums[0]\n }\n\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: enumName,\n typeName,\n asConst: false,\n items: [...new Set(filteredValues)].map((value: string) => ({\n name: transformers.stringify(value),\n value,\n format: isNumber(value) ? 'number' : 'string',\n })),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches),\n ]\n }\n\n if ('prefixItems' in schema) {\n const prefixItems = schema.prefixItems as SchemaObject[]\n const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined\n const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined\n\n return [\n {\n keyword: schemaKeywords.tuple,\n args: {\n min,\n max,\n items: prefixItems\n .map((item) => {\n return this.parse({ schema: item, name, parentName })[0]\n })\n .filter(Boolean),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max),\n ]\n }\n\n if (version === '3.1' && 'const' in schema) {\n // const keyword takes precendence over the actual type.\n if (schema['const']) {\n return [\n {\n keyword: schemaKeywords.const,\n args: {\n name: schema['const'],\n format: typeof schema['const'] === 'number' ? 'number' : 'string',\n value: schema['const'],\n },\n },\n ...baseItems,\n ]\n }\n return [{ keyword: schemaKeywords.null }]\n }\n\n /**\n * > Structural validation alone may be insufficient to allow an application to correctly utilize certain values. The \"format\"\n * > annotation keyword is defined to allow schema authors to convey semantic information for a fixed subset of values which are\n * > accurately described by authoritative resources, be they RFCs or other external specifications.\n *\n * In other words: format is more specific than type alone, hence it should override the type value, if possible.\n *\n * see also https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-00#rfc.section.7\n */\n if (schema.format) {\n switch (schema.format) {\n case 'binary':\n baseItems.push({ keyword: schemaKeywords.blob })\n return baseItems\n case 'date-time':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'date' } })\n\n return baseItems\n }\n\n if (options.dateType === 'stringOffset') {\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: true } })\n return baseItems\n }\n\n if (options.dateType === 'stringLocal') {\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { local: true } })\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: false } })\n\n return baseItems\n }\n break\n case 'date':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'date' } })\n\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'string' } })\n\n return baseItems\n }\n break\n case 'time':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.time, args: { type: 'date' } })\n\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.time, args: { type: 'string' } })\n\n return baseItems\n }\n break\n case 'uuid':\n baseItems.unshift({ keyword: schemaKeywords.uuid })\n break\n case 'email':\n case 'idn-email':\n baseItems.unshift({ keyword: schemaKeywords.email })\n break\n case 'uri':\n case 'ipv4':\n case 'ipv6':\n case 'uri-reference':\n case 'hostname':\n case 'idn-hostname':\n baseItems.unshift({ keyword: schemaKeywords.url })\n break\n // case 'duration':\n // case 'json-pointer':\n // case 'relative-json-pointer':\n default:\n // formats not yet implemented: ignore.\n break\n }\n }\n\n // type based logic\n if ('items' in schema || schema.type === ('array' as 'string')) {\n const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined\n const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined\n const items = this.parse({ schema: 'items' in schema ? (schema.items as SchemaObject) : [], name, parentName })\n\n return [\n {\n keyword: schemaKeywords.array,\n args: {\n items,\n min,\n max,\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max),\n ]\n }\n\n if (schema.properties || schema.additionalProperties) {\n return [...this.#parseProperties({ schema, name }), ...baseItems]\n }\n\n if (schema.type) {\n if (Array.isArray(schema.type)) {\n // OPENAPI v3.1.0: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0\n const [type] = schema.type as Array<OpenAPIV3.NonArraySchemaObjectType>\n\n return [\n ...this.parse({\n schema: {\n ...schema,\n type,\n },\n name,\n parentName,\n }),\n ...baseItems,\n ].filter(Boolean)\n }\n\n // 'string' | 'number' | 'integer' | 'boolean'\n return [{ keyword: schema.type }, ...baseItems]\n }\n\n return [{ keyword: unknownReturn }]\n }\n\n async build(): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas, contentType, include } = this.context\n\n const schemas = getSchemas({ oas, contentType, includes: include })\n\n const promises = Object.entries(schemas).reduce((acc, [name, schema]) => {\n const options = this.#getOptions({ name })\n const promiseOperation = this.schema.call(this, name, schema, {\n ...this.options,\n ...options,\n })\n\n if (promiseOperation) {\n acc.push(promiseOperation)\n }\n\n return acc\n }, [] as SchemaMethodResult<TFileMeta>[])\n\n const files = await Promise.all(promises)\n\n // using .flat because schemaGenerator[method] can return a array of files or just one file\n return files.flat().filter(Boolean)\n }\n\n /**\n * Schema\n */\n abstract schema(name: string, object: SchemaObject, options: TOptions): SchemaMethodResult<TFileMeta>\n}\n"],"mappings":";;;;;;;;;;AAAA;AA+EO,IAAM,iBAAiB;AAAA,EAC5B,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AAAA,EACV,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA;AAAA,EAEL,SAAS;AAAA,EACT,OAAO;AAAA,EACP,KAAK;AAAA,EACL,UAAU;AAAA,EAC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AAA,QACE,SAAS,eAAe;AAAA,QACxB,MAAM;AAAA,UACJ;AAAA,UACA,KAAAD;AAAA,UACA,KAAAC;AAAA,QACF;AAAA,MACF;AAAA,MACA,GAAG,UAAU,OAAO,CAAC,SAAS,KAAK,YAAY,eAAe,OAAO,KAAK,YAAY,eAAe,GAAG;AAAA,IAC1G;AAAA,EACF;AAEA,MAAI,OAAO,cAAc,OAAO,sBAAsB;AACpD,WAAO,CAAC,GAAG,sBAAK,gDAAL,WAAsB,EAAE,QAAQ,KAAK,IAAI,GAAG,SAAS;AAAA,EAClE;AAEA,MAAI,OAAO,MAAM;AACf,QAAI,MAAM,QAAQ,OAAO,IAAI,GAAG;AAE9B,YAAM,CAAC,IAAI,IAAI,OAAO;AAEtB,aAAO;AAAA,QACL,GAAG,KAAK,MAAM;AAAA,UACZ,QAAQ;AAAA,YACN,GAAG;AAAA,YACH;AAAA,UACF;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,QACD,GAAG;AAAA,MACL,EAAE,OAAO,OAAO;AAAA,IAClB;AAGA,WAAO,CAAC,EAAE,SAAS,OAAO,KAAK,GAAG,GAAG,SAAS;AAAA,EAChD;AAEA,SAAO,CAAC,EAAE,SAAS,cAAc,CAAC;AACpC;AA/uBK,IAAe,kBAAf;","names":["_schema","nullable","name","min","max"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/kubb/kubb/packages/plugin-oas/dist/chunk-M62LERKB.cjs","../src/SchemaMapper.ts","../src/SchemaGenerator.ts"],"names":["_schema","nullable","min","max"],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACTA,8CAAA,CAAA;AA+EO,IAAM,eAAA,EAAiB;AAAA,EAC5B,GAAA,EAAK,KAAA;AAAA,EACL,MAAA,EAAQ,QAAA;AAAA,EACR,OAAA,EAAS,SAAA;AAAA,EACT,MAAA,EAAQ,QAAA;AAAA,EACR,OAAA,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/uBoB;AF+mBX;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/kubb/kubb/packages/plugin-oas/dist/chunk-M62LERKB.cjs","sourcesContent":[null,"import type * as KubbFile from '@kubb/fs/types'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: Schema[]\n strict?: boolean\n }\n }\n strict: { keyword: 'strict' }\n url: { keyword: 'url' }\n readOnly: { keyword: 'readOnly' }\n uuid: { keyword: 'uuid' }\n email: { keyword: 'email' }\n firstName: { keyword: 'firstName' }\n lastName: { keyword: 'lastName' }\n phone: { keyword: 'phone' }\n password: { keyword: 'password' }\n date: { keyword: 'date'; args: { type?: 'date' | 'string' } }\n time: { keyword: 'time'; args: { type?: 'date' | 'string' } }\n datetime: { keyword: 'datetime'; args: { offset?: boolean; local?: boolean } }\n tuple: { keyword: 'tuple'; args: { items: Schema[]; min?: number; max?: number } }\n array: {\n keyword: 'array'\n args: { items: Schema[]; min?: number; max?: number }\n }\n enum: {\n keyword: 'enum'\n args: {\n name: string\n typeName: string\n asConst: boolean\n items: Array<{\n name: string | number\n format: 'string' | 'number'\n value?: string | number\n }>\n }\n }\n and: { keyword: 'and'; args: Schema[] }\n const: {\n keyword: 'const'\n args: {\n name: string | number\n format: 'string' | 'number'\n value?: string | number\n }\n }\n union: { keyword: 'union'; args: Schema[] }\n ref: {\n keyword: 'ref'\n args: { name: string; path: KubbFile.OptionalPath; isTypeOnly?: boolean }\n }\n matches: { keyword: 'matches'; args?: string }\n boolean: { keyword: 'boolean' }\n default: { keyword: 'default'; args: string | number | boolean }\n string: { keyword: 'string' }\n integer: { keyword: 'integer' }\n number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; args: number }\n describe: { keyword: 'describe'; args: string }\n example: { keyword: 'example'; args: string }\n deprecated: { keyword: 'deprecated' }\n optional: { keyword: 'optional' }\n undefined: { keyword: 'undefined' }\n nullish: { keyword: 'nullish' }\n nullable: { keyword: 'nullable' }\n null: { keyword: 'null' }\n any: { keyword: 'any' }\n unknown: { keyword: 'unknown' }\n blob: { keyword: 'blob' }\n schema: { keyword: 'schema'; args: { type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; format?: string } }\n name: { keyword: 'name'; args: string }\n catchall: { keyword: 'catchall' }\n}\n\nexport const schemaKeywords = {\n any: 'any',\n strict: 'strict',\n unknown: 'unknown',\n number: 'number',\n integer: 'integer',\n string: 'string',\n boolean: 'boolean',\n undefined: 'undefined',\n nullable: 'nullable',\n null: 'null',\n nullish: 'nullish',\n array: 'array',\n tuple: 'tuple',\n enum: 'enum',\n union: 'union',\n datetime: 'datetime',\n date: 'date',\n email: 'email',\n uuid: 'uuid',\n url: 'url',\n /* intersection */\n default: 'default',\n const: 'const',\n and: 'and',\n describe: 'describe',\n min: 'min',\n max: 'max',\n optional: 'optional',\n readOnly: 'readOnly',\n\n // custom ones\n object: 'object',\n ref: 'ref',\n matches: 'matches',\n firstName: 'firstName',\n lastName: 'lastName',\n password: 'password',\n phone: 'phone',\n blob: 'blob',\n deprecated: 'deprecated',\n example: 'example',\n schema: 'schema',\n catchall: 'catchall',\n time: 'time',\n name: 'name',\n} satisfies {\n [K in keyof SchemaKeywordMapper]: SchemaKeywordMapper[K]['keyword']\n}\n\nexport type SchemaKeyword = keyof SchemaKeywordMapper\n\nexport type SchemaMapper<T = string | null | undefined> = {\n [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined\n}\n\nexport type SchemaKeywordBase<T> = {\n keyword: SchemaKeyword\n args: T\n}\n\nexport type Schema = { keyword: string } | SchemaKeywordMapper[keyof SchemaKeywordMapper]\n\nexport function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]> {\n return meta.keyword === keyword\n}\n","import { type FileMetaBase, Generator } from '@kubb/core'\nimport transformers, { pascalCase } from '@kubb/core/transformers'\nimport { getUniqueName } from '@kubb/core/utils'\n\nimport { isReference } from '@kubb/oas'\nimport { isDeepEqual, isNumber, uniqueWith } from 'remeda'\nimport { isKeyword, schemaKeywords } from './SchemaMapper.ts'\nimport { getSchemaFactory } from './utils/getSchemaFactory.ts'\nimport { getSchemas } from './utils/getSchemas.ts'\n\nimport type { Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\n\nimport type { Oas, OpenAPIV3, SchemaObject, contentType } from '@kubb/oas'\nimport type { Schema, SchemaKeywordMapper } from './SchemaMapper.ts'\nimport type { OperationSchema, Override, Refs } from './types.ts'\n\nexport type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never\n\nexport type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>\n\ntype Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {\n oas: Oas\n pluginManager: PluginManager\n /**\n * Current plugin\n */\n plugin: Plugin<TPluginOptions>\n mode: KubbFile.Mode\n include?: Array<'schemas' | 'responses' | 'requestBodies'>\n override: Array<Override<TOptions>> | undefined\n contentType?: contentType\n output?: string\n}\n\nexport type SchemaGeneratorOptions = {\n dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date'\n unknownType: 'any' | 'unknown'\n enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n enumSuffix?: string\n usedEnumNames?: Record<string, number>\n mapper?: Record<string, string>\n typed?: boolean\n transformers: {\n /**\n * Customize the names based on the type that is provided by the plugin.\n */\n name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string\n /**\n * Receive schema and name(propertName) and return FakerMeta array\n * TODO TODO add docs\n * @beta\n */\n schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined\n }\n}\n\nexport type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>\n\ntype SchemaProps = {\n schema?: SchemaObject\n name?: string\n parentName?: string\n}\n\nexport abstract class SchemaGenerator<\n TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions,\n TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n TFileMeta extends FileMetaBase = FileMetaBase,\n> extends Generator<TOptions, Context<TOptions, TPluginOptions>> {\n // Collect the types of all referenced schemas, so we can export them later\n refs: Refs = {}\n\n // Keep track of already used type aliases\n #usedAliasNames: Record<string, number> = {}\n\n /**\n * Creates a type node from a given schema.\n * Delegates to getBaseTypeFromSchema internally and\n * optionally adds a union with null.\n */\n parse(props: SchemaProps): Schema[] {\n const options = this.#getOptions(props)\n\n const defaultSchemas = this.#parseSchemaObject(props)\n const schemas = options.transformers?.schema?.(props, defaultSchemas) || defaultSchemas || []\n\n return uniqueWith<Schema>(schemas, isDeepEqual)\n }\n\n deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][] {\n return SchemaGenerator.deepSearch<T>(tree, keyword)\n }\n\n find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n return SchemaGenerator.find<T>(tree, keyword)\n }\n\n static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][] {\n const foundItems: SchemaKeywordMapper[T][] = []\n\n tree?.forEach((schema) => {\n if (schema.keyword === keyword) {\n foundItems.push(schema as SchemaKeywordMapper[T])\n }\n\n if (schema.keyword === schemaKeywords.object) {\n const subItem = schema as SchemaKeywordMapper['object']\n\n Object.values(subItem.args?.properties || {}).forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>(entrySchema, keyword))\n })\n\n Object.values(subItem.args?.additionalProperties || {}).forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.array) {\n const subItem = schema as SchemaKeywordMapper['array']\n\n subItem.args.items.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.and) {\n const subItem = schema as SchemaKeywordMapper['and']\n\n subItem.args.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.tuple) {\n const subItem = schema as SchemaKeywordMapper['tuple']\n\n subItem.args.items.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.union) {\n const subItem = schema as SchemaKeywordMapper['union']\n\n subItem.args.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n })\n\n return foundItems\n }\n\n static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n let foundItem: SchemaKeywordMapper[T] | undefined = undefined\n\n tree?.forEach((schema) => {\n if (!foundItem && schema.keyword === keyword) {\n foundItem = schema as SchemaKeywordMapper[T]\n }\n\n if (schema.keyword === schemaKeywords.object) {\n const subItem = schema as SchemaKeywordMapper['object']\n\n Object.values(subItem.args?.properties || {}).forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>(entrySchema, keyword)\n }\n })\n\n Object.values(subItem.args?.additionalProperties || {}).forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n })\n\n return foundItem\n }\n\n static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n let foundItem: SchemaKeywordMapper[T] | undefined = undefined\n\n tree?.forEach((schema) => {\n if (!foundItem && schema.keyword === keyword) {\n foundItem = schema as SchemaKeywordMapper[T]\n }\n\n if (schema.keyword === schemaKeywords.array) {\n const subItem = schema as SchemaKeywordMapper['array']\n\n subItem.args.items.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (schema.keyword === schemaKeywords.and) {\n const subItem = schema as SchemaKeywordMapper['and']\n\n subItem.args.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (schema.keyword === schemaKeywords.tuple) {\n const subItem = schema as SchemaKeywordMapper['tuple']\n\n subItem.args.items.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (schema.keyword === schemaKeywords.union) {\n const subItem = schema as SchemaKeywordMapper['union']\n\n subItem.args.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n })\n\n return foundItem\n }\n\n #getUsedEnumNames(props: SchemaProps) {\n const options = this.#getOptions(props)\n\n return options.usedEnumNames || {}\n }\n\n #getOptions({ name }: SchemaProps): Partial<TOptions> {\n const { override = [] } = this.context\n\n return {\n ...this.options,\n ...(override.find(({ pattern, type }) => {\n if (name && type === 'schemaName') {\n return !!name.match(pattern)\n }\n\n return false\n })?.options || {}),\n }\n }\n\n #getUnknownReturn(props: SchemaProps) {\n const options = this.#getOptions(props)\n\n if (options.unknownType === 'any') {\n return schemaKeywords.any\n }\n\n return schemaKeywords.unknown\n }\n\n /**\n * Recursively creates a type literal with the given props.\n */\n #parseProperties({ schema, name }: SchemaProps): Schema[] {\n const properties = schema?.properties || {}\n const additionalProperties = schema?.additionalProperties\n const required = schema?.required\n\n const propertiesSchemas = Object.keys(properties)\n .map((propertyName) => {\n const validationFunctions: Schema[] = []\n const propertySchema = properties[propertyName] as SchemaObject\n\n const isRequired = Array.isArray(required) ? required?.includes(propertyName) : !!required\n const nullable = propertySchema.nullable ?? propertySchema['x-nullable'] ?? false\n\n validationFunctions.push(...this.parse({ schema: propertySchema, name: propertyName, parentName: name }))\n\n validationFunctions.push({\n keyword: schemaKeywords.name,\n args: propertyName,\n })\n\n if (!isRequired && nullable) {\n validationFunctions.push({ keyword: schemaKeywords.nullish })\n } else if (!isRequired) {\n validationFunctions.push({ keyword: schemaKeywords.optional })\n }\n\n return {\n [propertyName]: validationFunctions,\n }\n })\n .reduce((acc, curr) => ({ ...acc, ...curr }), {})\n let additionalPropertiesSchemas: Schema[] = []\n\n if (additionalProperties) {\n additionalPropertiesSchemas =\n additionalProperties === true\n ? [{ keyword: this.#getUnknownReturn({ schema, name }) }]\n : this.parse({ schema: additionalProperties as SchemaObject, parentName: name })\n }\n\n return [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: propertiesSchemas,\n additionalProperties: additionalPropertiesSchemas,\n },\n },\n ]\n }\n\n /**\n * Create a type alias for the schema referenced by the given ReferenceObject\n */\n #getRefAlias(obj: OpenAPIV3.ReferenceObject): Schema[] {\n const { $ref } = obj\n let ref = this.refs[$ref]\n\n const originalName = getUniqueName($ref.replace(/.+\\//, ''), this.#usedAliasNames)\n const propertyName = this.context.pluginManager.resolveName({\n name: originalName,\n pluginKey: this.context.plugin.key,\n type: 'function',\n })\n\n if (ref) {\n return [\n {\n keyword: schemaKeywords.ref,\n args: { name: ref.propertyName, path: ref.path },\n },\n ]\n }\n\n const fileName = this.context.pluginManager.resolveName({\n name: originalName,\n pluginKey: this.context.plugin.key,\n type: 'file',\n })\n const file = this.context.pluginManager.getFile({\n name: fileName,\n pluginKey: this.context.plugin.key,\n extName: '.ts',\n })\n\n ref = this.refs[$ref] = {\n propertyName,\n originalName,\n path: file.path,\n }\n\n return [\n {\n keyword: schemaKeywords.ref,\n args: { name: ref.propertyName, path: ref?.path, isTypeOnly: false },\n },\n ]\n }\n\n #getParsedSchemaObject(schema?: SchemaObject) {\n const parsedSchema = getSchemaFactory(this.context.oas)(schema)\n return parsedSchema\n }\n\n /**\n * This is the very core of the OpenAPI to TS conversion - it takes a\n * schema and returns the appropriate type.\n */\n #parseSchemaObject({ schema: _schema, name, parentName }: SchemaProps): Schema[] {\n const options = this.#getOptions({ schema: _schema, name })\n const unknownReturn = this.#getUnknownReturn({ schema: _schema, name })\n const { schema, version } = this.#getParsedSchemaObject(_schema)\n const resolvedName = this.context.pluginManager.resolveName({\n name: `${parentName || ''} ${name}`,\n pluginKey: this.context.plugin.key,\n type: 'type',\n })\n\n if (!schema) {\n return [{ keyword: unknownReturn }]\n }\n\n const baseItems: Schema[] = [\n {\n keyword: schemaKeywords.schema,\n args: {\n type: schema.type as any,\n format: schema.format,\n },\n },\n ]\n const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined\n const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined\n const nullable = schema.nullable ?? schema['x-nullable'] ?? false\n\n if (schema.default !== undefined && !Array.isArray(schema.default)) {\n if (typeof schema.default === 'string') {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: transformers.stringify(schema.default),\n })\n }\n if (typeof schema.default === 'boolean') {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: schema.default ?? false,\n })\n }\n }\n\n if (schema.description) {\n baseItems.push({\n keyword: schemaKeywords.describe,\n args: schema.description,\n })\n }\n\n if (schema.pattern) {\n baseItems.unshift({\n keyword: schemaKeywords.matches,\n args: schema.pattern,\n })\n }\n\n if (max !== undefined) {\n baseItems.unshift({ keyword: schemaKeywords.max, args: max })\n }\n\n if (min !== undefined) {\n baseItems.unshift({ keyword: schemaKeywords.min, args: min })\n }\n\n if (nullable) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n\n if (schema.type && Array.isArray(schema.type)) {\n const [_schema, nullable] = schema.type\n\n if (nullable === 'null') {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n }\n\n if (schema.readOnly) {\n baseItems.push({ keyword: schemaKeywords.readOnly })\n }\n\n if (isReference(schema)) {\n return [\n ...this.#getRefAlias(schema),\n nullable && { keyword: schemaKeywords.nullable },\n {\n keyword: schemaKeywords.schema,\n args: {\n type: schema.type as any,\n format: schema.format,\n },\n },\n ].filter(Boolean)\n }\n\n if (schema.oneOf) {\n // union\n const schemaWithoutOneOf = { ...schema, oneOf: undefined }\n\n const union: Schema = {\n keyword: schemaKeywords.union,\n args: schema.oneOf\n .map((item) => {\n return item && this.parse({ schema: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => {\n return item && item.keyword !== unknownReturn\n }),\n }\n if (schemaWithoutOneOf.properties) {\n return [...this.parse({ schema: schemaWithoutOneOf, name, parentName }), union, ...baseItems]\n }\n\n return [union, ...baseItems]\n }\n\n if (schema.anyOf) {\n // union\n const schemaWithoutAnyOf = { ...schema, anyOf: undefined }\n\n const union: Schema = {\n keyword: schemaKeywords.union,\n args: schema.anyOf\n .map((item) => {\n return item && this.parse({ schema: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => {\n return item && item.keyword !== unknownReturn\n })\n .map((item) => {\n if (isKeyword(item, schemaKeywords.object)) {\n return {\n ...item,\n args: {\n ...item.args,\n strict: true,\n },\n }\n }\n return item\n }),\n }\n if (schemaWithoutAnyOf.properties) {\n return [...this.parse({ schema: schemaWithoutAnyOf, name, parentName }), union, ...baseItems]\n }\n\n return [union, ...baseItems]\n }\n if (schema.allOf) {\n // intersection/add\n const schemaWithoutAllOf = { ...schema, allOf: undefined }\n\n const and: Schema = {\n keyword: schemaKeywords.and,\n args: schema.allOf\n .map((item) => {\n return item && this.parse({ schema: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => {\n return item && item.keyword !== unknownReturn\n }),\n }\n\n if (schemaWithoutAllOf.properties) {\n return [\n {\n ...and,\n args: [...(and.args || []), ...this.parse({ schema: schemaWithoutAllOf, name, parentName })],\n },\n ...baseItems,\n ]\n }\n\n return [and, ...baseItems]\n }\n\n if (schema.enum) {\n const enumName = getUniqueName(pascalCase([parentName, name, options.enumSuffix].join(' ')), this.#getUsedEnumNames({ schema, name }))\n const typeName = this.context.pluginManager.resolveName({\n name: enumName,\n pluginKey: this.context.plugin.key,\n type: 'type',\n })\n\n const nullableEnum = schema.enum.includes(null)\n if (nullableEnum) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n const filteredValues = schema.enum.filter((value) => value !== null)\n\n // x-enumNames has priority\n const extensionEnums = ['x-enumNames', 'x-enum-varnames']\n .filter((extensionKey) => extensionKey in schema)\n .map((extensionKey) => {\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name,\n typeName,\n asConst: false,\n items: [...new Set(schema[extensionKey as keyof typeof schema] as string[])].map((name: string | number, index) => ({\n name: transformers.stringify(name),\n value: schema.enum?.[index] as string | number,\n format: isNumber(schema.enum?.[index]) ? 'number' : 'string',\n })),\n },\n },\n ...baseItems.filter(\n (item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches,\n ),\n ]\n })\n\n if (schema.type === 'number' || schema.type === 'integer') {\n // we cannot use z.enum when enum type is number/integer\n const enumNames = extensionEnums[0]?.find((item) => isKeyword(item, schemaKeywords.enum)) as unknown as SchemaKeywordMapper['enum']\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: enumName,\n typeName,\n asConst: true,\n items: enumNames?.args?.items\n ? [...new Set(enumNames.args.items)].map(({ name, value }) => ({\n name,\n value,\n format: 'number',\n }))\n : [...new Set(filteredValues)].map((value: string) => {\n return {\n name: value,\n value,\n format: 'number',\n }\n }),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches),\n ]\n }\n\n if (extensionEnums.length > 0 && extensionEnums[0]) {\n return extensionEnums[0]\n }\n\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: enumName,\n typeName,\n asConst: false,\n items: [...new Set(filteredValues)].map((value: string) => ({\n name: transformers.stringify(value),\n value,\n format: isNumber(value) ? 'number' : 'string',\n })),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches),\n ]\n }\n\n if ('prefixItems' in schema) {\n const prefixItems = schema.prefixItems as SchemaObject[]\n const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined\n const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined\n\n return [\n {\n keyword: schemaKeywords.tuple,\n args: {\n min,\n max,\n items: prefixItems\n .map((item) => {\n return this.parse({ schema: item, name, parentName })[0]\n })\n .filter(Boolean),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max),\n ]\n }\n\n if (version === '3.1' && 'const' in schema) {\n // const keyword takes precendence over the actual type.\n if (schema['const']) {\n return [\n {\n keyword: schemaKeywords.const,\n args: {\n name: schema['const'],\n format: typeof schema['const'] === 'number' ? 'number' : 'string',\n value: schema['const'],\n },\n },\n ...baseItems,\n ]\n }\n return [{ keyword: schemaKeywords.null }]\n }\n\n /**\n * > Structural validation alone may be insufficient to allow an application to correctly utilize certain values. The \"format\"\n * > annotation keyword is defined to allow schema authors to convey semantic information for a fixed subset of values which are\n * > accurately described by authoritative resources, be they RFCs or other external specifications.\n *\n * In other words: format is more specific than type alone, hence it should override the type value, if possible.\n *\n * see also https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-00#rfc.section.7\n */\n if (schema.format) {\n switch (schema.format) {\n case 'binary':\n baseItems.push({ keyword: schemaKeywords.blob })\n return baseItems\n case 'date-time':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'date' } })\n\n return baseItems\n }\n\n if (options.dateType === 'stringOffset') {\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: true } })\n return baseItems\n }\n\n if (options.dateType === 'stringLocal') {\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { local: true } })\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: false } })\n\n return baseItems\n }\n break\n case 'date':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'date' } })\n\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'string' } })\n\n return baseItems\n }\n break\n case 'time':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.time, args: { type: 'date' } })\n\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.time, args: { type: 'string' } })\n\n return baseItems\n }\n break\n case 'uuid':\n baseItems.unshift({ keyword: schemaKeywords.uuid })\n break\n case 'email':\n case 'idn-email':\n baseItems.unshift({ keyword: schemaKeywords.email })\n break\n case 'uri':\n case 'ipv4':\n case 'ipv6':\n case 'uri-reference':\n case 'hostname':\n case 'idn-hostname':\n baseItems.unshift({ keyword: schemaKeywords.url })\n break\n // case 'duration':\n // case 'json-pointer':\n // case 'relative-json-pointer':\n default:\n // formats not yet implemented: ignore.\n break\n }\n }\n\n // type based logic\n if ('items' in schema || schema.type === ('array' as 'string')) {\n const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined\n const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined\n const items = this.parse({ schema: 'items' in schema ? (schema.items as SchemaObject) : [], name, parentName })\n\n return [\n {\n keyword: schemaKeywords.array,\n args: {\n items,\n min,\n max,\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max),\n ]\n }\n\n if (schema.properties || schema.additionalProperties) {\n return [...this.#parseProperties({ schema, name }), ...baseItems]\n }\n\n if (schema.type) {\n if (Array.isArray(schema.type)) {\n // OPENAPI v3.1.0: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0\n const [type] = schema.type as Array<OpenAPIV3.NonArraySchemaObjectType>\n\n return [\n ...this.parse({\n schema: {\n ...schema,\n type,\n },\n name,\n parentName,\n }),\n ...baseItems,\n ].filter(Boolean)\n }\n\n // 'string' | 'number' | 'integer' | 'boolean'\n return [{ keyword: schema.type }, ...baseItems]\n }\n\n return [{ keyword: unknownReturn }]\n }\n\n async build(): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas, contentType, include } = this.context\n\n const schemas = getSchemas({ oas, contentType, includes: include })\n\n const promises = Object.entries(schemas).reduce((acc, [name, schema]) => {\n const options = this.#getOptions({ name })\n const promiseOperation = this.schema.call(this, name, schema, {\n ...this.options,\n ...options,\n })\n\n if (promiseOperation) {\n acc.push(promiseOperation)\n }\n\n return acc\n }, [] as SchemaMethodResult<TFileMeta>[])\n\n const files = await Promise.all(promises)\n\n // using .flat because schemaGenerator[method] can return a array of files or just one file\n return files.flat().filter(Boolean)\n }\n\n /**\n * Schema\n */\n abstract schema(name: string, object: SchemaObject, options: TOptions): SchemaMethodResult<TFileMeta>\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/kubb/kubb/packages/plugin-oas/dist/chunk-PHNRHM3I.cjs","../../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.47.5_@types+node@20.14.14__jiti@1.21.6_postcss@8.4.40_typescript@5.5.4_yaml@2.4.5/node_modules/tsup/assets/cjs_shims.js","../src/utils/getSchemas.ts","../src/utils/getSchemaFactory.ts"],"names":[],"mappings":"AAAA,ilBAAI,SAAS,EAAE,MAAM,CAAC,MAAM;AAC5B,IAAI,UAAU,EAAE,MAAM,CAAC,cAAc;AACrC,IAAI,iBAAiB,EAAE,MAAM,CAAC,wBAAwB;AACtD,IAAI,kBAAkB,EAAE,MAAM,CAAC,mBAAmB;AAClD,IAAI,aAAa,EAAE,MAAM,CAAC,cAAc;AACxC,IAAI,aAAa,EAAE,MAAM,CAAC,SAAS,CAAC,cAAc;AAClD,IAAI,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG;AAC3B,EAAE,MAAM,SAAS,CAAC,GAA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ACF;AHwDA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,4UAAC","file":"/home/runner/work/kubb/kubb/packages/plugin-oas/dist/chunk-PHNRHM3I.cjs","sourcesContent":[null,"// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () =>\n typeof document === 'undefined'\n ? new URL(`file:${__filename}`).href\n : (document.currentScript && document.currentScript.src) ||\n new URL('main.js', document.baseURI).href\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","import type { Oas, OasTypes, contentType } from '@kubb/oas'\n\ntype Mode = 'schemas' | 'responses' | 'requestBodies'\n\nexport type GetSchemasProps = {\n oas: Oas\n contentType?: contentType\n includes?: Mode[]\n}\n\nexport function getSchemas({ oas, contentType, includes = ['schemas', 'requestBodies', 'responses'] }: GetSchemasProps): Record<string, OasTypes.SchemaObject> {\n const components = oas.getDefinition().components\n\n let schemas: Record<string, OasTypes.SchemaObject> = {}\n\n if (includes.includes('schemas')) {\n schemas = {\n ...schemas,\n ...((components?.schemas as Record<string, OasTypes.SchemaObject>) || {}),\n }\n }\n\n const requestBodies = components?.requestBodies || {}\n if (includes.includes('responses')) {\n const responses = components?.responses || {}\n\n Object.entries(responses).forEach(([name, response]: [string, OasTypes.ResponseObject]) => {\n if (response.content && !schemas[name]) {\n const firstContentType = Object.keys(response.content)[0] || 'application/json'\n schemas[name] = response.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n if (includes.includes('requestBodies')) {\n Object.entries(requestBodies).forEach(([name, request]: [string, OasTypes.RequestBodyObject]) => {\n if (request.content && !schemas[name]) {\n const firstContentType = Object.keys(request.content)[0] || 'application/json'\n schemas[name] = request.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n return schemas\n}\n","import { isOpenApiV3_1Document } from '@kubb/oas'\n\nimport type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'\n\n/**\n * Make it possible to narrow down the schema based on a specific version(3 or 3.1)\n */\ntype SchemaResult<TWithRef extends boolean = false> =\n | {\n schema?: (TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.0'\n }\n | {\n schema?: (TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.1'\n }\n\nexport function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef> {\n return (schema?: SchemaObject) => {\n const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'\n\n return {\n schema,\n version,\n } as SchemaResult<TWithRef>\n }\n}\n"]}
|
|
File without changes
|
|
File without changes
|