@kubb/plugin-oas 3.8.0 → 3.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/{OperationGenerator-DkfVl11s.d.cts → OperationGenerator-DiF6WJNP.d.cts} +10 -6
- package/dist/{OperationGenerator-DkfVl11s.d.ts → OperationGenerator-DiF6WJNP.d.ts} +10 -6
- package/dist/{Schema-BJcs_y8u.d.ts → Schema-BbIxCfn7.d.ts} +1 -1
- package/dist/{Schema-B2XBcTNh.d.cts → Schema-Ds5f4y7m.d.cts} +1 -1
- package/dist/{chunk-TKFFW62C.cjs → chunk-DEDONPUL.cjs} +14 -7
- package/dist/chunk-DEDONPUL.cjs.map +1 -0
- package/dist/{chunk-EMSV6TX2.js → chunk-DN373TFU.js} +8 -4
- package/dist/chunk-DN373TFU.js.map +1 -0
- package/dist/{chunk-FNXIO7AH.cjs → chunk-DUZZHEQI.cjs} +9 -5
- package/dist/chunk-DUZZHEQI.cjs.map +1 -0
- package/dist/{chunk-HSTP26AO.cjs → chunk-I2LBG5AS.cjs} +27 -37
- package/dist/chunk-I2LBG5AS.cjs.map +1 -0
- package/dist/{chunk-3DX5ALTN.js → chunk-QPFZUPQA.js} +16 -8
- package/dist/chunk-QPFZUPQA.js.map +1 -0
- package/dist/{chunk-Z2353AWG.js → chunk-VJ6RX6RF.js} +28 -38
- package/dist/chunk-VJ6RX6RF.js.map +1 -0
- package/dist/components.d.cts +2 -2
- package/dist/components.d.ts +2 -2
- package/dist/generators.cjs +3 -3
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/hooks.cjs +2 -2
- package/dist/hooks.d.cts +2 -2
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +1 -1
- package/dist/index.cjs +12 -12
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/utils.cjs +7 -11
- package/dist/utils.d.cts +4 -12
- package/dist/utils.d.ts +4 -12
- package/dist/utils.js +1 -1
- package/package.json +9 -9
- package/src/SchemaGenerator.ts +26 -46
- package/src/SchemaMapper.ts +6 -2
- package/src/generators/jsonGenerator.ts +5 -1
- package/src/utils/getBanner.ts +13 -5
- package/src/utils/index.ts +1 -1
- package/dist/chunk-3DX5ALTN.js.map +0 -1
- package/dist/chunk-EMSV6TX2.js.map +0 -1
- package/dist/chunk-FNXIO7AH.cjs.map +0 -1
- package/dist/chunk-HSTP26AO.cjs.map +0 -1
- package/dist/chunk-TKFFW62C.cjs.map +0 -1
- package/dist/chunk-Z2353AWG.js.map +0 -1
|
@@ -14,9 +14,6 @@ type SchemaKeywordMapper = {
|
|
|
14
14
|
strict?: boolean;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
strict: {
|
|
18
|
-
keyword: 'strict';
|
|
19
|
-
};
|
|
20
17
|
url: {
|
|
21
18
|
keyword: 'url';
|
|
22
19
|
};
|
|
@@ -204,10 +201,12 @@ type SchemaKeywordMapper = {
|
|
|
204
201
|
catchall: {
|
|
205
202
|
keyword: 'catchall';
|
|
206
203
|
};
|
|
204
|
+
interface: {
|
|
205
|
+
keyword: 'interface';
|
|
206
|
+
};
|
|
207
207
|
};
|
|
208
208
|
declare const schemaKeywords: {
|
|
209
209
|
any: "any";
|
|
210
|
-
strict: "strict";
|
|
211
210
|
unknown: "unknown";
|
|
212
211
|
number: "number";
|
|
213
212
|
integer: "integer";
|
|
@@ -250,6 +249,7 @@ declare const schemaKeywords: {
|
|
|
250
249
|
catchall: "catchall";
|
|
251
250
|
time: "time";
|
|
252
251
|
name: "name";
|
|
252
|
+
interface: "interface";
|
|
253
253
|
};
|
|
254
254
|
type SchemaKeyword = keyof SchemaKeywordMapper;
|
|
255
255
|
type SchemaMapper<T = string | null | undefined> = {
|
|
@@ -266,6 +266,10 @@ type SchemaTree = {
|
|
|
266
266
|
parent: Schema | undefined;
|
|
267
267
|
current: Schema;
|
|
268
268
|
siblings: Schema[];
|
|
269
|
+
/**
|
|
270
|
+
* this will be equal to the key of a property(object)
|
|
271
|
+
*/
|
|
272
|
+
name?: string;
|
|
269
273
|
};
|
|
270
274
|
declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
|
|
271
275
|
|
|
@@ -463,9 +467,9 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
463
467
|
* optionally adds a union with null.
|
|
464
468
|
*/
|
|
465
469
|
parse(props: SchemaProps$1): Schema[];
|
|
466
|
-
deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T]
|
|
470
|
+
deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
467
471
|
find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
468
|
-
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T]
|
|
472
|
+
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
469
473
|
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
470
474
|
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
471
475
|
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
@@ -14,9 +14,6 @@ type SchemaKeywordMapper = {
|
|
|
14
14
|
strict?: boolean;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
strict: {
|
|
18
|
-
keyword: 'strict';
|
|
19
|
-
};
|
|
20
17
|
url: {
|
|
21
18
|
keyword: 'url';
|
|
22
19
|
};
|
|
@@ -204,10 +201,12 @@ type SchemaKeywordMapper = {
|
|
|
204
201
|
catchall: {
|
|
205
202
|
keyword: 'catchall';
|
|
206
203
|
};
|
|
204
|
+
interface: {
|
|
205
|
+
keyword: 'interface';
|
|
206
|
+
};
|
|
207
207
|
};
|
|
208
208
|
declare const schemaKeywords: {
|
|
209
209
|
any: "any";
|
|
210
|
-
strict: "strict";
|
|
211
210
|
unknown: "unknown";
|
|
212
211
|
number: "number";
|
|
213
212
|
integer: "integer";
|
|
@@ -250,6 +249,7 @@ declare const schemaKeywords: {
|
|
|
250
249
|
catchall: "catchall";
|
|
251
250
|
time: "time";
|
|
252
251
|
name: "name";
|
|
252
|
+
interface: "interface";
|
|
253
253
|
};
|
|
254
254
|
type SchemaKeyword = keyof SchemaKeywordMapper;
|
|
255
255
|
type SchemaMapper<T = string | null | undefined> = {
|
|
@@ -266,6 +266,10 @@ type SchemaTree = {
|
|
|
266
266
|
parent: Schema | undefined;
|
|
267
267
|
current: Schema;
|
|
268
268
|
siblings: Schema[];
|
|
269
|
+
/**
|
|
270
|
+
* this will be equal to the key of a property(object)
|
|
271
|
+
*/
|
|
272
|
+
name?: string;
|
|
269
273
|
};
|
|
270
274
|
declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
|
|
271
275
|
|
|
@@ -463,9 +467,9 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
463
467
|
* optionally adds a union with null.
|
|
464
468
|
*/
|
|
465
469
|
parse(props: SchemaProps$1): Schema[];
|
|
466
|
-
deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T]
|
|
470
|
+
deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
467
471
|
find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
468
|
-
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T]
|
|
472
|
+
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
469
473
|
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
470
474
|
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
471
475
|
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { SchemaObject } from '@kubb/oas';
|
|
3
3
|
import { Key, KubbNode } from '@kubb/react/types';
|
|
4
|
-
import { f as Schema$1 } from './OperationGenerator-
|
|
4
|
+
import { f as Schema$1 } from './OperationGenerator-DiF6WJNP.js';
|
|
5
5
|
|
|
6
6
|
type SchemaContextProps = {
|
|
7
7
|
name: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { SchemaObject } from '@kubb/oas';
|
|
3
3
|
import { Key, KubbNode } from '@kubb/react/types';
|
|
4
|
-
import { f as Schema$1 } from './OperationGenerator-
|
|
4
|
+
import { f as Schema$1 } from './OperationGenerator-DiF6WJNP.cjs';
|
|
5
5
|
|
|
6
6
|
type SchemaContextProps = {
|
|
7
7
|
name: string;
|
|
@@ -5,6 +5,7 @@ var utils = require('@kubb/core/utils');
|
|
|
5
5
|
var oas = require('@kubb/oas');
|
|
6
6
|
var path = require('path');
|
|
7
7
|
var yaml = require('@stoplight/yaml');
|
|
8
|
+
var core = require('@kubb/core');
|
|
8
9
|
var remeda = require('remeda');
|
|
9
10
|
|
|
10
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -74,14 +75,21 @@ function parseFromConfig(config, oasClass = oas.Oas) {
|
|
|
74
75
|
}
|
|
75
76
|
return oas.parse(path.resolve(config.root, config.input.path), oasClass);
|
|
76
77
|
}
|
|
77
|
-
function getBanner({ output, oas }) {
|
|
78
|
+
function getBanner({ output, oas, config }) {
|
|
79
|
+
let banner = "";
|
|
80
|
+
if (config?.output?.defaultBanner !== false && config) {
|
|
81
|
+
const { title, description, version } = oas.api?.info || {};
|
|
82
|
+
banner = core.getDefaultBanner({ title, description, version, config });
|
|
83
|
+
}
|
|
78
84
|
if (!output.banner) {
|
|
79
|
-
return
|
|
85
|
+
return banner;
|
|
80
86
|
}
|
|
81
87
|
if (remeda.isFunction(output.banner)) {
|
|
82
|
-
return output.banner(oas)
|
|
88
|
+
return `${output.banner(oas)}
|
|
89
|
+
${banner}`;
|
|
83
90
|
}
|
|
84
|
-
return output.banner
|
|
91
|
+
return `${output.banner}
|
|
92
|
+
${banner}`;
|
|
85
93
|
}
|
|
86
94
|
function getFooter({ output, oas }) {
|
|
87
95
|
if (!output.footer) {
|
|
@@ -97,11 +105,10 @@ Object.defineProperty(exports, "isOptional", {
|
|
|
97
105
|
enumerable: true,
|
|
98
106
|
get: function () { return oas.isOptional; }
|
|
99
107
|
});
|
|
100
|
-
exports.getASTParams = getASTParams;
|
|
101
108
|
exports.getBanner = getBanner;
|
|
102
109
|
exports.getComments = getComments;
|
|
103
110
|
exports.getFooter = getFooter;
|
|
104
111
|
exports.getPathParams = getPathParams;
|
|
105
112
|
exports.parseFromConfig = parseFromConfig;
|
|
106
|
-
//# sourceMappingURL=chunk-
|
|
107
|
-
//# sourceMappingURL=chunk-
|
|
113
|
+
//# sourceMappingURL=chunk-DEDONPUL.cjs.map
|
|
114
|
+
//# sourceMappingURL=chunk-DEDONPUL.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/getComments.ts","../src/utils/getParams.ts","../src/utils/parseFromConfig.ts","../src/utils/getBanner.ts","../src/utils/getFooter.ts"],"names":["URLPath","transformers","isParameterObject","isValidVarName","camelCase","Oas","api","parse","yaml","resolve","getDefaultBanner","isFunction"],"mappings":";;;;;;;;;;;;;;;;AAKO,SAAS,YAAY,SAAgC,EAAA;AAC1D,EAAO,OAAA;AAAA,IACL,UAAU,cAAe,EAAA,IAAK,CAAgB,aAAA,EAAA,SAAA,CAAU,gBAAgB,CAAA,CAAA;AAAA,IACxE,UAAU,UAAW,EAAA,IAAK,CAAY,SAAA,EAAA,SAAA,CAAU,YAAY,CAAA,CAAA;AAAA,IAC5D,SAAA,CAAU,QAAQ,CAAU,OAAA,EAAA,IAAIA,cAAQ,SAAU,CAAA,IAAI,EAAE,GAAG,CAAA,CAAA,CAAA;AAAA,IAC3D,SAAA,CAAU,cAAkB,IAAA;AAAA,GAC9B,CACG,MAAO,CAAA,OAAO,CACd,CAAA,GAAA,CAAI,CAAC,IAAS,KAAAC,6BAAA,CAAa,IAAK,CAAA,IAAI,CAAC,CAAA;AAC1C;ACFO,SAAS,aACd,eACA,EAAA;AAAA,EACE,KAAQ,GAAA,KAAA;AAAA,EACR;AACF,CAAA,GAGI,EACiB,EAAA;AACrB,EAAI,IAAA,CAAC,mBAAmB,CAAC,eAAA,CAAgB,OAAO,UAAc,IAAA,CAAC,gBAAgB,IAAM,EAAA;AACnF,IAAA,OAAO,EAAC;AAAA;AAGV,EAAO,OAAA,MAAA,CAAO,OAAQ,CAAA,eAAA,CAAgB,MAAO,CAAA,UAAU,CAAE,CAAA,GAAA,CAAI,CAAC,CAAC,IAAM,EAAA,MAAM,CAAuC,KAAA;AAChH,IAAM,MAAA,OAAA,GAAUC,sBAAkB,MAAM,CAAA;AACxC,IAAA,MAAM,IAA0B,GAAA;AAAA,MAC9B,IAAA;AAAA,MACA,OAAA,EAAS,CAAC,CAAC,IAAA;AAAA,MACX,QAAA,EAAU,OAAU,GAAA,MAAA,CAAO,QAAW,GAAA,IA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AA,EAAK,MAAM,CAAA,CAAA;AAAA;AAGzC,EAAO,OAAA,CAAA,EAAG,OAAO,MAAM;AAAA,EAAK,MAAM,CAAA,CAAA;AACpC;AClBO,SAAS,SAAU,CAAA,EAAE,MAAQ,EAAA,GAAA,EAAc,EAAA;AAChD,EAAI,IAAA,CAAC,OAAO,MAAQ,EAAA;AAClB,IAAO,OAAA,MAAA;AAAA;AAGT,EAAIA,IAAAA,iBAAAA,CAAW,MAAO,CAAA,MAAM,CAAG,EAAA;AAC7B,IAAO,OAAA,MAAA,CAAO,OAAO,GAAG,CAAA;AAAA;AAG1B,EAAA,OAAO,MAAO,CAAA,MAAA;AAChB","file":"chunk-DEDONPUL.cjs","sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { URLPath } from '@kubb/core/utils'\n\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `{@link ${new URLPath(operation.path).URL}}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter(Boolean)\n .map((text) => transformers.trim(text))\n}\n","import { isParameterObject } from '@kubb/oas'\n\nimport { camelCase, isValidVarName } from '@kubb/core/transformers'\nimport type { FunctionParamsAST } from '@kubb/core/utils'\nimport type { OasTypes } from '@kubb/oas'\nimport type { Params } from '@kubb/react/types'\nimport type { OperationSchema } from '../types.ts'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n override,\n }: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) {\n return []\n }\n\n return Object.entries(operationSchema.schema.properties).map(([name, schema]: [string, OasTypes.SchemaObject]) => {\n const isParam = isParameterObject(schema)\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: isParam ? schema.required : true,\n type: typed ? `${operationSchema.name}[\"${name}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n casing?: 'camelcase'\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n let name = isValidVarName(curr.name) ? curr.name : camelCase(curr.name)\n\n if (options.casing === 'camelcase') {\n name = camelCase(name)\n }\n\n acc[name] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n","import { resolve } from 'node:path'\n\nimport { URLPath } from '@kubb/core/utils'\n\nimport { parse } from '@kubb/oas'\n\nimport type { Config } from '@kubb/core'\nimport { Oas, type OasTypes } from '@kubb/oas'\nimport yaml from '@stoplight/yaml'\n\nexport function parseFromConfig(config: Config, oasClass: typeof Oas = Oas): Promise<Oas> {\n if ('data' in config.input) {\n if (typeof config.input.data === 'object') {\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n return parse(api, oasClass)\n }\n\n try {\n const api: string = yaml.parse(config.input.data as string) as string\n\n return parse(api, oasClass)\n } catch (e) {\n /* empty */\n }\n\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n\n return parse(api, oasClass)\n }\n\n if (new URLPath(config.input.path).isURL) {\n return parse(config.input.path, oasClass)\n }\n\n return parse(resolve(config.root, config.input.path), oasClass)\n}\n","import { getDefaultBanner, type Config, type Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props = {\n oas: Oas\n output: Output<Oas>\n config?: Config\n}\n\nexport function getBanner({ output, oas, config }: Props) {\n let banner = ''\n if (config?.output?.defaultBanner !== false && config) {\n const { title, description, version } = oas.api?.info || {}\n\n banner = getDefaultBanner({ title, description, version, config })\n }\n\n if (!output.banner) {\n return banner\n }\n\n if (isFunction(output.banner)) {\n return `${output.banner(oas)}\\n${banner}`\n }\n\n return `${output.banner}\\n${banner}`\n}\n","import type { Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props = {\n oas: Oas\n output: Output<Oas>\n}\n\nexport function getFooter({ output, oas }: Props) {\n if (!output.footer) {\n return undefined\n }\n\n if (isFunction(output.footer)) {\n return output.footer(oas)\n }\n\n return output.footer\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getFooter, getBanner } from './chunk-
|
|
1
|
+
import { getFooter, getBanner } from './chunk-QPFZUPQA.js';
|
|
2
2
|
import { Oas } from './chunk-BAU7PO7T.js';
|
|
3
3
|
import { camelCase } from '@kubb/core/transformers';
|
|
4
4
|
import { createRoot, App } from '@kubb/react';
|
|
@@ -77,7 +77,11 @@ var jsonGenerator = createGenerator({
|
|
|
77
77
|
value: JSON.stringify(schema.value)
|
|
78
78
|
}
|
|
79
79
|
],
|
|
80
|
-
banner: getBanner({
|
|
80
|
+
banner: getBanner({
|
|
81
|
+
oas: instance.context.oas,
|
|
82
|
+
output: plugin.options.output,
|
|
83
|
+
config: pluginManager.config
|
|
84
|
+
}),
|
|
81
85
|
format: getFooter({ oas: instance.context.oas, output: plugin.options.output })
|
|
82
86
|
}
|
|
83
87
|
];
|
|
@@ -85,5 +89,5 @@ var jsonGenerator = createGenerator({
|
|
|
85
89
|
});
|
|
86
90
|
|
|
87
91
|
export { createGenerator, createReactGenerator, jsonGenerator };
|
|
88
|
-
//# sourceMappingURL=chunk-
|
|
89
|
-
//# sourceMappingURL=chunk-
|
|
92
|
+
//# sourceMappingURL=chunk-DN373TFU.js.map
|
|
93
|
+
//# sourceMappingURL=chunk-DN373TFU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/generator.tsx","../src/generators/jsonGenerator.ts"],"names":[],"mappings":";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MAAA,EAAQ;AAAA;AAChF,KACF;AAAA;AAEJ,CAAC","file":"chunk-DN373TFU.js","sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\nimport type { Schema } from './SchemaMapper.ts'\nimport type { OperationsByMethod } from './types.ts'\n\ntype OperationsProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operations: Array<Operation>\n operationsByMethod: OperationsByMethod\n}\n\ntype OperationProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operation: Operation\n}\n\ntype SchemaProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n schema: {\n name: string\n tree: Array<Schema>\n value: SchemaObject\n }\n}\n\nexport type GeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions> {\n return parseOptions\n}\n\nexport type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (this: ReactGeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => KubbNode\n Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode\n Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode\n}\n\nexport function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions> {\n return {\n ...parseOptions,\n async operations({ instance, options, operations, operationsByMethod }) {\n if (!parseOptions.Operations) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Operations.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={instance}>\n <Component operations={operations} instance={instance} operationsByMethod={operationsByMethod} options={options} />\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async operation({ instance, operation, options }) {\n if (!parseOptions.Operation) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Operation.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={instance}>\n <Oas.Operation operation={operation}>\n <Component operation={operation} options={options} instance={instance} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async schema({ instance, schema, options }) {\n if (!parseOptions.Schema) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Schema.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={schema.name} value={schema.value} tree={schema.tree}>\n <Component schema={schema} options={options} instance={instance} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n }\n}\n","import { camelCase } from '@kubb/core/transformers'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { createGenerator } from '../generator.tsx'\nimport type { PluginOas } from '../types.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, instance }) {\n const { pluginManager, plugin } = instance.context\n const file = pluginManager.getFile({\n name: camelCase(schema.name),\n extname: '.json',\n mode: 'split',\n pluginKey: plugin.key,\n })\n\n return [\n {\n ...file,\n sources: [\n {\n name: camelCase(schema.name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema.value),\n },\n ],\n banner: getBanner({\n oas: instance.context.oas,\n output: plugin.options.output,\n config: pluginManager.config,\n }),\n format: getFooter({ oas: instance.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkDEDONPUL_cjs = require('./chunk-DEDONPUL.cjs');
|
|
4
4
|
var chunkKXB5DUFD_cjs = require('./chunk-KXB5DUFD.cjs');
|
|
5
5
|
var transformers = require('@kubb/core/transformers');
|
|
6
6
|
var react = require('@kubb/react');
|
|
@@ -79,8 +79,12 @@ var jsonGenerator = createGenerator({
|
|
|
79
79
|
value: JSON.stringify(schema.value)
|
|
80
80
|
}
|
|
81
81
|
],
|
|
82
|
-
banner:
|
|
83
|
-
|
|
82
|
+
banner: chunkDEDONPUL_cjs.getBanner({
|
|
83
|
+
oas: instance.context.oas,
|
|
84
|
+
output: plugin.options.output,
|
|
85
|
+
config: pluginManager.config
|
|
86
|
+
}),
|
|
87
|
+
format: chunkDEDONPUL_cjs.getFooter({ oas: instance.context.oas, output: plugin.options.output })
|
|
84
88
|
}
|
|
85
89
|
];
|
|
86
90
|
}
|
|
@@ -89,5 +93,5 @@ var jsonGenerator = createGenerator({
|
|
|
89
93
|
exports.createGenerator = createGenerator;
|
|
90
94
|
exports.createReactGenerator = createReactGenerator;
|
|
91
95
|
exports.jsonGenerator = jsonGenerator;
|
|
92
|
-
//# sourceMappingURL=chunk-
|
|
93
|
-
//# sourceMappingURL=chunk-
|
|
96
|
+
//# sourceMappingURL=chunk-DUZZHEQI.cjs.map
|
|
97
|
+
//# sourceMappingURL=chunk-DUZZHEQI.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/generator.tsx","../src/generators/jsonGenerator.ts"],"names":["createRoot","App","jsx","Oas","camelCase","getBanner","getFooter"],"mappings":";;;;;;;;AA2CO,SAAS,gBAAuD,YAA+D,EAAA;AACpI,EAAO,OAAA,YAAA;AACT;AASO,SAAS,qBAA4D,YAAoE,EAAA;AAC9I,EAAO,OAAA;AAAA,IACL,GAAG,YAAA;AAAA,IACH,MAAM,UAAW,CAAA,EAAE,UAAU,OAAS,EAAA,UAAA,EAAY,oBAAsB,EAAA;AACtE,MAAI,IAAA,CAAC,aAAa,UAAY,EAAA;AAC5B,QAAA,OAAO,EAAC;AAAA;AAGV,MAAA,MAAM,EAAE,aAAe,EAAA,GAAA,EAAK,MAAQ,EAAA,IAAA,KAAS,QAAS,CAAA,OAAA;AACtD,MAAA,MAAM,OAAOA,gBAAW,CAAA;AAAA,QACtB,QAAQ,aAAc,CAAA;AAAA,OACvB,CAAA;AAED,MAAA,MAAM,SAAY,GAAA,YAAA,CAAa,UAAW,CAAA,IAAA,CAAK,IAAI,CAAA;AAEnD,MAAK,IAAA,CAAA,MAAA;AAAA,uCACFC,SAAI,EAAA,EAAA,aAAA,EAA8B,QAAgB,IACjD,EAAA,QAAA,kBAAAC,cAAA,CAACC,yBAAI,GAAU,EAAA,UAAA,EAAwB,SAAW,EAAA,QAAA,EAChD,yCAAC,SAAU,EAAA,EAAA,UAAA,EAAwB,UAAoB,kBAAwC,EAAA,OAAA,EAAkB,GACnH,CACF,EAAA;AAAA,OACF;AAEA,MAAA,OAAO,IAAK,CAAA,KAAA;AAAA,KACd;AAAA,IACA,MAAM,SAAU,CA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AK,SAAU,CAAA,MAAA,CAAO,KAAK;AAAA;AACpC,SACF;AAAA,QACA,QAAQC,2BAAU,CAAA;AAAA,UAChB,GAAA,EAAK,SAAS,OAAQ,CAAA,GAAA;AAAA,UACtB,MAAA,EAAQ,OAAO,OAAQ,CAAA,MAAA;AAAA,UACvB,QAAQ,aAAc,CAAA;AAAA,SACvB,CAAA;AAAA,QACD,MAAA,EAAQC,2BAAU,CAAA,EAAE,GAAK,EAAA,QAAA,CAAS,OAAQ,CAAA,GAAA,EAAK,MAAQ,EAAA,MAAA,CAAO,OAAQ,CAAA,MAAA,EAAQ;AAAA;AAChF,KACF;AAAA;AAEJ,CAAC","file":"chunk-DUZZHEQI.cjs","sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\nimport type { Schema } from './SchemaMapper.ts'\nimport type { OperationsByMethod } from './types.ts'\n\ntype OperationsProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operations: Array<Operation>\n operationsByMethod: OperationsByMethod\n}\n\ntype OperationProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operation: Operation\n}\n\ntype SchemaProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n schema: {\n name: string\n tree: Array<Schema>\n value: SchemaObject\n }\n}\n\nexport type GeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions> {\n return parseOptions\n}\n\nexport type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (this: ReactGeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => KubbNode\n Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode\n Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode\n}\n\nexport function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions> {\n return {\n ...parseOptions,\n async operations({ instance, options, operations, operationsByMethod }) {\n if (!parseOptions.Operations) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Operations.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={instance}>\n <Component operations={operations} instance={instance} operationsByMethod={operationsByMethod} options={options} />\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async operation({ instance, operation, options }) {\n if (!parseOptions.Operation) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Operation.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={instance}>\n <Oas.Operation operation={operation}>\n <Component operation={operation} options={options} instance={instance} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async schema({ instance, schema, options }) {\n if (!parseOptions.Schema) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Schema.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={schema.name} value={schema.value} tree={schema.tree}>\n <Component schema={schema} options={options} instance={instance} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n }\n}\n","import { camelCase } from '@kubb/core/transformers'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { createGenerator } from '../generator.tsx'\nimport type { PluginOas } from '../types.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, instance }) {\n const { pluginManager, plugin } = instance.context\n const file = pluginManager.getFile({\n name: camelCase(schema.name),\n extname: '.json',\n mode: 'split',\n pluginKey: plugin.key,\n })\n\n return [\n {\n ...file,\n sources: [\n {\n name: camelCase(schema.name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema.value),\n },\n ],\n banner: getBanner({\n oas: instance.context.oas,\n output: plugin.options.output,\n config: pluginManager.config,\n }),\n format: getFooter({ oas: instance.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"]}
|
|
@@ -14,7 +14,6 @@ var transformers__default = /*#__PURE__*/_interopDefault(transformers);
|
|
|
14
14
|
// src/SchemaMapper.ts
|
|
15
15
|
var schemaKeywords = {
|
|
16
16
|
any: "any",
|
|
17
|
-
strict: "strict",
|
|
18
17
|
unknown: "unknown",
|
|
19
18
|
number: "number",
|
|
20
19
|
integer: "integer",
|
|
@@ -58,7 +57,8 @@ var schemaKeywords = {
|
|
|
58
57
|
schema: "schema",
|
|
59
58
|
catchall: "catchall",
|
|
60
59
|
time: "time",
|
|
61
|
-
name: "name"
|
|
60
|
+
name: "name",
|
|
61
|
+
interface: "interface"
|
|
62
62
|
};
|
|
63
63
|
function isKeyword(meta, keyword) {
|
|
64
64
|
return meta.keyword === keyword;
|
|
@@ -91,36 +91,31 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
|
|
|
91
91
|
if (schema.keyword === keyword) {
|
|
92
92
|
foundItems.push(schema);
|
|
93
93
|
}
|
|
94
|
-
if (schema
|
|
95
|
-
|
|
96
|
-
Object.values(subItem.args?.properties || {}).forEach((entrySchema) => {
|
|
94
|
+
if (isKeyword(schema, schemaKeywords.object)) {
|
|
95
|
+
Object.values(schema.args?.properties || {}).forEach((entrySchema) => {
|
|
97
96
|
foundItems.push(..._SchemaGenerator.deepSearch(entrySchema, keyword));
|
|
98
97
|
});
|
|
99
|
-
Object.values(
|
|
98
|
+
Object.values(schema.args?.additionalProperties || {}).forEach((entrySchema) => {
|
|
100
99
|
foundItems.push(..._SchemaGenerator.deepSearch([entrySchema], keyword));
|
|
101
100
|
});
|
|
102
101
|
}
|
|
103
|
-
if (schema
|
|
104
|
-
|
|
105
|
-
subItem.args.items.forEach((entrySchema) => {
|
|
102
|
+
if (isKeyword(schema, schemaKeywords.array)) {
|
|
103
|
+
schema.args.items.forEach((entrySchema) => {
|
|
106
104
|
foundItems.push(..._SchemaGenerator.deepSearch([entrySchema], keyword));
|
|
107
105
|
});
|
|
108
106
|
}
|
|
109
|
-
if (schema
|
|
110
|
-
|
|
111
|
-
subItem.args.forEach((entrySchema) => {
|
|
107
|
+
if (isKeyword(schema, schemaKeywords.and)) {
|
|
108
|
+
schema.args.forEach((entrySchema) => {
|
|
112
109
|
foundItems.push(..._SchemaGenerator.deepSearch([entrySchema], keyword));
|
|
113
110
|
});
|
|
114
111
|
}
|
|
115
|
-
if (schema
|
|
116
|
-
|
|
117
|
-
subItem.args.items.forEach((entrySchema) => {
|
|
112
|
+
if (isKeyword(schema, schemaKeywords.tuple)) {
|
|
113
|
+
schema.args.items.forEach((entrySchema) => {
|
|
118
114
|
foundItems.push(..._SchemaGenerator.deepSearch([entrySchema], keyword));
|
|
119
115
|
});
|
|
120
116
|
}
|
|
121
|
-
if (schema
|
|
122
|
-
|
|
123
|
-
subItem.args.forEach((entrySchema) => {
|
|
117
|
+
if (isKeyword(schema, schemaKeywords.union)) {
|
|
118
|
+
schema.args.forEach((entrySchema) => {
|
|
124
119
|
foundItems.push(..._SchemaGenerator.deepSearch([entrySchema], keyword));
|
|
125
120
|
});
|
|
126
121
|
}
|
|
@@ -133,14 +128,13 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
|
|
|
133
128
|
if (!foundItem && schema.keyword === keyword) {
|
|
134
129
|
foundItem = schema;
|
|
135
130
|
}
|
|
136
|
-
if (schema
|
|
137
|
-
|
|
138
|
-
Object.values(subItem.args?.properties || {}).forEach((entrySchema) => {
|
|
131
|
+
if (isKeyword(schema, schemaKeywords.object)) {
|
|
132
|
+
Object.values(schema.args?.properties || {}).forEach((entrySchema) => {
|
|
139
133
|
if (!foundItem) {
|
|
140
134
|
foundItem = _SchemaGenerator.find(entrySchema, keyword);
|
|
141
135
|
}
|
|
142
136
|
});
|
|
143
|
-
Object.values(
|
|
137
|
+
Object.values(schema.args?.additionalProperties || {}).forEach((entrySchema) => {
|
|
144
138
|
if (!foundItem) {
|
|
145
139
|
foundItem = _SchemaGenerator.find([entrySchema], keyword);
|
|
146
140
|
}
|
|
@@ -155,33 +149,29 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
|
|
|
155
149
|
if (!foundItem && schema.keyword === keyword) {
|
|
156
150
|
foundItem = schema;
|
|
157
151
|
}
|
|
158
|
-
if (schema
|
|
159
|
-
|
|
160
|
-
subItem.args.items.forEach((entrySchema) => {
|
|
152
|
+
if (isKeyword(schema, schemaKeywords.array)) {
|
|
153
|
+
schema.args.items.forEach((entrySchema) => {
|
|
161
154
|
if (!foundItem) {
|
|
162
155
|
foundItem = _SchemaGenerator.find([entrySchema], keyword);
|
|
163
156
|
}
|
|
164
157
|
});
|
|
165
158
|
}
|
|
166
|
-
if (schema
|
|
167
|
-
|
|
168
|
-
subItem.args.forEach((entrySchema) => {
|
|
159
|
+
if (isKeyword(schema, schemaKeywords.and)) {
|
|
160
|
+
schema.args.forEach((entrySchema) => {
|
|
169
161
|
if (!foundItem) {
|
|
170
162
|
foundItem = _SchemaGenerator.find([entrySchema], keyword);
|
|
171
163
|
}
|
|
172
164
|
});
|
|
173
165
|
}
|
|
174
|
-
if (schema
|
|
175
|
-
|
|
176
|
-
subItem.args.items.forEach((entrySchema) => {
|
|
166
|
+
if (isKeyword(schema, schemaKeywords.tuple)) {
|
|
167
|
+
schema.args.items.forEach((entrySchema) => {
|
|
177
168
|
if (!foundItem) {
|
|
178
169
|
foundItem = _SchemaGenerator.find([entrySchema], keyword);
|
|
179
170
|
}
|
|
180
171
|
});
|
|
181
172
|
}
|
|
182
|
-
if (schema
|
|
183
|
-
|
|
184
|
-
subItem.args.forEach((entrySchema) => {
|
|
173
|
+
if (isKeyword(schema, schemaKeywords.union)) {
|
|
174
|
+
schema.args.forEach((entrySchema) => {
|
|
185
175
|
if (!foundItem) {
|
|
186
176
|
foundItem = _SchemaGenerator.find([entrySchema], keyword);
|
|
187
177
|
}
|
|
@@ -324,7 +314,7 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
|
|
|
324
314
|
];
|
|
325
315
|
const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? void 0;
|
|
326
316
|
const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? void 0;
|
|
327
|
-
const nullable =
|
|
317
|
+
const nullable = oas.isNullable(schema);
|
|
328
318
|
const defaultNullAndNullable = schema.default === null && nullable;
|
|
329
319
|
if (schema.default !== void 0 && !defaultNullAndNullable && !Array.isArray(schema.default)) {
|
|
330
320
|
if (typeof schema.default === "string") {
|
|
@@ -779,5 +769,5 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
|
|
|
779
769
|
exports.SchemaGenerator = SchemaGenerator;
|
|
780
770
|
exports.isKeyword = isKeyword;
|
|
781
771
|
exports.schemaKeywords = schemaKeywords;
|
|
782
|
-
//# sourceMappingURL=chunk-
|
|
783
|
-
//# sourceMappingURL=chunk-
|
|
772
|
+
//# sourceMappingURL=chunk-I2LBG5AS.cjs.map
|
|
773
|
+
//# sourceMappingURL=chunk-I2LBG5AS.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/SchemaMapper.ts","../src/SchemaGenerator.ts"],"names":["BaseGenerator","uniqueWith","isDeepEqual","getUniqueName","getSchemaFactory","isNullable","transformers","_schema","nullable","isReference","schema","pascalCase","name","isNumber","min","max","getSchemas"],"mappings":";;;;;;;;;;;;;;AA4FO,IAAM,cAAiB,GAAA;AAAA,EAC5B,GAAK,EAAA,KAAA;AAAA,EACL,OAAS,EAAA,SAAA;AAAA,EACT,MAAQ,EAAA,QAAA;AAAA,EACR,OAAS,EAAA,SAAA;AAAA,EACT,MAAQ,EAAA,QAAA;AAAA,EACR,OAAS,EAAA,SAAA;AAAA,EACT,SAAW,EAAA,WAAA;AAAA,EACX,QAAU,EAAA,UAAA;AAAA,EACV,IAAM,EAAA,MAAA;AAAA,EACN,OAAS,EAAA,SAAA;AAAA,EACT,KAAO,EAAA,OAAA;AAAA,EACP,KAAO,EAAA,OAAA;AAAA,EACP,IAAM,EAAA,MAAA;AAAA,EACN,KAAO,EAAA,OAAA;AAAA,EACP,QAAU,EAAA,UAAA;AAAA,EACV,IAAM,EAAA,MAAA;AAAA,EACN,KAAO,EAAA,OAAA;AAAA,EACP,IAAM,EAAA,MAAA;AAAA,EACN,GAAK,EAAA,KAAA;AAAA,EACL,IAAM,EAAA,MAAA;AAAA;AAAA,EAEN,OAAS,EAAA,SAAA;AAAA,EACT,KAAO,EAAA,OAAA;AAAA,EACP,GAAK,EAAA,KAAA;AAAA,EACL,QAAU,EAAA,UAAA;AAAA,EACV,GAAK,EAAA,KAAA;AAAA,EACL,GAAK,EAAA,KAAA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,EAAA;AAAA,YACN,IAAA;AAAA,YACA,KAAA;AAAA,YACA;AAAA,WACF;AAAA,UACA,OAAS,EAAA;AAAA,YACP,GAAG,IAAK,CAAA,OAAA;AAAA,YACR,GAAG;AAAA;AACL,SACM,CAAA;AAER,QAAA,IAAI,OAAS,EAAA;AACX,UAAA,GAAA,CAAI,KAAK,OAAO,CAAA;AAAA;AAClB,OACD,CAAA;AAED,MAAO,OAAA,GAAA;AAAA,KACT,EAAG,EAAqC,CAAA;AAExC,IAAA,MAAM,KAAQ,GAAA,MAAM,OAAQ,CAAA,GAAA,CAAI,QAAQ,CAAA;AAGxC,IAAA,OAAO,KAAM,CAAA,IAAA,EAAO,CAAA,MAAA,CAAO,OAAO,CAAA;AAAA;AACpC;AAAA;AAAA;AAAA,EAKA,MAAM,MAAA,CAAO,KAAe,EAAA,OAAA,EAAuB,QAAmD,EAAA;AACpG,IAAA,OAAO,EAAC;AAAA;AAEZ","file":"chunk-I2LBG5AS.cjs","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 url: { keyword: 'url' }\n readOnly: { keyword: 'readOnly' }\n writeOnly: { keyword: 'writeOnly' }\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; unique?: boolean }\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' | 'boolean'\n value?: string | number | boolean\n }>\n }\n }\n and: { keyword: 'and'; args: Schema[] }\n const: {\n keyword: 'const'\n args: {\n name: string | number\n format: 'string' | 'number' | 'boolean'\n value?: string | number | boolean\n }\n }\n union: { keyword: 'union'; args: Schema[] }\n ref: {\n keyword: 'ref'\n args: {\n name: string\n /**\n * Full qualified path.\n */\n path: KubbFile.OptionalPath\n /**\n * When true `File.Import` will be used.\n * When false a reference will be used inside the current file.\n */\n isImportable: boolean\n }\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 void: { keyword: 'void' }\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 interface: { keyword: 'interface' }\n}\n\nexport const schemaKeywords = {\n any: 'any',\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 void: 'void',\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 writeOnly: 'writeOnly',\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 interface: 'interface',\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 type SchemaTree = {\n parent: Schema | undefined\n current: Schema\n siblings: Schema[]\n /**\n * this will be equal to the key of a property(object)\n */\n name?: string\n}\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 { BaseGenerator, type FileMetaBase } from '@kubb/core'\nimport transformers, { pascalCase } from '@kubb/core/transformers'\nimport { getUniqueName } from '@kubb/core/utils'\n\nimport { isNullable, 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 { Generator } from './generator.tsx'\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' | 'void'\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 class SchemaGenerator<\n TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions,\n TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n TFileMeta extends FileMetaBase = FileMetaBase,\n> extends BaseGenerator<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(schemas, isDeepEqual)\n }\n\n deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<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): Array<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 (isKeyword(schema, schemaKeywords.object)) {\n Object.values(schema.args?.properties || {}).forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>(entrySchema, keyword))\n })\n\n Object.values(schema.args?.additionalProperties || {}).forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (isKeyword(schema, schemaKeywords.array)) {\n schema.args.items.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (isKeyword(schema, schemaKeywords.and)) {\n schema.args.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (isKeyword(schema, schemaKeywords.tuple)) {\n schema.args.items.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (isKeyword(schema, schemaKeywords.union)) {\n schema.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 (isKeyword(schema, schemaKeywords.object)) {\n Object.values(schema.args?.properties || {}).forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>(entrySchema, keyword)\n }\n })\n\n Object.values(schema.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 (isKeyword(schema, schemaKeywords.array)) {\n schema.args.items.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (isKeyword(schema, schemaKeywords.and)) {\n schema.args.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (isKeyword(schema, schemaKeywords.tuple)) {\n schema.args.items.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (isKeyword(schema, schemaKeywords.union)) {\n schema.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 if (options.unknownType === 'void') {\n return schemaKeywords.void\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 || !Object.keys(additionalProperties).length\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, isImportable: !!this.context.oas.get($ref) },\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, isImportable: !!this.context.oas.get($ref) },\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 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 = isNullable(schema)\n const defaultNullAndNullable = schema.default === null && nullable\n\n if (schema.default !== undefined && !defaultNullAndNullable && !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 } else if (typeof schema.default === 'boolean') {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: schema.default ?? false,\n })\n } else {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: schema.default,\n })\n }\n }\n\n if (schema.deprecated) {\n baseItems.push({\n keyword: schemaKeywords.deprecated,\n })\n }\n\n if (schema.description) {\n baseItems.push({\n keyword: schemaKeywords.describe,\n args: schema.description,\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 (schema.writeOnly) {\n baseItems.push({ keyword: schemaKeywords.writeOnly })\n }\n\n if (isReference(schema)) {\n return [\n ...this.#getRefAlias(schema),\n nullable && { keyword: schemaKeywords.nullable },\n schema.readOnly && { keyword: schemaKeywords.readOnly },\n schema.writeOnly && { keyword: schemaKeywords.writeOnly },\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 const propertySchemas = this.parse({ schema: schemaWithoutOneOf, name, parentName })\n\n union.args = [\n ...union.args.map((arg) => {\n return {\n keyword: schemaKeywords.and,\n args: [arg, ...propertySchemas],\n }\n }),\n ]\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.required) {\n // TODO use of Required ts helper instead\n const schemas = schema.allOf\n .map((item) => {\n if (isReference(item)) {\n return this.context.oas.get(item.$ref) as SchemaObject\n }\n })\n .filter(Boolean)\n\n const items = schemaWithoutAllOf.required\n .filter((key) => {\n // filter out keys that are already part of the properties(reduce duplicated keys(https://github.com/kubb-labs/kubb/issues/1492)\n if (schemaWithoutAllOf.properties) {\n return !Object.keys(schemaWithoutAllOf.properties).includes(key)\n }\n\n // schema should include required fields when necessary https://github.com/kubb-labs/kubb/issues/1522\n return true\n })\n .map((key) => {\n const schema = schemas.find((item) => item.properties && Object.keys(item.properties).find((propertyKey) => propertyKey === key))\n\n if (schema?.properties?.[key]) {\n return {\n ...schema,\n properties: {\n [key]: schema.properties[key],\n },\n required: [key],\n }\n }\n })\n .filter(Boolean)\n\n and.args = [...(and.args || []), ...items.flatMap((item) => this.parse({ schema: item as SchemaObject, name, parentName }))]\n }\n\n if (schemaWithoutAllOf.properties) {\n and.args = [...(and.args || []), ...this.parse({ schema: schemaWithoutAllOf, name, parentName })]\n }\n\n return [and, ...baseItems]\n }\n\n if (schema.enum) {\n if (options.enumSuffix === '') {\n throw new Error('EnumSuffix set to an empty string does not work')\n }\n\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 (schema.type === 'boolean') {\n // we cannot use z.enum when enum type is boolean\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: 'boolean',\n }))\n : [...new Set(filteredValues)].map((value: string) => {\n return {\n name: value,\n value,\n format: 'boolean',\n }\n }),\n },\n },\n ...baseItems.filter((item) => 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 return baseItems\n case 'email':\n case 'idn-email':\n baseItems.unshift({ keyword: schemaKeywords.email })\n return baseItems\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 return baseItems\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 if (schema.pattern) {\n baseItems.unshift({\n keyword: schemaKeywords.matches,\n args: schema.pattern,\n })\n\n return baseItems\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 const unique = !!schema.uniqueItems\n\n return [\n {\n keyword: schemaKeywords.array,\n args: {\n items,\n min,\n max,\n unique,\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 if (!['boolean', 'object', 'number', 'string', 'integer', 'null'].includes(schema.type)) {\n this.context.pluginManager.logger.emit('warning', `Schema type '${schema.type}' is not valid for schema ${parentName}.${name}`)\n }\n\n // 'string' | 'number' | 'integer' | 'boolean'\n return [{ keyword: schema.type }, ...baseItems]\n }\n\n return [{ keyword: unknownReturn }]\n }\n\n async build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas, contentType, include } = this.context\n\n oas.resolveDiscriminators()\n\n const schemas = getSchemas({ oas, contentType, includes: include })\n\n const promises = Object.entries(schemas).reduce((acc, [name, value]) => {\n if (!value) {\n return acc\n }\n\n const options = this.#getOptions({ name })\n const promiseOperation = this.schema.call(this, name, value, {\n ...this.options,\n ...options,\n })\n\n if (promiseOperation) {\n acc.push(promiseOperation)\n }\n\n generators?.forEach((generator) => {\n const tree = this.parse({ schema: value, name: name })\n\n const promise = generator.schema?.({\n instance: this,\n schema: {\n name,\n value,\n tree,\n },\n options: {\n ...this.options,\n ...options,\n },\n } as any) as Promise<Array<KubbFile.File<TFileMeta>>>\n\n if (promise) {\n acc.push(promise)\n }\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 an array of files or just one file\n return files.flat().filter(Boolean)\n }\n\n /**\n * Schema\n */\n async schema(_name: string, _object: SchemaObject, _options: TOptions): SchemaMethodResult<TFileMeta> {\n return []\n }\n}\n"]}
|