@kubb/plugin-oas 3.16.2 → 3.16.4
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/Oas-CuqAnIw-.js +60 -0
- package/dist/Oas-CuqAnIw-.js.map +1 -0
- package/dist/Oas-Cv_pyXRM.cjs +78 -0
- package/dist/Oas-Cv_pyXRM.cjs.map +1 -0
- package/dist/OperationGenerator-CgbXErhW.d.cts +900 -0
- package/dist/OperationGenerator-OtLcGk2y.d.ts +900 -0
- package/dist/Schema-DJshqHto.d.cts +38 -0
- package/dist/Schema-DOXGUW1m.d.ts +38 -0
- package/dist/SchemaGenerator-8205BXCp.cjs +942 -0
- package/dist/SchemaGenerator-8205BXCp.cjs.map +1 -0
- package/dist/SchemaGenerator-B8Io6kky.js +930 -0
- package/dist/SchemaGenerator-B8Io6kky.js.map +1 -0
- package/dist/SchemaMapper-BaZQKrQB.js +54 -0
- package/dist/SchemaMapper-BaZQKrQB.js.map +1 -0
- package/dist/SchemaMapper-BiagBQN4.d.cts +388 -0
- package/dist/SchemaMapper-C2J2d3o4.d.ts +388 -0
- package/dist/SchemaMapper-D8J0V9Pj.cjs +66 -0
- package/dist/SchemaMapper-D8J0V9Pj.cjs.map +1 -0
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/components.cjs +4 -19
- package/dist/components.d.cts +42 -35
- package/dist/components.d.ts +42 -35
- package/dist/components.js +3 -3
- package/dist/generators-BhLMlRNk.js +137 -0
- package/dist/generators-BhLMlRNk.js.map +1 -0
- package/dist/generators-DLH2kvlh.cjs +155 -0
- package/dist/generators-DLH2kvlh.cjs.map +1 -0
- package/dist/generators.cjs +4 -13
- package/dist/generators.d.cts +5 -7
- package/dist/generators.d.ts +5 -7
- package/dist/generators.js +5 -5
- package/dist/getFooter-BChY2kC1.cjs +43 -0
- package/dist/getFooter-BChY2kC1.cjs.map +1 -0
- package/dist/getFooter-T7_pZ6f8.js +31 -0
- package/dist/getFooter-T7_pZ6f8.js.map +1 -0
- package/dist/getSchemas-D8mP129c.cjs +67 -0
- package/dist/getSchemas-D8mP129c.cjs.map +1 -0
- package/dist/getSchemas-WoSBIxG8.js +55 -0
- package/dist/getSchemas-WoSBIxG8.js.map +1 -0
- package/dist/hooks.cjs +213 -195
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +91 -86
- package/dist/hooks.d.ts +91 -86
- package/dist/hooks.js +212 -193
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +280 -342
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -10
- package/dist/index.d.ts +7 -10
- package/dist/index.js +274 -318
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +802 -737
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +12 -11
- package/dist/mocks.d.ts +12 -11
- package/dist/mocks.js +802 -735
- package/dist/mocks.js.map +1 -1
- package/dist/parseFromConfig-CMNGsef2.cjs +33 -0
- package/dist/parseFromConfig-CMNGsef2.cjs.map +1 -0
- package/dist/parseFromConfig-yAiFK03V.js +27 -0
- package/dist/parseFromConfig-yAiFK03V.js.map +1 -0
- package/dist/utils.cjs +58 -74
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +96 -42
- package/dist/utils.d.ts +96 -42
- package/dist/utils.js +47 -46
- package/dist/utils.js.map +1 -1
- package/package.json +26 -34
- package/src/components/Operation.tsx +1 -2
- package/src/mocks/schemas.ts +39 -0
- package/src/utils/getBanner.ts +5 -5
- package/src/utils/getFooter.ts +4 -4
- package/dist/OperationGenerator-C7NPZtOM.d.ts +0 -288
- package/dist/OperationGenerator-DJE2XQ83.d.cts +0 -288
- package/dist/Schema-AjebpeVY.d.ts +0 -32
- package/dist/Schema-M6983FL1.d.cts +0 -32
- package/dist/SchemaMapper-B21ZmWag.d.cts +0 -275
- package/dist/SchemaMapper-B21ZmWag.d.ts +0 -275
- package/dist/chunk-6S7YFY6F.js +0 -33
- package/dist/chunk-6S7YFY6F.js.map +0 -1
- package/dist/chunk-76E35IZ2.js +0 -56
- package/dist/chunk-76E35IZ2.js.map +0 -1
- package/dist/chunk-7RFNM43R.cjs +0 -41
- package/dist/chunk-7RFNM43R.cjs.map +0 -1
- package/dist/chunk-DTD4ZUDA.cjs +0 -36
- package/dist/chunk-DTD4ZUDA.cjs.map +0 -1
- package/dist/chunk-G3FDK7YW.js +0 -35
- package/dist/chunk-G3FDK7YW.js.map +0 -1
- package/dist/chunk-JNN4JPWK.js +0 -28
- package/dist/chunk-JNN4JPWK.js.map +0 -1
- package/dist/chunk-MBX66JAT.js +0 -93
- package/dist/chunk-MBX66JAT.js.map +0 -1
- package/dist/chunk-NC5PWNEF.js +0 -866
- package/dist/chunk-NC5PWNEF.js.map +0 -1
- package/dist/chunk-PORSNYI5.js +0 -47
- package/dist/chunk-PORSNYI5.js.map +0 -1
- package/dist/chunk-QJMOOF2A.cjs +0 -97
- package/dist/chunk-QJMOOF2A.cjs.map +0 -1
- package/dist/chunk-RKHCI3WI.cjs +0 -1002
- package/dist/chunk-RKHCI3WI.cjs.map +0 -1
- package/dist/chunk-YWMMI3MO.cjs +0 -59
- package/dist/chunk-YWMMI3MO.cjs.map +0 -1
- package/dist/chunk-Z2NREI4X.cjs +0 -32
- package/dist/chunk-Z2NREI4X.cjs.map +0 -1
- package/dist/chunk-ZVFL3NXX.cjs +0 -50
- package/dist/chunk-ZVFL3NXX.cjs.map +0 -1
- package/dist/components.cjs.map +0 -1
- package/dist/components.js.map +0 -1
- package/dist/generators.cjs.map +0 -1
- package/dist/generators.js.map +0 -1
package/dist/utils.d.ts
CHANGED
|
@@ -1,35 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as OperationSchema } from './OperationGenerator-C7NPZtOM.js';
|
|
6
|
-
import { Config, Output } from '@kubb/core';
|
|
7
|
-
import '@kubb/core/fs';
|
|
8
|
-
import './SchemaMapper-B21ZmWag.js';
|
|
1
|
+
import { Config, Oas, OasTypes, OpenAPIV3, OpenAPIV3_1, Operation, OperationSchema, Output, Params, SchemaObject, contentType } from "./OperationGenerator-OtLcGk2y.js";
|
|
2
|
+
import "./SchemaMapper-C2J2d3o4.js";
|
|
3
|
+
import { OASDocument, SchemaObject as SchemaObject$1 } from "oas/types";
|
|
4
|
+
import { OpenAPIV3 as OpenAPIV3$1 } from "openapi-types";
|
|
9
5
|
|
|
10
|
-
|
|
6
|
+
//#region ../oas/src/utils.d.ts
|
|
11
7
|
|
|
8
|
+
declare function isOptional(schema?: SchemaObject$1): boolean;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region ../core/src/utils/FunctionParams.d.ts
|
|
11
|
+
type FunctionParamsASTWithoutType = {
|
|
12
|
+
name?: string;
|
|
13
|
+
type?: string;
|
|
14
|
+
/**
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
required?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
default?: string;
|
|
23
|
+
};
|
|
24
|
+
type FunctionParamsASTWithType = {
|
|
25
|
+
name?: never;
|
|
26
|
+
type: string;
|
|
27
|
+
/**
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
required?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @default true
|
|
33
|
+
*/
|
|
34
|
+
enabled?: boolean;
|
|
35
|
+
default?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated
|
|
39
|
+
*/
|
|
40
|
+
type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated
|
|
43
|
+
*/
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/utils/getComments.d.ts
|
|
46
|
+
declare function getComments(operation: Operation): string[];
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/utils/getParams.d.ts
|
|
12
49
|
declare function getPathParams(operationSchema: OperationSchema | undefined, options?: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
50
|
+
typed?: boolean;
|
|
51
|
+
casing?: 'camelcase';
|
|
52
|
+
override?: (data: FunctionParamsAST) => FunctionParamsAST;
|
|
16
53
|
}): Params;
|
|
17
|
-
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/utils/getSchemaFactory.d.ts
|
|
18
56
|
/**
|
|
19
57
|
* Make it possible to narrow down the schema based on a specific version(3 or 3.1)
|
|
20
58
|
*/
|
|
21
59
|
type SchemaResult<TWithRef extends boolean = false> = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
60
|
+
schemaObject?: (TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {
|
|
61
|
+
nullable?: boolean;
|
|
62
|
+
'x-nullable'?: boolean;
|
|
63
|
+
};
|
|
64
|
+
version: '3.0';
|
|
27
65
|
} | {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
66
|
+
schemaObject?: (TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {
|
|
67
|
+
nullable?: boolean;
|
|
68
|
+
'x-nullable'?: boolean;
|
|
69
|
+
};
|
|
70
|
+
version: '3.1';
|
|
33
71
|
};
|
|
34
72
|
/**
|
|
35
73
|
* Creates a factory function that generates a versioned OpenAPI schema result.
|
|
@@ -39,28 +77,44 @@ type SchemaResult<TWithRef extends boolean = false> = {
|
|
|
39
77
|
* @returns A function that takes an optional schema and returns a versioned schema result.
|
|
40
78
|
*/
|
|
41
79
|
declare function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef>;
|
|
42
|
-
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/utils/getSchemas.d.ts
|
|
43
82
|
type Mode = 'schemas' | 'responses' | 'requestBodies';
|
|
44
83
|
type GetSchemasProps = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
84
|
+
oas: Oas;
|
|
85
|
+
contentType?: contentType;
|
|
86
|
+
includes?: Mode[];
|
|
48
87
|
};
|
|
49
|
-
declare function getSchemas({
|
|
50
|
-
|
|
88
|
+
declare function getSchemas({
|
|
89
|
+
oas,
|
|
90
|
+
contentType,
|
|
91
|
+
includes
|
|
92
|
+
}: GetSchemasProps): Record<string, OasTypes.SchemaObject>;
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/utils/parseFromConfig.d.ts
|
|
51
95
|
declare function parseFromConfig(config: Config, oasClass?: typeof Oas): Promise<Oas>;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/utils/getBanner.d.ts
|
|
98
|
+
type Props$1<TOas extends Oas> = {
|
|
99
|
+
oas: TOas;
|
|
100
|
+
output: Output<any>;
|
|
101
|
+
config?: Config;
|
|
57
102
|
};
|
|
58
|
-
declare function getBanner({
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
103
|
+
declare function getBanner<TOas extends Oas>({
|
|
104
|
+
output,
|
|
105
|
+
oas,
|
|
106
|
+
config
|
|
107
|
+
}: Props$1<TOas>): string;
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/utils/getFooter.d.ts
|
|
110
|
+
type Props<TOas extends Oas> = {
|
|
111
|
+
oas: TOas;
|
|
112
|
+
output: Output<any>;
|
|
63
113
|
};
|
|
64
|
-
declare function getFooter({
|
|
65
|
-
|
|
66
|
-
|
|
114
|
+
declare function getFooter<TOas extends Oas>({
|
|
115
|
+
output,
|
|
116
|
+
oas
|
|
117
|
+
}: Props<TOas>): string | undefined;
|
|
118
|
+
//#endregion
|
|
119
|
+
export { getBanner, getComments, getFooter, getPathParams, getSchemaFactory, getSchemas, isOptional, parseFromConfig };
|
|
120
|
+
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.js
CHANGED
|
@@ -1,54 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import transformers, {
|
|
5
|
-
import { URLPath } from
|
|
6
|
-
import { isParameterObject } from
|
|
7
|
-
export { isOptional } from '@kubb/oas';
|
|
1
|
+
import { getBanner, getFooter } from "./getFooter-T7_pZ6f8.js";
|
|
2
|
+
import { getSchemaFactory, getSchemas } from "./getSchemas-WoSBIxG8.js";
|
|
3
|
+
import { parseFromConfig } from "./parseFromConfig-yAiFK03V.js";
|
|
4
|
+
import transformers, { camelCase, isValidVarName } from "@kubb/core/transformers";
|
|
5
|
+
import { URLPath } from "@kubb/core/utils";
|
|
6
|
+
import { isOptional, isParameterObject } from "@kubb/oas";
|
|
8
7
|
|
|
8
|
+
//#region src/utils/getComments.ts
|
|
9
9
|
function getComments(operation) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
return [
|
|
11
|
+
operation.getDescription() && `@description ${operation.getDescription()}`,
|
|
12
|
+
operation.getSummary() && `@summary ${operation.getSummary()}`,
|
|
13
|
+
operation.path && `{@link ${new URLPath(operation.path).URL}}`,
|
|
14
|
+
operation.isDeprecated() && "@deprecated"
|
|
15
|
+
].filter(Boolean).map((text) => transformers.trim(text));
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/utils/getParams.ts
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @deprecated
|
|
23
|
+
* TODO move to operationManager hook
|
|
24
|
+
*/
|
|
25
|
+
function getASTParams(operationSchema, { typed = false, override } = {}) {
|
|
26
|
+
if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) return [];
|
|
27
|
+
return Object.entries(operationSchema.schema.properties).map(([name, schema]) => {
|
|
28
|
+
const isParam = isParameterObject(schema);
|
|
29
|
+
const data = {
|
|
30
|
+
name,
|
|
31
|
+
enabled: !!name,
|
|
32
|
+
required: isParam ? schema.required : true,
|
|
33
|
+
type: typed ? `${operationSchema.name}["${name}"]` : void 0
|
|
34
|
+
};
|
|
35
|
+
return override ? override(data) : data;
|
|
36
|
+
});
|
|
34
37
|
}
|
|
35
38
|
function getPathParams(operationSchema, options = {}) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return acc;
|
|
49
|
-
}, {});
|
|
39
|
+
return getASTParams(operationSchema, options).reduce((acc, curr) => {
|
|
40
|
+
if (curr.name && curr.enabled) {
|
|
41
|
+
let name = isValidVarName(curr.name) ? curr.name : camelCase(curr.name);
|
|
42
|
+
if (options.casing === "camelcase") name = camelCase(name);
|
|
43
|
+
acc[name] = {
|
|
44
|
+
default: curr.default,
|
|
45
|
+
type: curr.type,
|
|
46
|
+
optional: !curr.required
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return acc;
|
|
50
|
+
}, {});
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
//#endregion
|
|
54
|
+
export { getBanner, getComments, getFooter, getPathParams, getSchemaFactory, getSchemas, isOptional, parseFromConfig };
|
|
54
55
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils.js","names":["operation: Operation","operationSchema: OperationSchema | undefined","data: FunctionParamsAST","options: {\n typed?: boolean\n casing?: 'camelcase'\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n }"],"sources":["../src/utils/getComments.ts","../src/utils/getParams.ts"],"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"],"mappings":";;;;;;;;AAKA,SAAgB,YAAYA,WAAgC;AAC1D,QAAO;EACL,UAAU,gBAAgB,IAAI,CAAC,aAAa,EAAE,UAAU,gBAAgB,EAAE;EAC1E,UAAU,YAAY,IAAI,CAAC,SAAS,EAAE,UAAU,YAAY,EAAE;EAC9D,UAAU,QAAQ,CAAC,OAAO,EAAE,IAAI,QAAQ,UAAU,MAAM,IAAI,CAAC,CAAC;EAC9D,UAAU,cAAc,IAAI;CAC7B,EACE,OAAO,QAAQ,CACf,IAAI,CAAC,SAAS,aAAa,KAAK,KAAK,CAAC;AAC1C;;;;;;;;;ACFD,SAAgB,aACdC,iBACA,EACE,QAAQ,OACR,UAID,GAAG,CAAE,GACe;AACrB,KAAI,CAAC,mBAAmB,CAAC,gBAAgB,OAAO,cAAc,CAAC,gBAAgB,KAC7E,QAAO,CAAE;AAGX,QAAO,OAAO,QAAQ,gBAAgB,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,MAAM,OAAwC,KAAK;EAChH,MAAM,UAAU,kBAAkB,OAAO;EACzC,MAAMC,OAA0B;GAC9B;GACA,SAAS,CAAC,CAAC;GACX,UAAU,UAAU,OAAO,WAAW;GACtC,MAAM,QAAQ,GAAG,gBAAgB,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG;EACtD;AAED,SAAO,WAAW,SAAS,KAAK,GAAG;CACpC,EAAC;AACH;AAED,SAAgB,cACdD,iBACAE,UAII,CAAE,GACN;AACA,QAAO,aAAa,iBAAiB,QAAQ,CAAC,OAAO,CAAC,KAAK,SAAS;AAClE,MAAI,KAAK,QAAQ,KAAK,SAAS;GAC7B,IAAI,OAAO,eAAe,KAAK,KAAK,GAAG,KAAK,OAAO,UAAU,KAAK,KAAK;AAEvE,OAAI,QAAQ,WAAW,aACrB,OAAO,UAAU,KAAK;GAGxB,IAAI,QAAQ;IACV,SAAS,KAAK;IACd,MAAM,KAAK;IACX,UAAU,CAAC,KAAK;GACjB;EACF;AAED,SAAO;CACR,GAAE,CAAE,EAAW;AACjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-oas",
|
|
3
|
-
"version": "3.16.
|
|
3
|
+
"version": "3.16.4",
|
|
4
4
|
"description": "OpenAPI Specification (OAS) plugin for Kubb, providing core functionality for parsing and processing OpenAPI/Swagger schemas for code generation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openapi",
|
|
@@ -26,40 +26,33 @@
|
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
28
28
|
"import": "./dist/index.js",
|
|
29
|
-
"require": "./dist/index.cjs"
|
|
30
|
-
|
|
29
|
+
"require": "./dist/index.cjs"
|
|
30
|
+
},
|
|
31
|
+
"./components": {
|
|
32
|
+
"import": "./dist/components.js",
|
|
33
|
+
"require": "./dist/components.cjs"
|
|
31
34
|
},
|
|
32
35
|
"./generators": {
|
|
33
36
|
"import": "./dist/generators.js",
|
|
34
|
-
"require": "./dist/generators.cjs"
|
|
35
|
-
|
|
37
|
+
"require": "./dist/generators.cjs"
|
|
38
|
+
},
|
|
39
|
+
"./hooks": {
|
|
40
|
+
"import": "./dist/hooks.js",
|
|
41
|
+
"require": "./dist/hooks.cjs"
|
|
36
42
|
},
|
|
37
43
|
"./mocks": {
|
|
38
44
|
"import": "./dist/mocks.js",
|
|
39
|
-
"require": "./dist/mocks.cjs"
|
|
40
|
-
"default": "./dist/mocks.cjs"
|
|
45
|
+
"require": "./dist/mocks.cjs"
|
|
41
46
|
},
|
|
42
47
|
"./utils": {
|
|
43
48
|
"import": "./dist/utils.js",
|
|
44
|
-
"require": "./dist/utils.cjs"
|
|
45
|
-
"default": "./dist/utils.cjs"
|
|
46
|
-
},
|
|
47
|
-
"./hooks": {
|
|
48
|
-
"import": "./dist/hooks.js",
|
|
49
|
-
"require": "./dist/hooks.cjs",
|
|
50
|
-
"default": "./dist/hooks.cjs"
|
|
51
|
-
},
|
|
52
|
-
"./components": {
|
|
53
|
-
"import": "./dist/components.js",
|
|
54
|
-
"require": "./dist/components.cjs",
|
|
55
|
-
"default": "./dist/components.cjs"
|
|
49
|
+
"require": "./dist/utils.cjs"
|
|
56
50
|
},
|
|
57
|
-
"./package.json": "./package.json"
|
|
58
|
-
"./*": "./*"
|
|
51
|
+
"./package.json": "./package.json"
|
|
59
52
|
},
|
|
60
|
-
"main": "dist/index.cjs",
|
|
61
|
-
"module": "dist/index.js",
|
|
62
|
-
"types": "./dist/index.d.
|
|
53
|
+
"main": "./dist/index.cjs",
|
|
54
|
+
"module": "./dist/index.js",
|
|
55
|
+
"types": "./dist/index.d.cts",
|
|
63
56
|
"typesVersions": {
|
|
64
57
|
"*": {
|
|
65
58
|
"utils": [
|
|
@@ -87,19 +80,18 @@
|
|
|
87
80
|
],
|
|
88
81
|
"dependencies": {
|
|
89
82
|
"@stoplight/yaml": "^4.3.0",
|
|
90
|
-
"p-limit": "
|
|
83
|
+
"p-limit": "^7.0.0",
|
|
91
84
|
"remeda": "^2.30.0",
|
|
92
|
-
"@kubb/core": "3.16.
|
|
93
|
-
"@kubb/
|
|
94
|
-
"@kubb/
|
|
85
|
+
"@kubb/core": "3.16.4",
|
|
86
|
+
"@kubb/react": "3.16.4",
|
|
87
|
+
"@kubb/oas": "3.16.4"
|
|
95
88
|
},
|
|
96
89
|
"devDependencies": {
|
|
97
90
|
"@types/react": "^18.3.23",
|
|
98
91
|
"react": "^18.3.1",
|
|
99
|
-
"
|
|
92
|
+
"tsdown": "^0.14.1",
|
|
100
93
|
"typescript": "^5.9.2",
|
|
101
|
-
"@kubb/config-ts": "3.16.
|
|
102
|
-
"@kubb/config-tsup": "3.16.2"
|
|
94
|
+
"@kubb/config-ts": "3.16.4"
|
|
103
95
|
},
|
|
104
96
|
"peerDependencies": {
|
|
105
97
|
"@kubb/react": "^3.0.0"
|
|
@@ -112,13 +104,13 @@
|
|
|
112
104
|
"registry": "https://registry.npmjs.org/"
|
|
113
105
|
},
|
|
114
106
|
"scripts": {
|
|
115
|
-
"build": "
|
|
107
|
+
"build": "tsdown",
|
|
116
108
|
"clean": "npx rimraf ./dist",
|
|
117
109
|
"lint": "bun biome lint .",
|
|
118
|
-
"lint:fix": "bun biome lint--fix --unsafe .",
|
|
110
|
+
"lint:fix": "bun biome lint --fix --unsafe .",
|
|
119
111
|
"release": "pnpm publish --no-git-check",
|
|
120
112
|
"release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
|
|
121
|
-
"start": "
|
|
113
|
+
"start": "tsdown --watch",
|
|
122
114
|
"test": "vitest --passWithNoTests",
|
|
123
115
|
"typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
|
|
124
116
|
}
|
package/src/mocks/schemas.ts
CHANGED
|
@@ -450,6 +450,45 @@ const basic: Array<{ name: string; schema: Schema }> = [
|
|
|
450
450
|
},
|
|
451
451
|
},
|
|
452
452
|
},
|
|
453
|
+
{
|
|
454
|
+
name: 'objectObjectEnum',
|
|
455
|
+
schema: {
|
|
456
|
+
keyword: schemaKeywords.object,
|
|
457
|
+
args: {
|
|
458
|
+
properties: {
|
|
459
|
+
prop1: [
|
|
460
|
+
{
|
|
461
|
+
keyword: schemaKeywords.object,
|
|
462
|
+
args: {
|
|
463
|
+
properties: {
|
|
464
|
+
prop2: [
|
|
465
|
+
{
|
|
466
|
+
keyword: schemaKeywords.schema,
|
|
467
|
+
args: { format: 'string', type: 'string' },
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
keyword: schemaKeywords.enum,
|
|
471
|
+
args: {
|
|
472
|
+
name: 'enum',
|
|
473
|
+
typeName: 'Enum',
|
|
474
|
+
asConst: false,
|
|
475
|
+
items: [
|
|
476
|
+
{ name: 'A', value: 'A', format: schemaKeywords.string },
|
|
477
|
+
{ name: 'B', value: 'B', format: schemaKeywords.string },
|
|
478
|
+
],
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
],
|
|
482
|
+
},
|
|
483
|
+
additionalProperties: [],
|
|
484
|
+
},
|
|
485
|
+
},
|
|
486
|
+
],
|
|
487
|
+
},
|
|
488
|
+
additionalProperties: [],
|
|
489
|
+
},
|
|
490
|
+
},
|
|
491
|
+
},
|
|
453
492
|
{
|
|
454
493
|
name: 'objectArrayObject',
|
|
455
494
|
schema: {
|
package/src/utils/getBanner.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type Config, getDefaultBanner, type Output } from '@kubb/core'
|
|
2
2
|
import type { Oas } from '@kubb/oas'
|
|
3
3
|
import { isFunction } from 'remeda'
|
|
4
4
|
|
|
5
|
-
type Props = {
|
|
6
|
-
oas:
|
|
7
|
-
output: Output<
|
|
5
|
+
type Props<TOas extends Oas> = {
|
|
6
|
+
oas: TOas
|
|
7
|
+
output: Output<any>
|
|
8
8
|
config?: Config
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export function getBanner({ output, oas, config }: Props) {
|
|
11
|
+
export function getBanner<TOas extends Oas>({ output, oas, config }: Props<TOas>): string {
|
|
12
12
|
let banner = ''
|
|
13
13
|
if (config?.output?.defaultBanner !== false && config) {
|
|
14
14
|
const { title, description, version } = oas.api?.info || {}
|
package/src/utils/getFooter.ts
CHANGED
|
@@ -2,12 +2,12 @@ import type { Output } from '@kubb/core'
|
|
|
2
2
|
import type { Oas } from '@kubb/oas'
|
|
3
3
|
import { isFunction } from 'remeda'
|
|
4
4
|
|
|
5
|
-
type Props = {
|
|
6
|
-
oas:
|
|
7
|
-
output: Output<
|
|
5
|
+
type Props<TOas extends Oas> = {
|
|
6
|
+
oas: TOas
|
|
7
|
+
output: Output<any>
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export function getFooter({ output, oas }: Props) {
|
|
10
|
+
export function getFooter<TOas extends Oas>({ output, oas }: Props<TOas>) {
|
|
11
11
|
if (!output.footer) {
|
|
12
12
|
return undefined
|
|
13
13
|
}
|