@kubb/plugin-oas 3.1.0 → 3.2.0
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-DOz5MZ9x.d.cts → OperationGenerator-DSwDeEnz.d.cts} +0 -20
- package/dist/{OperationGenerator-DOz5MZ9x.d.ts → OperationGenerator-DSwDeEnz.d.ts} +0 -20
- package/dist/{Schema-7TmFtgpX.d.ts → Schema-CWTFm7te.d.ts} +1 -1
- package/dist/{Schema-BZf0c98o.d.cts → Schema-akZJu96S.d.cts} +1 -1
- package/dist/components.d.cts +2 -2
- package/dist/components.d.ts +2 -2
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/hooks.d.cts +2 -2
- package/dist/hooks.d.ts +2 -2
- package/dist/index.cjs +20 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -46
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs +4 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +3 -2
- package/dist/utils.d.ts +3 -2
- package/dist/utils.js +4 -1
- package/dist/utils.js.map +1 -1
- package/package.json +8 -8
- package/src/OperationGenerator.ts +20 -51
- package/src/utils/getParams.ts +7 -1
|
@@ -531,26 +531,6 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
|
|
|
531
531
|
* Operation
|
|
532
532
|
*/
|
|
533
533
|
operation(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
|
|
534
|
-
/**
|
|
535
|
-
* GET
|
|
536
|
-
*/
|
|
537
|
-
get(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
|
|
538
|
-
/**
|
|
539
|
-
* POST
|
|
540
|
-
*/
|
|
541
|
-
post(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
|
|
542
|
-
/**
|
|
543
|
-
* PATCH
|
|
544
|
-
*/
|
|
545
|
-
patch(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
|
|
546
|
-
/**
|
|
547
|
-
* PUT
|
|
548
|
-
*/
|
|
549
|
-
put(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
|
|
550
|
-
/**
|
|
551
|
-
* DELETE
|
|
552
|
-
*/
|
|
553
|
-
delete(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
|
|
554
534
|
/**
|
|
555
535
|
* Combination of GET, POST, PATCH, PUT, DELETE
|
|
556
536
|
*/
|
|
@@ -531,26 +531,6 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
|
|
|
531
531
|
* Operation
|
|
532
532
|
*/
|
|
533
533
|
operation(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
|
|
534
|
-
/**
|
|
535
|
-
* GET
|
|
536
|
-
*/
|
|
537
|
-
get(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
|
|
538
|
-
/**
|
|
539
|
-
* POST
|
|
540
|
-
*/
|
|
541
|
-
post(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
|
|
542
|
-
/**
|
|
543
|
-
* PATCH
|
|
544
|
-
*/
|
|
545
|
-
patch(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
|
|
546
|
-
/**
|
|
547
|
-
* PUT
|
|
548
|
-
*/
|
|
549
|
-
put(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
|
|
550
|
-
/**
|
|
551
|
-
* DELETE
|
|
552
|
-
*/
|
|
553
|
-
delete(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
|
|
554
534
|
/**
|
|
555
535
|
* Combination of GET, POST, PATCH, PUT, DELETE
|
|
556
536
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { SchemaObject } from '@kubb/oas';
|
|
3
3
|
import { KubbNode } from '@kubb/react/types';
|
|
4
|
-
import { f as Schema$1 } from './OperationGenerator-
|
|
4
|
+
import { f as Schema$1 } from './OperationGenerator-DSwDeEnz.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 { KubbNode } from '@kubb/react/types';
|
|
4
|
-
import { f as Schema$1 } from './OperationGenerator-
|
|
4
|
+
import { f as Schema$1 } from './OperationGenerator-DSwDeEnz.cjs';
|
|
5
5
|
|
|
6
6
|
type SchemaContextProps = {
|
|
7
7
|
name: string;
|
package/dist/components.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as Schema } from './Schema-
|
|
1
|
+
import { S as Schema } from './Schema-akZJu96S.cjs';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { Operation as Operation$1, Oas as Oas$1 } from '@kubb/oas';
|
|
4
4
|
import { KubbNode } from '@kubb/react/types';
|
|
5
|
-
import { b as OperationGenerator } from './OperationGenerator-
|
|
5
|
+
import { b as OperationGenerator } from './OperationGenerator-DSwDeEnz.cjs';
|
|
6
6
|
import '@kubb/core';
|
|
7
7
|
import '@kubb/fs/types';
|
|
8
8
|
|
package/dist/components.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as Schema } from './Schema-
|
|
1
|
+
import { S as Schema } from './Schema-CWTFm7te.js';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { Operation as Operation$1, Oas as Oas$1 } from '@kubb/oas';
|
|
4
4
|
import { KubbNode } from '@kubb/react/types';
|
|
5
|
-
import { b as OperationGenerator } from './OperationGenerator-
|
|
5
|
+
import { b as OperationGenerator } from './OperationGenerator-DSwDeEnz.js';
|
|
6
6
|
import '@kubb/core';
|
|
7
7
|
import '@kubb/fs/types';
|
|
8
8
|
|
package/dist/generators.d.cts
CHANGED
package/dist/generators.d.ts
CHANGED
package/dist/hooks.d.cts
CHANGED
|
@@ -2,8 +2,8 @@ import { Oas, Operation, HttpMethod } from '@kubb/oas';
|
|
|
2
2
|
import { Plugin, ResolveNameParams, Group, FileMetaBase } from '@kubb/core';
|
|
3
3
|
import * as KubbFile from '@kubb/fs/types';
|
|
4
4
|
import { Mode } from '@kubb/fs/types';
|
|
5
|
-
import { w as OperationSchemas, f as Schema } from './OperationGenerator-
|
|
6
|
-
import { a as SchemaContextProps } from './Schema-
|
|
5
|
+
import { w as OperationSchemas, f as Schema } from './OperationGenerator-DSwDeEnz.cjs';
|
|
6
|
+
import { a as SchemaContextProps } from './Schema-akZJu96S.cjs';
|
|
7
7
|
import '@kubb/react/types';
|
|
8
8
|
import 'react';
|
|
9
9
|
|
package/dist/hooks.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { Oas, Operation, HttpMethod } from '@kubb/oas';
|
|
|
2
2
|
import { Plugin, ResolveNameParams, Group, FileMetaBase } from '@kubb/core';
|
|
3
3
|
import * as KubbFile from '@kubb/fs/types';
|
|
4
4
|
import { Mode } from '@kubb/fs/types';
|
|
5
|
-
import { w as OperationSchemas, f as Schema } from './OperationGenerator-
|
|
6
|
-
import { a as SchemaContextProps } from './Schema-
|
|
5
|
+
import { w as OperationSchemas, f as Schema } from './OperationGenerator-DSwDeEnz.js';
|
|
6
|
+
import { a as SchemaContextProps } from './Schema-CWTFm7te.js';
|
|
7
7
|
import '@kubb/react/types';
|
|
8
8
|
import 'react';
|
|
9
9
|
|
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,7 @@ var OperationGenerator = class extends core.BaseGenerator {
|
|
|
30
30
|
return !!operation.getTags()[0]?.name.match(pattern);
|
|
31
31
|
}
|
|
32
32
|
if (type === "operationId") {
|
|
33
|
-
return !!operation.getOperationId().match(pattern);
|
|
33
|
+
return !!operation.getOperationId({ friendlyCase: true }).match(pattern);
|
|
34
34
|
}
|
|
35
35
|
if (type === "path") {
|
|
36
36
|
return !!operation.path.match(pattern);
|
|
@@ -49,7 +49,7 @@ var OperationGenerator = class extends core.BaseGenerator {
|
|
|
49
49
|
matched = !!operation.getTags()[0]?.name.match(pattern);
|
|
50
50
|
}
|
|
51
51
|
if (type === "operationId" && !matched) {
|
|
52
|
-
matched = !!operation.getOperationId().match(pattern);
|
|
52
|
+
matched = !!operation.getOperationId({ friendlyCase: true }).match(pattern);
|
|
53
53
|
}
|
|
54
54
|
if (type === "path" && !matched) {
|
|
55
55
|
matched = !!operation.path.match(pattern);
|
|
@@ -68,7 +68,7 @@ var OperationGenerator = class extends core.BaseGenerator {
|
|
|
68
68
|
matched = !!operation.getTags()[0]?.name.match(pattern);
|
|
69
69
|
}
|
|
70
70
|
if (type === "operationId" && !matched) {
|
|
71
|
-
matched = !!operation.getOperationId().match(pattern);
|
|
71
|
+
matched = !!operation.getOperationId({ friendlyCase: true }).match(pattern);
|
|
72
72
|
}
|
|
73
73
|
if (type === "path" && !matched) {
|
|
74
74
|
matched = !!operation.path.match(pattern);
|
|
@@ -93,11 +93,11 @@ var OperationGenerator = class extends core.BaseGenerator {
|
|
|
93
93
|
}
|
|
94
94
|
const schema = this.context.oas.getResponseSchema(operation, statusCode);
|
|
95
95
|
return {
|
|
96
|
-
name: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId()} ${name}`)),
|
|
96
|
+
name: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${name}`)),
|
|
97
97
|
description: operation.getResponseByStatusCode(statusCode)?.description,
|
|
98
98
|
schema,
|
|
99
99
|
operation,
|
|
100
|
-
operationName: transformers__default.default.pascalCase(`${operation.getOperationId()}`),
|
|
100
|
+
operationName: transformers__default.default.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
101
101
|
statusCode: name === "error" ? void 0 : Number(statusCode),
|
|
102
102
|
keys: schema?.properties ? Object.keys(schema.properties) : void 0,
|
|
103
103
|
keysToOmit: schema?.properties ? Object.keys(schema.properties).filter((key) => {
|
|
@@ -109,31 +109,33 @@ var OperationGenerator = class extends core.BaseGenerator {
|
|
|
109
109
|
const hasResponses = statusCodes.some((item) => item.statusCode?.toString().startsWith("2"));
|
|
110
110
|
return {
|
|
111
111
|
pathParams: pathParamsSchema ? {
|
|
112
|
-
name: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId()} PathParams`)),
|
|
112
|
+
name: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId({ friendlyCase: true })} PathParams`)),
|
|
113
113
|
operation,
|
|
114
|
-
operationName: transformers__default.default.pascalCase(`${operation.getOperationId()}`),
|
|
114
|
+
operationName: transformers__default.default.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
115
115
|
schema: pathParamsSchema,
|
|
116
116
|
keys: pathParamsSchema.properties ? Object.keys(pathParamsSchema.properties) : void 0
|
|
117
117
|
} : void 0,
|
|
118
118
|
queryParams: queryParamsSchema ? {
|
|
119
|
-
name: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId()} QueryParams`)),
|
|
119
|
+
name: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId({ friendlyCase: true })} QueryParams`)),
|
|
120
120
|
operation,
|
|
121
|
-
operationName: transformers__default.default.pascalCase(`${operation.getOperationId()}`),
|
|
121
|
+
operationName: transformers__default.default.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
122
122
|
schema: queryParamsSchema,
|
|
123
123
|
keys: queryParamsSchema.properties ? Object.keys(queryParamsSchema.properties) : []
|
|
124
124
|
} : void 0,
|
|
125
125
|
headerParams: headerParamsSchema ? {
|
|
126
|
-
name: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId()} HeaderParams`)),
|
|
126
|
+
name: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId({ friendlyCase: true })} HeaderParams`)),
|
|
127
127
|
operation,
|
|
128
|
-
operationName: transformers__default.default.pascalCase(`${operation.getOperationId()}`),
|
|
128
|
+
operationName: transformers__default.default.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
129
129
|
schema: headerParamsSchema,
|
|
130
130
|
keys: headerParamsSchema.properties ? Object.keys(headerParamsSchema.properties) : void 0
|
|
131
131
|
} : void 0,
|
|
132
132
|
request: requestSchema ? {
|
|
133
|
-
name: resolveName(
|
|
133
|
+
name: resolveName(
|
|
134
|
+
transformers__default.default.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${operation.method === "get" ? "queryRequest" : "mutationRequest"}`)
|
|
135
|
+
),
|
|
134
136
|
description: operation.schema.requestBody?.description,
|
|
135
137
|
operation,
|
|
136
|
-
operationName: transformers__default.default.pascalCase(`${operation.getOperationId()}`),
|
|
138
|
+
operationName: transformers__default.default.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
137
139
|
schema: requestSchema,
|
|
138
140
|
keys: requestSchema.properties ? Object.keys(requestSchema.properties) : void 0,
|
|
139
141
|
keysToOmit: requestSchema.properties ? Object.keys(requestSchema.properties).filter((key) => {
|
|
@@ -142,14 +144,16 @@ var OperationGenerator = class extends core.BaseGenerator {
|
|
|
142
144
|
}) : void 0
|
|
143
145
|
} : void 0,
|
|
144
146
|
response: {
|
|
145
|
-
name: resolveName(
|
|
147
|
+
name: resolveName(
|
|
148
|
+
transformers__default.default.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${operation.method === "get" ? "queryResponse" : "mutationResponse"}`)
|
|
149
|
+
),
|
|
146
150
|
operation,
|
|
147
|
-
operationName: transformers__default.default.pascalCase(`${operation.getOperationId()}`),
|
|
151
|
+
operationName: transformers__default.default.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
148
152
|
schema: {
|
|
149
153
|
oneOf: hasResponses ? statusCodes.filter((item) => item.statusCode?.toString().startsWith("2")).map((item) => {
|
|
150
154
|
return {
|
|
151
155
|
...item.schema,
|
|
152
|
-
$ref: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId()} ${item.statusCode}`))
|
|
156
|
+
$ref: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${item.statusCode}`))
|
|
153
157
|
};
|
|
154
158
|
}) : void 0
|
|
155
159
|
}
|
|
@@ -246,36 +250,6 @@ var OperationGenerator = class extends core.BaseGenerator {
|
|
|
246
250
|
async operation(operation, options) {
|
|
247
251
|
return [];
|
|
248
252
|
}
|
|
249
|
-
/**
|
|
250
|
-
* GET
|
|
251
|
-
*/
|
|
252
|
-
async get(operation, options) {
|
|
253
|
-
return [];
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* POST
|
|
257
|
-
*/
|
|
258
|
-
async post(operation, options) {
|
|
259
|
-
return [];
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* PATCH
|
|
263
|
-
*/
|
|
264
|
-
async patch(operation, options) {
|
|
265
|
-
return [];
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* PUT
|
|
269
|
-
*/
|
|
270
|
-
async put(operation, options) {
|
|
271
|
-
return [];
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* DELETE
|
|
275
|
-
*/
|
|
276
|
-
async delete(operation, options) {
|
|
277
|
-
return [];
|
|
278
|
-
}
|
|
279
253
|
/**
|
|
280
254
|
* Combination of GET, POST, PATCH, PUT, DELETE
|
|
281
255
|
*/
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/OperationGenerator.ts","../src/plugin.ts"],"names":["BaseGenerator","transformers","path","method","methods","item","createPlugin","jsonGenerator","parseFromConfig","getSchemas","options","FileManager","SchemaGenerator"],"mappings":";;;;;;;;;;;;;;;;;AA2Ba,IAAA,kBAAA,GAAN,cAGGA,kBAA6G,CAAA;AAAA,EACrH,sBAA0C,EAAC;AAAA,EAC3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,QAAQ,IAAK,CAAA,MAAA;AAAA,UACb,WAAA;AAAA,UACA,OAAS,EAAA,KAAA,CAAA;AAAA,UACT,QAAU,EAAA,KAAA,CAAA;AAAA,UACV,IAAM,EAAA,OAAA;AAAA,UACN,QAAQ,MAAO,CAAA;AAAA;AACjB,OACF;AAEA,MAAA,MAAM,WAAc,GAAA,MAAM,eAAgB,CAAA,KAAA,CAAM,GAAG,UAAU,CAAA;AAC7D,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA;AAEjC,MAAA,MAAM,kBAAqB,GAAA,IAAI,kBAAmB,CAAA,IAAA,CAAK,OAAO,OAAS,EAAA;AAAA,QACrE,GAAA;AAAA,QACA,eAAe,IAAK,CAAA,aAAA;AAAA,QACpB,QAAQ,IAAK,CAAA,MAAA;AAAA,QACb,WAAA;AAAA,QACA,OAAS,EAAA,KAAA,CAAA;AAAA,QACT,OAAS,EAAA,KAAA,CAAA;AAAA,QACT,QAAU,EAAA,KAAA,CAAA;AAAA,QACV,IAAM,EAAA;AAAA,OACP,CAAA;AAED,MAAA,MAAM,cAAiB,GAAA,MAAM,kBAAmB,CAAA,KAAA,CAAM,GAAG,UAAU,CAAA;AAEnE,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,cAAc,CAAA;AAAA;AACtC,GACF;AACF,CAAC","file":"index.cjs","sourcesContent":["import { BaseGenerator, type FileMetaBase } from '@kubb/core'\nimport transformers from '@kubb/core/transformers'\n\nimport type { PluginFactoryOptions, PluginManager } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\n\nimport type { Plugin } from '@kubb/core'\nimport type { HttpMethod, Oas, OasTypes, Operation, SchemaObject, contentType } from '@kubb/oas'\nimport type { Generator } from './generator.tsx'\nimport type { Exclude, Include, OperationSchemas, OperationsByMethod, Override } from './types.ts'\n\nexport type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>\n\ntype Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {\n oas: Oas\n exclude: Array<Exclude> | undefined\n include: Array<Include> | undefined\n override: Array<Override<TOptions>> | undefined\n contentType: contentType | undefined\n pluginManager: PluginManager\n /**\n * Current plugin\n */\n plugin: Plugin<TPluginOptions>\n mode: KubbFile.Mode\n}\n\nexport class OperationGenerator<\n TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n TFileMeta extends FileMetaBase = FileMetaBase,\n> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {\n #operationsByMethod: OperationsByMethod = {}\n get operationsByMethod(): OperationsByMethod {\n return this.#operationsByMethod\n }\n\n set operationsByMethod(paths: OperationsByMethod) {\n this.#operationsByMethod = paths\n }\n\n #getOptions(operation: Operation, method: HttpMethod): Partial<TPluginOptions['resolvedOptions']> {\n const { override = [] } = this.context\n\n return (\n override.find(({ pattern, type }) => {\n if (type === 'tag') {\n return !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId') {\n return !!operation.getOperationId().match(pattern)\n }\n\n if (type === 'path') {\n return !!operation.path.match(pattern)\n }\n\n if (type === 'method') {\n return !!method.match(pattern)\n }\n\n return false\n })?.options || {}\n )\n }\n\n #isExcluded(operation: Operation, method: HttpMethod): boolean {\n const { exclude = [] } = this.context\n let matched = false\n\n exclude.forEach(({ pattern, type }) => {\n if (type === 'tag' && !matched) {\n matched = !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId' && !matched) {\n matched = !!operation.getOperationId().match(pattern)\n }\n\n if (type === 'path' && !matched) {\n matched = !!operation.path.match(pattern)\n }\n\n if (type === 'method' && !matched) {\n matched = !!method.match(pattern)\n }\n })\n\n return matched\n }\n\n #isIncluded(operation: Operation, method: HttpMethod): boolean {\n const { include = [] } = this.context\n let matched = false\n\n include.forEach(({ pattern, type }) => {\n if (type === 'tag' && !matched) {\n matched = !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId' && !matched) {\n matched = !!operation.getOperationId().match(pattern)\n }\n\n if (type === 'path' && !matched) {\n matched = !!operation.path.match(pattern)\n }\n\n if (type === 'method' && !matched) {\n matched = !!method.match(pattern)\n }\n })\n\n return matched\n }\n\n getSchemas(\n operation: Operation,\n {\n resolveName = (name) => name,\n }: {\n resolveName?: (name: string) => string\n } = {},\n ): OperationSchemas {\n const pathParamsSchema = this.context.oas.getParametersSchema(operation, 'path')\n const queryParamsSchema = this.context.oas.getParametersSchema(operation, 'query')\n const headerParamsSchema = this.context.oas.getParametersSchema(operation, 'header')\n const requestSchema = this.context.oas.getRequestSchema(operation)\n const statusCodes = operation.getResponseStatusCodes().map((statusCode) => {\n let name = statusCode\n if (name === 'default') {\n name = 'error'\n }\n\n const schema = this.context.oas.getResponseSchema(operation, statusCode)\n\n return {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${name}`)),\n description: (operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject)?.description,\n schema,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n statusCode: name === 'error' ? undefined : Number(statusCode),\n keys: schema?.properties ? Object.keys(schema.properties) : undefined,\n keysToOmit: schema?.properties\n ? Object.keys(schema.properties).filter((key) => {\n const item = schema.properties?.[key] as OasTypes.SchemaObject\n return item?.writeOnly\n })\n : undefined,\n }\n })\n const hasResponses = statusCodes.some((item) => item.statusCode?.toString().startsWith('2'))\n\n return {\n pathParams: pathParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} PathParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: pathParamsSchema,\n keys: pathParamsSchema.properties ? Object.keys(pathParamsSchema.properties) : undefined,\n }\n : undefined,\n queryParams: queryParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} QueryParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: queryParamsSchema,\n keys: queryParamsSchema.properties ? Object.keys(queryParamsSchema.properties) : [],\n }\n : undefined,\n headerParams: headerParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} HeaderParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: headerParamsSchema,\n keys: headerParamsSchema.properties ? Object.keys(headerParamsSchema.properties) : undefined,\n }\n : undefined,\n request: requestSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${operation.method === 'get' ? 'queryRequest' : 'mutationRequest'}`)),\n description: (operation.schema.requestBody as OasTypes.RequestBodyObject)?.description,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: requestSchema,\n keys: requestSchema.properties ? Object.keys(requestSchema.properties) : undefined,\n keysToOmit: requestSchema.properties\n ? Object.keys(requestSchema.properties).filter((key) => {\n const item = requestSchema.properties?.[key] as OasTypes.SchemaObject\n\n return item?.readOnly\n })\n : undefined,\n }\n : undefined,\n response: {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${operation.method === 'get' ? 'queryResponse' : 'mutationResponse'}`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: {\n oneOf: hasResponses\n ? statusCodes\n .filter((item) => item.statusCode?.toString().startsWith('2'))\n .map((item) => {\n return {\n ...item.schema,\n $ref: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${item.statusCode}`)),\n }\n })\n : undefined,\n } as SchemaObject,\n },\n responses: statusCodes.filter((item) => item.statusCode?.toString().startsWith('2')),\n errors: statusCodes.filter((item) => item.statusCode?.toString().startsWith('4') || item.statusCode?.toString().startsWith('5')),\n statusCodes,\n }\n }\n\n #methods = ['get', 'post', 'patch', 'put', 'delete']\n\n async build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas } = this.context\n\n const paths = oas.getPaths()\n this.operationsByMethod = Object.entries(paths).reduce((acc, [path, method]) => {\n const methods = Object.keys(method) as HttpMethod[]\n\n methods.forEach((method) => {\n const operation = oas.operation(path, method)\n if (operation && [this.#methods].some((methods) => method === operation.method)) {\n const isExcluded = this.#isExcluded(operation, method)\n const isIncluded = this.context.include ? this.#isIncluded(operation, method) : true\n\n if (isIncluded && !isExcluded) {\n if (!acc[path]) {\n acc[path] = {} as OperationsByMethod['get']\n }\n acc[path] = {\n ...acc[path],\n [method]: {\n operation,\n schemas: this.getSchemas(operation),\n },\n } as OperationsByMethod['get']\n }\n }\n })\n\n return acc\n }, {} as OperationsByMethod)\n\n const promises = Object.keys(this.operationsByMethod).reduce((acc, path) => {\n const methods = this.operationsByMethod[path] ? (Object.keys(this.operationsByMethod[path]!) as HttpMethod[]) : []\n\n methods.forEach((method) => {\n const { operation } = this.operationsByMethod[path]?.[method]!\n const options = this.#getOptions(operation, method)\n\n const methodToCall = this[method as keyof typeof this] as any\n\n if (typeof methodToCall === 'function') {\n const promiseMethod = methodToCall?.call(this, operation, {\n ...this.options,\n ...options,\n })\n\n if (promiseMethod) {\n acc.push(promiseMethod)\n }\n }\n\n const promiseOperation = this.operation.call(this, operation, {\n ...this.options,\n ...options,\n })\n\n if (promiseOperation) {\n acc.push(promiseOperation)\n }\n\n generators?.forEach((generator) => {\n const promise = generator.operation?.({\n instance: this,\n operation,\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\n return acc\n }, [] as OperationMethodResult<TFileMeta>[])\n\n const operations = Object.values(this.operationsByMethod).map((item) => Object.values(item).map((item) => item.operation))\n\n promises.push(this.all(operations.flat().filter(Boolean), this.operationsByMethod))\n\n generators?.forEach((generator) => {\n const promise = generator.operations?.({\n instance: this,\n operations: operations.flat().filter(Boolean),\n operationsByMethod: this.operationsByMethod,\n options: this.options,\n } as any) as Promise<Array<KubbFile.File<TFileMeta>>>\n\n if (promise) {\n promises.push(promise)\n }\n })\n\n const files = await Promise.all(promises)\n\n // using .flat because operationGenerator[method] can return a array of files or just one file\n return files.flat().filter(Boolean)\n }\n\n /**\n * Operation\n */\n async operation(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * GET\n */\n async get(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * POST\n */\n async post(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n /**\n * PATCH\n */\n async patch(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * PUT\n */\n async put(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * DELETE\n */\n async delete(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * Combination of GET, POST, PATCH, PUT, DELETE\n */\n async all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta> {\n return []\n }\n}\n","import { FileManager, createPlugin } from '@kubb/core'\n\nimport { getSchemas } from './utils/getSchemas.ts'\nimport { parseFromConfig } from './utils/parseFromConfig.ts'\n\nimport path from 'node:path'\nimport type { Config } from '@kubb/core'\nimport type { Logger } from '@kubb/core/logger'\nimport type { Oas } from '@kubb/oas'\nimport { OperationGenerator } from './OperationGenerator.ts'\nimport { SchemaGenerator } from './SchemaGenerator.ts'\nimport { jsonGenerator } from './generators'\nimport type { PluginOas } from './types.ts'\n\nexport const pluginOasName = 'plugin-oas' satisfies PluginOas['name']\n\nexport const pluginOas = createPlugin<PluginOas>((options) => {\n const {\n output = {\n path: 'schemas',\n },\n validate = true,\n generators = [jsonGenerator],\n serverIndex,\n contentType,\n oasClass,\n } = options\n\n const getOas = async ({ config, logger }: { config: Config; logger: Logger }): Promise<Oas> => {\n try {\n // needs to be in a different variable or the catch here will not work(return of a promise instead)\n const oas = await parseFromConfig(config, oasClass)\n\n if (validate) {\n await oas.valdiate()\n }\n\n return oas\n } catch (e) {\n const error = e as Error\n\n logger.emit('warning', error?.message)\n return parseFromConfig(config, oasClass)\n }\n }\n\n return {\n name: pluginOasName,\n options: {\n output,\n ...options,\n },\n context() {\n const { config, logger } = this\n\n return {\n getOas() {\n return getOas({ config, logger })\n },\n async getSchemas({ includes } = {}) {\n const oas = await this.getOas()\n return getSchemas({ oas, contentType, includes })\n },\n async getBaseURL() {\n const oasInstance = await this.getOas()\n if (serverIndex) {\n return oasInstance.api.servers?.at(serverIndex)?.url\n }\n\n return undefined\n },\n contentType,\n }\n },\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n async buildStart() {\n if (!output) {\n return\n }\n\n const oas = await getOas({\n config: this.config,\n logger: this.logger,\n })\n await oas.dereference()\n\n const schemaGenerator = new SchemaGenerator(\n {\n unknownType: 'unknown',\n dateType: 'date',\n transformers: {},\n ...this.plugin.options,\n },\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override: undefined,\n mode: 'split',\n output: output.path,\n },\n )\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.addFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude: undefined,\n include: undefined,\n override: undefined,\n mode: 'split',\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n\n await this.addFile(...operationFiles)\n },\n }\n})\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/OperationGenerator.ts","../src/plugin.ts"],"names":["BaseGenerator","transformers","path","method","methods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,EAAA;AAEtB,MAAA,MAAM,kBAAkB,IAAIU,iCAAA;AAAA,QAC1B;AAAA,UACE,WAAa,EAAA,SAAA;AAAA,UACb,QAAU,EAAA,MAAA;AAAA,UACV,cAAc,EAAC;AAAA,UACf,GAAG,KAAK,MAAO,CAAA;AAAA,SACjB;AAAA,QACA;AAAA,UACE,GAAA;AAAA,UACA,eAAe,IAAK,CAAA,aAAA;AAAA,UACpB,QAAQ,IAAK,CAAA,MAAA;AAAA,UACb,WAAA;AAAA,UACA,OAAS,EAAA,KAAA,CAAA;AAAA,UACT,QAAU,EAAA,KAAA,CAAA;AAAA,UACV,IAAM,EAAA,OAAA;AAAA,UACN,QAAQ,MAAO,CAAA;AAAA;AACjB,OACF;AAEA,MAAA,MAAM,WAAc,GAAA,MAAM,eAAgB,CAAA,KAAA,CAAM,GAAG,UAAU,CAAA;AAC7D,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA;AAEjC,MAAA,MAAM,kBAAqB,GAAA,IAAI,kBAAmB,CAAA,IAAA,CAAK,OAAO,OAAS,EAAA;AAAA,QACrE,GAAA;AAAA,QACA,eAAe,IAAK,CAAA,aAAA;AAAA,QACpB,QAAQ,IAAK,CAAA,MAAA;AAAA,QACb,WAAA;AAAA,QACA,OAAS,EAAA,KAAA,CAAA;AAAA,QACT,OAAS,EAAA,KAAA,CAAA;AAAA,QACT,QAAU,EAAA,KAAA,CAAA;AAAA,QACV,IAAM,EAAA;AAAA,OACP,CAAA;AAED,MAAA,MAAM,cAAiB,GAAA,MAAM,kBAAmB,CAAA,KAAA,CAAM,GAAG,UAAU,CAAA;AAEnE,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,cAAc,CAAA;AAAA;AACtC,GACF;AACF,CAAC","file":"index.cjs","sourcesContent":["import { BaseGenerator, type FileMetaBase } from '@kubb/core'\nimport transformers from '@kubb/core/transformers'\n\nimport type { PluginFactoryOptions, PluginManager } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\n\nimport type { Plugin } from '@kubb/core'\nimport type { HttpMethod, Oas, OasTypes, Operation, SchemaObject, contentType } from '@kubb/oas'\nimport type { Generator } from './generator.tsx'\nimport type { Exclude, Include, OperationSchemas, OperationsByMethod, Override } from './types.ts'\n\nexport type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>\n\ntype Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {\n oas: Oas\n exclude: Array<Exclude> | undefined\n include: Array<Include> | undefined\n override: Array<Override<TOptions>> | undefined\n contentType: contentType | undefined\n pluginManager: PluginManager\n /**\n * Current plugin\n */\n plugin: Plugin<TPluginOptions>\n mode: KubbFile.Mode\n}\n\nexport class OperationGenerator<\n TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n TFileMeta extends FileMetaBase = FileMetaBase,\n> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {\n #operationsByMethod: OperationsByMethod = {}\n get operationsByMethod(): OperationsByMethod {\n return this.#operationsByMethod\n }\n\n set operationsByMethod(paths: OperationsByMethod) {\n this.#operationsByMethod = paths\n }\n\n #getOptions(operation: Operation, method: HttpMethod): Partial<TPluginOptions['resolvedOptions']> {\n const { override = [] } = this.context\n\n return (\n override.find(({ pattern, type }) => {\n if (type === 'tag') {\n return !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId') {\n return !!operation.getOperationId({ friendlyCase: true }).match(pattern)\n }\n\n if (type === 'path') {\n return !!operation.path.match(pattern)\n }\n\n if (type === 'method') {\n return !!method.match(pattern)\n }\n\n return false\n })?.options || {}\n )\n }\n\n #isExcluded(operation: Operation, method: HttpMethod): boolean {\n const { exclude = [] } = this.context\n let matched = false\n\n exclude.forEach(({ pattern, type }) => {\n if (type === 'tag' && !matched) {\n matched = !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId' && !matched) {\n matched = !!operation.getOperationId({ friendlyCase: true }).match(pattern)\n }\n\n if (type === 'path' && !matched) {\n matched = !!operation.path.match(pattern)\n }\n\n if (type === 'method' && !matched) {\n matched = !!method.match(pattern)\n }\n })\n\n return matched\n }\n\n #isIncluded(operation: Operation, method: HttpMethod): boolean {\n const { include = [] } = this.context\n let matched = false\n\n include.forEach(({ pattern, type }) => {\n if (type === 'tag' && !matched) {\n matched = !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId' && !matched) {\n matched = !!operation.getOperationId({ friendlyCase: true }).match(pattern)\n }\n\n if (type === 'path' && !matched) {\n matched = !!operation.path.match(pattern)\n }\n\n if (type === 'method' && !matched) {\n matched = !!method.match(pattern)\n }\n })\n\n return matched\n }\n\n getSchemas(\n operation: Operation,\n {\n resolveName = (name) => name,\n }: {\n resolveName?: (name: string) => string\n } = {},\n ): OperationSchemas {\n const pathParamsSchema = this.context.oas.getParametersSchema(operation, 'path')\n const queryParamsSchema = this.context.oas.getParametersSchema(operation, 'query')\n const headerParamsSchema = this.context.oas.getParametersSchema(operation, 'header')\n const requestSchema = this.context.oas.getRequestSchema(operation)\n const statusCodes = operation.getResponseStatusCodes().map((statusCode) => {\n let name = statusCode\n if (name === 'default') {\n name = 'error'\n }\n\n const schema = this.context.oas.getResponseSchema(operation, statusCode)\n\n return {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${name}`)),\n description: (operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject)?.description,\n schema,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),\n statusCode: name === 'error' ? undefined : Number(statusCode),\n keys: schema?.properties ? Object.keys(schema.properties) : undefined,\n keysToOmit: schema?.properties\n ? Object.keys(schema.properties).filter((key) => {\n const item = schema.properties?.[key] as OasTypes.SchemaObject\n return item?.writeOnly\n })\n : undefined,\n }\n })\n const hasResponses = statusCodes.some((item) => item.statusCode?.toString().startsWith('2'))\n\n return {\n pathParams: pathParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} PathParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),\n schema: pathParamsSchema,\n keys: pathParamsSchema.properties ? Object.keys(pathParamsSchema.properties) : undefined,\n }\n : undefined,\n queryParams: queryParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} QueryParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),\n schema: queryParamsSchema,\n keys: queryParamsSchema.properties ? Object.keys(queryParamsSchema.properties) : [],\n }\n : undefined,\n headerParams: headerParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} HeaderParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),\n schema: headerParamsSchema,\n keys: headerParamsSchema.properties ? Object.keys(headerParamsSchema.properties) : undefined,\n }\n : undefined,\n request: requestSchema\n ? {\n name: resolveName(\n transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${operation.method === 'get' ? 'queryRequest' : 'mutationRequest'}`),\n ),\n description: (operation.schema.requestBody as OasTypes.RequestBodyObject)?.description,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),\n schema: requestSchema,\n keys: requestSchema.properties ? Object.keys(requestSchema.properties) : undefined,\n keysToOmit: requestSchema.properties\n ? Object.keys(requestSchema.properties).filter((key) => {\n const item = requestSchema.properties?.[key] as OasTypes.SchemaObject\n\n return item?.readOnly\n })\n : undefined,\n }\n : undefined,\n response: {\n name: resolveName(\n transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${operation.method === 'get' ? 'queryResponse' : 'mutationResponse'}`),\n ),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),\n schema: {\n oneOf: hasResponses\n ? statusCodes\n .filter((item) => item.statusCode?.toString().startsWith('2'))\n .map((item) => {\n return {\n ...item.schema,\n $ref: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${item.statusCode}`)),\n }\n })\n : undefined,\n } as SchemaObject,\n },\n responses: statusCodes.filter((item) => item.statusCode?.toString().startsWith('2')),\n errors: statusCodes.filter((item) => item.statusCode?.toString().startsWith('4') || item.statusCode?.toString().startsWith('5')),\n statusCodes,\n }\n }\n\n #methods = ['get', 'post', 'patch', 'put', 'delete']\n\n async build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas } = this.context\n\n const paths = oas.getPaths()\n this.operationsByMethod = Object.entries(paths).reduce((acc, [path, method]) => {\n const methods = Object.keys(method) as HttpMethod[]\n\n methods.forEach((method) => {\n const operation = oas.operation(path, method)\n if (operation && [this.#methods].some((methods) => method === operation.method)) {\n const isExcluded = this.#isExcluded(operation, method)\n const isIncluded = this.context.include ? this.#isIncluded(operation, method) : true\n\n if (isIncluded && !isExcluded) {\n if (!acc[path]) {\n acc[path] = {} as OperationsByMethod['get']\n }\n acc[path] = {\n ...acc[path],\n [method]: {\n operation,\n schemas: this.getSchemas(operation),\n },\n } as OperationsByMethod['get']\n }\n }\n })\n\n return acc\n }, {} as OperationsByMethod)\n\n const promises = Object.keys(this.operationsByMethod).reduce((acc, path) => {\n const methods = this.operationsByMethod[path] ? (Object.keys(this.operationsByMethod[path]!) as HttpMethod[]) : []\n\n methods.forEach((method) => {\n const { operation } = this.operationsByMethod[path]?.[method]!\n const options = this.#getOptions(operation, method)\n\n const methodToCall = this[method as keyof typeof this] as any\n\n if (typeof methodToCall === 'function') {\n const promiseMethod = methodToCall?.call(this, operation, {\n ...this.options,\n ...options,\n })\n\n if (promiseMethod) {\n acc.push(promiseMethod)\n }\n }\n\n const promiseOperation = this.operation.call(this, operation, {\n ...this.options,\n ...options,\n })\n\n if (promiseOperation) {\n acc.push(promiseOperation)\n }\n\n generators?.forEach((generator) => {\n const promise = generator.operation?.({\n instance: this,\n operation,\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\n return acc\n }, [] as OperationMethodResult<TFileMeta>[])\n\n const operations = Object.values(this.operationsByMethod).map((item) => Object.values(item).map((item) => item.operation))\n\n promises.push(this.all(operations.flat().filter(Boolean), this.operationsByMethod))\n\n generators?.forEach((generator) => {\n const promise = generator.operations?.({\n instance: this,\n operations: operations.flat().filter(Boolean),\n operationsByMethod: this.operationsByMethod,\n options: this.options,\n } as any) as Promise<Array<KubbFile.File<TFileMeta>>>\n\n if (promise) {\n promises.push(promise)\n }\n })\n\n const files = await Promise.all(promises)\n\n // using .flat because operationGenerator[method] can return a array of files or just one file\n return files.flat().filter(Boolean)\n }\n\n /**\n * Operation\n */\n async operation(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n /**\n * Combination of GET, POST, PATCH, PUT, DELETE\n */\n async all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta> {\n return []\n }\n}\n","import { FileManager, createPlugin } from '@kubb/core'\n\nimport { getSchemas } from './utils/getSchemas.ts'\nimport { parseFromConfig } from './utils/parseFromConfig.ts'\n\nimport path from 'node:path'\nimport type { Config } from '@kubb/core'\nimport type { Logger } from '@kubb/core/logger'\nimport type { Oas } from '@kubb/oas'\nimport { OperationGenerator } from './OperationGenerator.ts'\nimport { SchemaGenerator } from './SchemaGenerator.ts'\nimport { jsonGenerator } from './generators'\nimport type { PluginOas } from './types.ts'\n\nexport const pluginOasName = 'plugin-oas' satisfies PluginOas['name']\n\nexport const pluginOas = createPlugin<PluginOas>((options) => {\n const {\n output = {\n path: 'schemas',\n },\n validate = true,\n generators = [jsonGenerator],\n serverIndex,\n contentType,\n oasClass,\n } = options\n\n const getOas = async ({ config, logger }: { config: Config; logger: Logger }): Promise<Oas> => {\n try {\n // needs to be in a different variable or the catch here will not work(return of a promise instead)\n const oas = await parseFromConfig(config, oasClass)\n\n if (validate) {\n await oas.valdiate()\n }\n\n return oas\n } catch (e) {\n const error = e as Error\n\n logger.emit('warning', error?.message)\n return parseFromConfig(config, oasClass)\n }\n }\n\n return {\n name: pluginOasName,\n options: {\n output,\n ...options,\n },\n context() {\n const { config, logger } = this\n\n return {\n getOas() {\n return getOas({ config, logger })\n },\n async getSchemas({ includes } = {}) {\n const oas = await this.getOas()\n return getSchemas({ oas, contentType, includes })\n },\n async getBaseURL() {\n const oasInstance = await this.getOas()\n if (serverIndex) {\n return oasInstance.api.servers?.at(serverIndex)?.url\n }\n\n return undefined\n },\n contentType,\n }\n },\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n async buildStart() {\n if (!output) {\n return\n }\n\n const oas = await getOas({\n config: this.config,\n logger: this.logger,\n })\n await oas.dereference()\n\n const schemaGenerator = new SchemaGenerator(\n {\n unknownType: 'unknown',\n dateType: 'date',\n transformers: {},\n ...this.plugin.options,\n },\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override: undefined,\n mode: 'split',\n output: output.path,\n },\n )\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.addFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude: undefined,\n include: undefined,\n override: undefined,\n mode: 'split',\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n\n await this.addFile(...operationFiles)\n },\n }\n})\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as Options, P as PluginOas } from './OperationGenerator-
|
|
2
|
-
export { A as API, E as Exclude, o as Generator, p as GeneratorOptions, G as GetSchemaGeneratorOptions, I as Include, b as OperationGenerator, a as OperationMethodResult, v as OperationSchema, w as OperationSchemas, x as OperationsByMethod, y as Override, R as ReactGeneratorOptions, r as Ref, t as Refs, q as ResolvePathOptions, u as Resolver, f as Schema, e as SchemaGenerator, S as SchemaGeneratorBuildOptions, c as SchemaGeneratorOptions, h as SchemaKeyword, i as SchemaKeywordBase, j as SchemaKeywordMapper, k as SchemaMapper, d as SchemaMethodResult, g as SchemaTree, m as createGenerator, n as createReactGenerator, l as isKeyword, s as schemaKeywords } from './OperationGenerator-
|
|
1
|
+
import { O as Options, P as PluginOas } from './OperationGenerator-DSwDeEnz.cjs';
|
|
2
|
+
export { A as API, E as Exclude, o as Generator, p as GeneratorOptions, G as GetSchemaGeneratorOptions, I as Include, b as OperationGenerator, a as OperationMethodResult, v as OperationSchema, w as OperationSchemas, x as OperationsByMethod, y as Override, R as ReactGeneratorOptions, r as Ref, t as Refs, q as ResolvePathOptions, u as Resolver, f as Schema, e as SchemaGenerator, S as SchemaGeneratorBuildOptions, c as SchemaGeneratorOptions, h as SchemaKeyword, i as SchemaKeywordBase, j as SchemaKeywordMapper, k as SchemaMapper, d as SchemaMethodResult, g as SchemaTree, m as createGenerator, n as createReactGenerator, l as isKeyword, s as schemaKeywords } from './OperationGenerator-DSwDeEnz.cjs';
|
|
3
3
|
import * as _kubb_core from '@kubb/core';
|
|
4
4
|
import '@kubb/fs/types';
|
|
5
5
|
import '@kubb/oas';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as Options, P as PluginOas } from './OperationGenerator-
|
|
2
|
-
export { A as API, E as Exclude, o as Generator, p as GeneratorOptions, G as GetSchemaGeneratorOptions, I as Include, b as OperationGenerator, a as OperationMethodResult, v as OperationSchema, w as OperationSchemas, x as OperationsByMethod, y as Override, R as ReactGeneratorOptions, r as Ref, t as Refs, q as ResolvePathOptions, u as Resolver, f as Schema, e as SchemaGenerator, S as SchemaGeneratorBuildOptions, c as SchemaGeneratorOptions, h as SchemaKeyword, i as SchemaKeywordBase, j as SchemaKeywordMapper, k as SchemaMapper, d as SchemaMethodResult, g as SchemaTree, m as createGenerator, n as createReactGenerator, l as isKeyword, s as schemaKeywords } from './OperationGenerator-
|
|
1
|
+
import { O as Options, P as PluginOas } from './OperationGenerator-DSwDeEnz.js';
|
|
2
|
+
export { A as API, E as Exclude, o as Generator, p as GeneratorOptions, G as GetSchemaGeneratorOptions, I as Include, b as OperationGenerator, a as OperationMethodResult, v as OperationSchema, w as OperationSchemas, x as OperationsByMethod, y as Override, R as ReactGeneratorOptions, r as Ref, t as Refs, q as ResolvePathOptions, u as Resolver, f as Schema, e as SchemaGenerator, S as SchemaGeneratorBuildOptions, c as SchemaGeneratorOptions, h as SchemaKeyword, i as SchemaKeywordBase, j as SchemaKeywordMapper, k as SchemaMapper, d as SchemaMethodResult, g as SchemaTree, m as createGenerator, n as createReactGenerator, l as isKeyword, s as schemaKeywords } from './OperationGenerator-DSwDeEnz.js';
|
|
3
3
|
import * as _kubb_core from '@kubb/core';
|
|
4
4
|
import '@kubb/fs/types';
|
|
5
5
|
import '@kubb/oas';
|
package/dist/index.js
CHANGED
|
@@ -25,7 +25,7 @@ var OperationGenerator = class extends BaseGenerator {
|
|
|
25
25
|
return !!operation.getTags()[0]?.name.match(pattern);
|
|
26
26
|
}
|
|
27
27
|
if (type === "operationId") {
|
|
28
|
-
return !!operation.getOperationId().match(pattern);
|
|
28
|
+
return !!operation.getOperationId({ friendlyCase: true }).match(pattern);
|
|
29
29
|
}
|
|
30
30
|
if (type === "path") {
|
|
31
31
|
return !!operation.path.match(pattern);
|
|
@@ -44,7 +44,7 @@ var OperationGenerator = class extends BaseGenerator {
|
|
|
44
44
|
matched = !!operation.getTags()[0]?.name.match(pattern);
|
|
45
45
|
}
|
|
46
46
|
if (type === "operationId" && !matched) {
|
|
47
|
-
matched = !!operation.getOperationId().match(pattern);
|
|
47
|
+
matched = !!operation.getOperationId({ friendlyCase: true }).match(pattern);
|
|
48
48
|
}
|
|
49
49
|
if (type === "path" && !matched) {
|
|
50
50
|
matched = !!operation.path.match(pattern);
|
|
@@ -63,7 +63,7 @@ var OperationGenerator = class extends BaseGenerator {
|
|
|
63
63
|
matched = !!operation.getTags()[0]?.name.match(pattern);
|
|
64
64
|
}
|
|
65
65
|
if (type === "operationId" && !matched) {
|
|
66
|
-
matched = !!operation.getOperationId().match(pattern);
|
|
66
|
+
matched = !!operation.getOperationId({ friendlyCase: true }).match(pattern);
|
|
67
67
|
}
|
|
68
68
|
if (type === "path" && !matched) {
|
|
69
69
|
matched = !!operation.path.match(pattern);
|
|
@@ -88,11 +88,11 @@ var OperationGenerator = class extends BaseGenerator {
|
|
|
88
88
|
}
|
|
89
89
|
const schema = this.context.oas.getResponseSchema(operation, statusCode);
|
|
90
90
|
return {
|
|
91
|
-
name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${name}`)),
|
|
91
|
+
name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${name}`)),
|
|
92
92
|
description: operation.getResponseByStatusCode(statusCode)?.description,
|
|
93
93
|
schema,
|
|
94
94
|
operation,
|
|
95
|
-
operationName: transformers.pascalCase(`${operation.getOperationId()}`),
|
|
95
|
+
operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
96
96
|
statusCode: name === "error" ? void 0 : Number(statusCode),
|
|
97
97
|
keys: schema?.properties ? Object.keys(schema.properties) : void 0,
|
|
98
98
|
keysToOmit: schema?.properties ? Object.keys(schema.properties).filter((key) => {
|
|
@@ -104,31 +104,33 @@ var OperationGenerator = class extends BaseGenerator {
|
|
|
104
104
|
const hasResponses = statusCodes.some((item) => item.statusCode?.toString().startsWith("2"));
|
|
105
105
|
return {
|
|
106
106
|
pathParams: pathParamsSchema ? {
|
|
107
|
-
name: resolveName(transformers.pascalCase(`${operation.getOperationId()} PathParams`)),
|
|
107
|
+
name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} PathParams`)),
|
|
108
108
|
operation,
|
|
109
|
-
operationName: transformers.pascalCase(`${operation.getOperationId()}`),
|
|
109
|
+
operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
110
110
|
schema: pathParamsSchema,
|
|
111
111
|
keys: pathParamsSchema.properties ? Object.keys(pathParamsSchema.properties) : void 0
|
|
112
112
|
} : void 0,
|
|
113
113
|
queryParams: queryParamsSchema ? {
|
|
114
|
-
name: resolveName(transformers.pascalCase(`${operation.getOperationId()} QueryParams`)),
|
|
114
|
+
name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} QueryParams`)),
|
|
115
115
|
operation,
|
|
116
|
-
operationName: transformers.pascalCase(`${operation.getOperationId()}`),
|
|
116
|
+
operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
117
117
|
schema: queryParamsSchema,
|
|
118
118
|
keys: queryParamsSchema.properties ? Object.keys(queryParamsSchema.properties) : []
|
|
119
119
|
} : void 0,
|
|
120
120
|
headerParams: headerParamsSchema ? {
|
|
121
|
-
name: resolveName(transformers.pascalCase(`${operation.getOperationId()} HeaderParams`)),
|
|
121
|
+
name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} HeaderParams`)),
|
|
122
122
|
operation,
|
|
123
|
-
operationName: transformers.pascalCase(`${operation.getOperationId()}`),
|
|
123
|
+
operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
124
124
|
schema: headerParamsSchema,
|
|
125
125
|
keys: headerParamsSchema.properties ? Object.keys(headerParamsSchema.properties) : void 0
|
|
126
126
|
} : void 0,
|
|
127
127
|
request: requestSchema ? {
|
|
128
|
-
name: resolveName(
|
|
128
|
+
name: resolveName(
|
|
129
|
+
transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${operation.method === "get" ? "queryRequest" : "mutationRequest"}`)
|
|
130
|
+
),
|
|
129
131
|
description: operation.schema.requestBody?.description,
|
|
130
132
|
operation,
|
|
131
|
-
operationName: transformers.pascalCase(`${operation.getOperationId()}`),
|
|
133
|
+
operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
132
134
|
schema: requestSchema,
|
|
133
135
|
keys: requestSchema.properties ? Object.keys(requestSchema.properties) : void 0,
|
|
134
136
|
keysToOmit: requestSchema.properties ? Object.keys(requestSchema.properties).filter((key) => {
|
|
@@ -137,14 +139,16 @@ var OperationGenerator = class extends BaseGenerator {
|
|
|
137
139
|
}) : void 0
|
|
138
140
|
} : void 0,
|
|
139
141
|
response: {
|
|
140
|
-
name: resolveName(
|
|
142
|
+
name: resolveName(
|
|
143
|
+
transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${operation.method === "get" ? "queryResponse" : "mutationResponse"}`)
|
|
144
|
+
),
|
|
141
145
|
operation,
|
|
142
|
-
operationName: transformers.pascalCase(`${operation.getOperationId()}`),
|
|
146
|
+
operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
143
147
|
schema: {
|
|
144
148
|
oneOf: hasResponses ? statusCodes.filter((item) => item.statusCode?.toString().startsWith("2")).map((item) => {
|
|
145
149
|
return {
|
|
146
150
|
...item.schema,
|
|
147
|
-
$ref: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${item.statusCode}`))
|
|
151
|
+
$ref: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${item.statusCode}`))
|
|
148
152
|
};
|
|
149
153
|
}) : void 0
|
|
150
154
|
}
|
|
@@ -241,36 +245,6 @@ var OperationGenerator = class extends BaseGenerator {
|
|
|
241
245
|
async operation(operation, options) {
|
|
242
246
|
return [];
|
|
243
247
|
}
|
|
244
|
-
/**
|
|
245
|
-
* GET
|
|
246
|
-
*/
|
|
247
|
-
async get(operation, options) {
|
|
248
|
-
return [];
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* POST
|
|
252
|
-
*/
|
|
253
|
-
async post(operation, options) {
|
|
254
|
-
return [];
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* PATCH
|
|
258
|
-
*/
|
|
259
|
-
async patch(operation, options) {
|
|
260
|
-
return [];
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* PUT
|
|
264
|
-
*/
|
|
265
|
-
async put(operation, options) {
|
|
266
|
-
return [];
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* DELETE
|
|
270
|
-
*/
|
|
271
|
-
async delete(operation, options) {
|
|
272
|
-
return [];
|
|
273
|
-
}
|
|
274
248
|
/**
|
|
275
249
|
* Combination of GET, POST, PATCH, PUT, DELETE
|
|
276
250
|
*/
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/OperationGenerator.ts","../src/plugin.ts"],"names":["path","method","methods","item","options"],"mappings":";;;;;;;;;;;;AA2Ba,IAAA,kBAAA,GAAN,cAGG,aAA6G,CAAA;AAAA,EACrH,sBAA0C,EAAC;AAAA,EAC3C,IAAI,kBAAyC,GAAA;AAC3C,IAAA,OAAO,IAAK,CAAA,mBAAA;AAAA;AACd,EAEA,IAAI,mBAAmB,KAA2B,EAAA;AAChD,IAAA,IAAA,CAAK,mBAAsB,GAAA,KAAA;AAAA;AAC7B,EAEA,WAAA,CAAY,WAAsB,MAAgE,EAAA;AAChG,IAAA,MAAM,EAAE,QAAA,GAAW,EAAC,KAAM,IAAK,CAAA,OAAA;AAE/B,IAAA,OACE,SAAS,IAAK,CAAA,CAAC,EAAE,OAAA,EAAS,MAAW,KAAA;AACnC,MAAA,IAAI,SAAS,KAAO,EAAA;AAClB,QAAO,OAAA,CAAC,CAAC,SAAU,CAAA,OAAA,GAAU,CAAC,CAAA,EAAG,IAAK,CAAA,KAAA,CAA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A,QACA,OAAS,EAAA,KAAA,CAAA;AAAA,QACT,OAAS,EAAA,KAAA,CAAA;AAAA,QACT,QAAU,EAAA,KAAA,CAAA;AAAA,QACV,IAAM,EAAA;AAAA,OACP,CAAA;AAED,MAAA,MAAM,cAAiB,GAAA,MAAM,kBAAmB,CAAA,KAAA,CAAM,GAAG,UAAU,CAAA;AAEnE,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,cAAc,CAAA;AAAA;AACtC,GACF;AACF,CAAC","file":"index.js","sourcesContent":["import { BaseGenerator, type FileMetaBase } from '@kubb/core'\nimport transformers from '@kubb/core/transformers'\n\nimport type { PluginFactoryOptions, PluginManager } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\n\nimport type { Plugin } from '@kubb/core'\nimport type { HttpMethod, Oas, OasTypes, Operation, SchemaObject, contentType } from '@kubb/oas'\nimport type { Generator } from './generator.tsx'\nimport type { Exclude, Include, OperationSchemas, OperationsByMethod, Override } from './types.ts'\n\nexport type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>\n\ntype Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {\n oas: Oas\n exclude: Array<Exclude> | undefined\n include: Array<Include> | undefined\n override: Array<Override<TOptions>> | undefined\n contentType: contentType | undefined\n pluginManager: PluginManager\n /**\n * Current plugin\n */\n plugin: Plugin<TPluginOptions>\n mode: KubbFile.Mode\n}\n\nexport class OperationGenerator<\n TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n TFileMeta extends FileMetaBase = FileMetaBase,\n> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {\n #operationsByMethod: OperationsByMethod = {}\n get operationsByMethod(): OperationsByMethod {\n return this.#operationsByMethod\n }\n\n set operationsByMethod(paths: OperationsByMethod) {\n this.#operationsByMethod = paths\n }\n\n #getOptions(operation: Operation, method: HttpMethod): Partial<TPluginOptions['resolvedOptions']> {\n const { override = [] } = this.context\n\n return (\n override.find(({ pattern, type }) => {\n if (type === 'tag') {\n return !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId') {\n return !!operation.getOperationId().match(pattern)\n }\n\n if (type === 'path') {\n return !!operation.path.match(pattern)\n }\n\n if (type === 'method') {\n return !!method.match(pattern)\n }\n\n return false\n })?.options || {}\n )\n }\n\n #isExcluded(operation: Operation, method: HttpMethod): boolean {\n const { exclude = [] } = this.context\n let matched = false\n\n exclude.forEach(({ pattern, type }) => {\n if (type === 'tag' && !matched) {\n matched = !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId' && !matched) {\n matched = !!operation.getOperationId().match(pattern)\n }\n\n if (type === 'path' && !matched) {\n matched = !!operation.path.match(pattern)\n }\n\n if (type === 'method' && !matched) {\n matched = !!method.match(pattern)\n }\n })\n\n return matched\n }\n\n #isIncluded(operation: Operation, method: HttpMethod): boolean {\n const { include = [] } = this.context\n let matched = false\n\n include.forEach(({ pattern, type }) => {\n if (type === 'tag' && !matched) {\n matched = !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId' && !matched) {\n matched = !!operation.getOperationId().match(pattern)\n }\n\n if (type === 'path' && !matched) {\n matched = !!operation.path.match(pattern)\n }\n\n if (type === 'method' && !matched) {\n matched = !!method.match(pattern)\n }\n })\n\n return matched\n }\n\n getSchemas(\n operation: Operation,\n {\n resolveName = (name) => name,\n }: {\n resolveName?: (name: string) => string\n } = {},\n ): OperationSchemas {\n const pathParamsSchema = this.context.oas.getParametersSchema(operation, 'path')\n const queryParamsSchema = this.context.oas.getParametersSchema(operation, 'query')\n const headerParamsSchema = this.context.oas.getParametersSchema(operation, 'header')\n const requestSchema = this.context.oas.getRequestSchema(operation)\n const statusCodes = operation.getResponseStatusCodes().map((statusCode) => {\n let name = statusCode\n if (name === 'default') {\n name = 'error'\n }\n\n const schema = this.context.oas.getResponseSchema(operation, statusCode)\n\n return {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${name}`)),\n description: (operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject)?.description,\n schema,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n statusCode: name === 'error' ? undefined : Number(statusCode),\n keys: schema?.properties ? Object.keys(schema.properties) : undefined,\n keysToOmit: schema?.properties\n ? Object.keys(schema.properties).filter((key) => {\n const item = schema.properties?.[key] as OasTypes.SchemaObject\n return item?.writeOnly\n })\n : undefined,\n }\n })\n const hasResponses = statusCodes.some((item) => item.statusCode?.toString().startsWith('2'))\n\n return {\n pathParams: pathParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} PathParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: pathParamsSchema,\n keys: pathParamsSchema.properties ? Object.keys(pathParamsSchema.properties) : undefined,\n }\n : undefined,\n queryParams: queryParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} QueryParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: queryParamsSchema,\n keys: queryParamsSchema.properties ? Object.keys(queryParamsSchema.properties) : [],\n }\n : undefined,\n headerParams: headerParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} HeaderParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: headerParamsSchema,\n keys: headerParamsSchema.properties ? Object.keys(headerParamsSchema.properties) : undefined,\n }\n : undefined,\n request: requestSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${operation.method === 'get' ? 'queryRequest' : 'mutationRequest'}`)),\n description: (operation.schema.requestBody as OasTypes.RequestBodyObject)?.description,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: requestSchema,\n keys: requestSchema.properties ? Object.keys(requestSchema.properties) : undefined,\n keysToOmit: requestSchema.properties\n ? Object.keys(requestSchema.properties).filter((key) => {\n const item = requestSchema.properties?.[key] as OasTypes.SchemaObject\n\n return item?.readOnly\n })\n : undefined,\n }\n : undefined,\n response: {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${operation.method === 'get' ? 'queryResponse' : 'mutationResponse'}`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: {\n oneOf: hasResponses\n ? statusCodes\n .filter((item) => item.statusCode?.toString().startsWith('2'))\n .map((item) => {\n return {\n ...item.schema,\n $ref: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${item.statusCode}`)),\n }\n })\n : undefined,\n } as SchemaObject,\n },\n responses: statusCodes.filter((item) => item.statusCode?.toString().startsWith('2')),\n errors: statusCodes.filter((item) => item.statusCode?.toString().startsWith('4') || item.statusCode?.toString().startsWith('5')),\n statusCodes,\n }\n }\n\n #methods = ['get', 'post', 'patch', 'put', 'delete']\n\n async build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas } = this.context\n\n const paths = oas.getPaths()\n this.operationsByMethod = Object.entries(paths).reduce((acc, [path, method]) => {\n const methods = Object.keys(method) as HttpMethod[]\n\n methods.forEach((method) => {\n const operation = oas.operation(path, method)\n if (operation && [this.#methods].some((methods) => method === operation.method)) {\n const isExcluded = this.#isExcluded(operation, method)\n const isIncluded = this.context.include ? this.#isIncluded(operation, method) : true\n\n if (isIncluded && !isExcluded) {\n if (!acc[path]) {\n acc[path] = {} as OperationsByMethod['get']\n }\n acc[path] = {\n ...acc[path],\n [method]: {\n operation,\n schemas: this.getSchemas(operation),\n },\n } as OperationsByMethod['get']\n }\n }\n })\n\n return acc\n }, {} as OperationsByMethod)\n\n const promises = Object.keys(this.operationsByMethod).reduce((acc, path) => {\n const methods = this.operationsByMethod[path] ? (Object.keys(this.operationsByMethod[path]!) as HttpMethod[]) : []\n\n methods.forEach((method) => {\n const { operation } = this.operationsByMethod[path]?.[method]!\n const options = this.#getOptions(operation, method)\n\n const methodToCall = this[method as keyof typeof this] as any\n\n if (typeof methodToCall === 'function') {\n const promiseMethod = methodToCall?.call(this, operation, {\n ...this.options,\n ...options,\n })\n\n if (promiseMethod) {\n acc.push(promiseMethod)\n }\n }\n\n const promiseOperation = this.operation.call(this, operation, {\n ...this.options,\n ...options,\n })\n\n if (promiseOperation) {\n acc.push(promiseOperation)\n }\n\n generators?.forEach((generator) => {\n const promise = generator.operation?.({\n instance: this,\n operation,\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\n return acc\n }, [] as OperationMethodResult<TFileMeta>[])\n\n const operations = Object.values(this.operationsByMethod).map((item) => Object.values(item).map((item) => item.operation))\n\n promises.push(this.all(operations.flat().filter(Boolean), this.operationsByMethod))\n\n generators?.forEach((generator) => {\n const promise = generator.operations?.({\n instance: this,\n operations: operations.flat().filter(Boolean),\n operationsByMethod: this.operationsByMethod,\n options: this.options,\n } as any) as Promise<Array<KubbFile.File<TFileMeta>>>\n\n if (promise) {\n promises.push(promise)\n }\n })\n\n const files = await Promise.all(promises)\n\n // using .flat because operationGenerator[method] can return a array of files or just one file\n return files.flat().filter(Boolean)\n }\n\n /**\n * Operation\n */\n async operation(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * GET\n */\n async get(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * POST\n */\n async post(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n /**\n * PATCH\n */\n async patch(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * PUT\n */\n async put(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * DELETE\n */\n async delete(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * Combination of GET, POST, PATCH, PUT, DELETE\n */\n async all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta> {\n return []\n }\n}\n","import { FileManager, createPlugin } from '@kubb/core'\n\nimport { getSchemas } from './utils/getSchemas.ts'\nimport { parseFromConfig } from './utils/parseFromConfig.ts'\n\nimport path from 'node:path'\nimport type { Config } from '@kubb/core'\nimport type { Logger } from '@kubb/core/logger'\nimport type { Oas } from '@kubb/oas'\nimport { OperationGenerator } from './OperationGenerator.ts'\nimport { SchemaGenerator } from './SchemaGenerator.ts'\nimport { jsonGenerator } from './generators'\nimport type { PluginOas } from './types.ts'\n\nexport const pluginOasName = 'plugin-oas' satisfies PluginOas['name']\n\nexport const pluginOas = createPlugin<PluginOas>((options) => {\n const {\n output = {\n path: 'schemas',\n },\n validate = true,\n generators = [jsonGenerator],\n serverIndex,\n contentType,\n oasClass,\n } = options\n\n const getOas = async ({ config, logger }: { config: Config; logger: Logger }): Promise<Oas> => {\n try {\n // needs to be in a different variable or the catch here will not work(return of a promise instead)\n const oas = await parseFromConfig(config, oasClass)\n\n if (validate) {\n await oas.valdiate()\n }\n\n return oas\n } catch (e) {\n const error = e as Error\n\n logger.emit('warning', error?.message)\n return parseFromConfig(config, oasClass)\n }\n }\n\n return {\n name: pluginOasName,\n options: {\n output,\n ...options,\n },\n context() {\n const { config, logger } = this\n\n return {\n getOas() {\n return getOas({ config, logger })\n },\n async getSchemas({ includes } = {}) {\n const oas = await this.getOas()\n return getSchemas({ oas, contentType, includes })\n },\n async getBaseURL() {\n const oasInstance = await this.getOas()\n if (serverIndex) {\n return oasInstance.api.servers?.at(serverIndex)?.url\n }\n\n return undefined\n },\n contentType,\n }\n },\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n async buildStart() {\n if (!output) {\n return\n }\n\n const oas = await getOas({\n config: this.config,\n logger: this.logger,\n })\n await oas.dereference()\n\n const schemaGenerator = new SchemaGenerator(\n {\n unknownType: 'unknown',\n dateType: 'date',\n transformers: {},\n ...this.plugin.options,\n },\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override: undefined,\n mode: 'split',\n output: output.path,\n },\n )\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.addFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude: undefined,\n include: undefined,\n override: undefined,\n mode: 'split',\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n\n await this.addFile(...operationFiles)\n },\n }\n})\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/OperationGenerator.ts","../src/plugin.ts"],"names":["path","method","methods","item","options"],"mappings":";;;;;;;;;;;;AA2Ba,IAAA,kBAAA,GAAN,cAGG,aAA6G,CAAA;AAAA,EACrH,sBAA0C,EAAC;AAAA,EAC3C,IAAI,kBAAyC,GAAA;AAC3C,IAAA,OAAO,IAAK,CAAA,mBAAA;AAAA;AACd,EAEA,IAAI,mBAAmB,KAA2B,EAAA;AAChD,IAAA,IAAA,CAAK,mBAAsB,GAAA,KAAA;AAAA;AAC7B,EAEA,WAAA,CAAY,WAAsB,MAAgE,EAAA;AAChG,IAAA,MAAM,EAAE,QAAA,GAAW,EAAC,KAAM,IAAK,CAAA,OAAA;AAE/B,IAAA,OACE,SAAS,IAAK,CAAA,CAAC,EAAE,OAAA,EAAS,MAAW,KAAA;AACnC,MAAA,IAAI,SAAS,KAAO,EAAA;AAClB,QAAO,OAAA,CAAC,CAAC,SAAU,CAAA,OAAA,GAAU,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CAAK,OAAO,OAAS,EAAA;AAAA,QACrE,GAAA;AAAA,QACA,eAAe,IAAK,CAAA,aAAA;AAAA,QACpB,QAAQ,IAAK,CAAA,MAAA;AAAA,QACb,WAAA;AAAA,QACA,OAAS,EAAA,KAAA,CAAA;AAAA,QACT,OAAS,EAAA,KAAA,CAAA;AAAA,QACT,QAAU,EAAA,KAAA,CAAA;AAAA,QACV,IAAM,EAAA;AAAA,OACP,CAAA;AAED,MAAA,MAAM,cAAiB,GAAA,MAAM,kBAAmB,CAAA,KAAA,CAAM,GAAG,UAAU,CAAA;AAEnE,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,cAAc,CAAA;AAAA;AACtC,GACF;AACF,CAAC","file":"index.js","sourcesContent":["import { BaseGenerator, type FileMetaBase } from '@kubb/core'\nimport transformers from '@kubb/core/transformers'\n\nimport type { PluginFactoryOptions, PluginManager } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\n\nimport type { Plugin } from '@kubb/core'\nimport type { HttpMethod, Oas, OasTypes, Operation, SchemaObject, contentType } from '@kubb/oas'\nimport type { Generator } from './generator.tsx'\nimport type { Exclude, Include, OperationSchemas, OperationsByMethod, Override } from './types.ts'\n\nexport type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>\n\ntype Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {\n oas: Oas\n exclude: Array<Exclude> | undefined\n include: Array<Include> | undefined\n override: Array<Override<TOptions>> | undefined\n contentType: contentType | undefined\n pluginManager: PluginManager\n /**\n * Current plugin\n */\n plugin: Plugin<TPluginOptions>\n mode: KubbFile.Mode\n}\n\nexport class OperationGenerator<\n TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n TFileMeta extends FileMetaBase = FileMetaBase,\n> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {\n #operationsByMethod: OperationsByMethod = {}\n get operationsByMethod(): OperationsByMethod {\n return this.#operationsByMethod\n }\n\n set operationsByMethod(paths: OperationsByMethod) {\n this.#operationsByMethod = paths\n }\n\n #getOptions(operation: Operation, method: HttpMethod): Partial<TPluginOptions['resolvedOptions']> {\n const { override = [] } = this.context\n\n return (\n override.find(({ pattern, type }) => {\n if (type === 'tag') {\n return !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId') {\n return !!operation.getOperationId({ friendlyCase: true }).match(pattern)\n }\n\n if (type === 'path') {\n return !!operation.path.match(pattern)\n }\n\n if (type === 'method') {\n return !!method.match(pattern)\n }\n\n return false\n })?.options || {}\n )\n }\n\n #isExcluded(operation: Operation, method: HttpMethod): boolean {\n const { exclude = [] } = this.context\n let matched = false\n\n exclude.forEach(({ pattern, type }) => {\n if (type === 'tag' && !matched) {\n matched = !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId' && !matched) {\n matched = !!operation.getOperationId({ friendlyCase: true }).match(pattern)\n }\n\n if (type === 'path' && !matched) {\n matched = !!operation.path.match(pattern)\n }\n\n if (type === 'method' && !matched) {\n matched = !!method.match(pattern)\n }\n })\n\n return matched\n }\n\n #isIncluded(operation: Operation, method: HttpMethod): boolean {\n const { include = [] } = this.context\n let matched = false\n\n include.forEach(({ pattern, type }) => {\n if (type === 'tag' && !matched) {\n matched = !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId' && !matched) {\n matched = !!operation.getOperationId({ friendlyCase: true }).match(pattern)\n }\n\n if (type === 'path' && !matched) {\n matched = !!operation.path.match(pattern)\n }\n\n if (type === 'method' && !matched) {\n matched = !!method.match(pattern)\n }\n })\n\n return matched\n }\n\n getSchemas(\n operation: Operation,\n {\n resolveName = (name) => name,\n }: {\n resolveName?: (name: string) => string\n } = {},\n ): OperationSchemas {\n const pathParamsSchema = this.context.oas.getParametersSchema(operation, 'path')\n const queryParamsSchema = this.context.oas.getParametersSchema(operation, 'query')\n const headerParamsSchema = this.context.oas.getParametersSchema(operation, 'header')\n const requestSchema = this.context.oas.getRequestSchema(operation)\n const statusCodes = operation.getResponseStatusCodes().map((statusCode) => {\n let name = statusCode\n if (name === 'default') {\n name = 'error'\n }\n\n const schema = this.context.oas.getResponseSchema(operation, statusCode)\n\n return {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${name}`)),\n description: (operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject)?.description,\n schema,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),\n statusCode: name === 'error' ? undefined : Number(statusCode),\n keys: schema?.properties ? Object.keys(schema.properties) : undefined,\n keysToOmit: schema?.properties\n ? Object.keys(schema.properties).filter((key) => {\n const item = schema.properties?.[key] as OasTypes.SchemaObject\n return item?.writeOnly\n })\n : undefined,\n }\n })\n const hasResponses = statusCodes.some((item) => item.statusCode?.toString().startsWith('2'))\n\n return {\n pathParams: pathParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} PathParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),\n schema: pathParamsSchema,\n keys: pathParamsSchema.properties ? Object.keys(pathParamsSchema.properties) : undefined,\n }\n : undefined,\n queryParams: queryParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} QueryParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),\n schema: queryParamsSchema,\n keys: queryParamsSchema.properties ? Object.keys(queryParamsSchema.properties) : [],\n }\n : undefined,\n headerParams: headerParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} HeaderParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),\n schema: headerParamsSchema,\n keys: headerParamsSchema.properties ? Object.keys(headerParamsSchema.properties) : undefined,\n }\n : undefined,\n request: requestSchema\n ? {\n name: resolveName(\n transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${operation.method === 'get' ? 'queryRequest' : 'mutationRequest'}`),\n ),\n description: (operation.schema.requestBody as OasTypes.RequestBodyObject)?.description,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),\n schema: requestSchema,\n keys: requestSchema.properties ? Object.keys(requestSchema.properties) : undefined,\n keysToOmit: requestSchema.properties\n ? Object.keys(requestSchema.properties).filter((key) => {\n const item = requestSchema.properties?.[key] as OasTypes.SchemaObject\n\n return item?.readOnly\n })\n : undefined,\n }\n : undefined,\n response: {\n name: resolveName(\n transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${operation.method === 'get' ? 'queryResponse' : 'mutationResponse'}`),\n ),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),\n schema: {\n oneOf: hasResponses\n ? statusCodes\n .filter((item) => item.statusCode?.toString().startsWith('2'))\n .map((item) => {\n return {\n ...item.schema,\n $ref: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${item.statusCode}`)),\n }\n })\n : undefined,\n } as SchemaObject,\n },\n responses: statusCodes.filter((item) => item.statusCode?.toString().startsWith('2')),\n errors: statusCodes.filter((item) => item.statusCode?.toString().startsWith('4') || item.statusCode?.toString().startsWith('5')),\n statusCodes,\n }\n }\n\n #methods = ['get', 'post', 'patch', 'put', 'delete']\n\n async build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas } = this.context\n\n const paths = oas.getPaths()\n this.operationsByMethod = Object.entries(paths).reduce((acc, [path, method]) => {\n const methods = Object.keys(method) as HttpMethod[]\n\n methods.forEach((method) => {\n const operation = oas.operation(path, method)\n if (operation && [this.#methods].some((methods) => method === operation.method)) {\n const isExcluded = this.#isExcluded(operation, method)\n const isIncluded = this.context.include ? this.#isIncluded(operation, method) : true\n\n if (isIncluded && !isExcluded) {\n if (!acc[path]) {\n acc[path] = {} as OperationsByMethod['get']\n }\n acc[path] = {\n ...acc[path],\n [method]: {\n operation,\n schemas: this.getSchemas(operation),\n },\n } as OperationsByMethod['get']\n }\n }\n })\n\n return acc\n }, {} as OperationsByMethod)\n\n const promises = Object.keys(this.operationsByMethod).reduce((acc, path) => {\n const methods = this.operationsByMethod[path] ? (Object.keys(this.operationsByMethod[path]!) as HttpMethod[]) : []\n\n methods.forEach((method) => {\n const { operation } = this.operationsByMethod[path]?.[method]!\n const options = this.#getOptions(operation, method)\n\n const methodToCall = this[method as keyof typeof this] as any\n\n if (typeof methodToCall === 'function') {\n const promiseMethod = methodToCall?.call(this, operation, {\n ...this.options,\n ...options,\n })\n\n if (promiseMethod) {\n acc.push(promiseMethod)\n }\n }\n\n const promiseOperation = this.operation.call(this, operation, {\n ...this.options,\n ...options,\n })\n\n if (promiseOperation) {\n acc.push(promiseOperation)\n }\n\n generators?.forEach((generator) => {\n const promise = generator.operation?.({\n instance: this,\n operation,\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\n return acc\n }, [] as OperationMethodResult<TFileMeta>[])\n\n const operations = Object.values(this.operationsByMethod).map((item) => Object.values(item).map((item) => item.operation))\n\n promises.push(this.all(operations.flat().filter(Boolean), this.operationsByMethod))\n\n generators?.forEach((generator) => {\n const promise = generator.operations?.({\n instance: this,\n operations: operations.flat().filter(Boolean),\n operationsByMethod: this.operationsByMethod,\n options: this.options,\n } as any) as Promise<Array<KubbFile.File<TFileMeta>>>\n\n if (promise) {\n promises.push(promise)\n }\n })\n\n const files = await Promise.all(promises)\n\n // using .flat because operationGenerator[method] can return a array of files or just one file\n return files.flat().filter(Boolean)\n }\n\n /**\n * Operation\n */\n async operation(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {\n return []\n }\n /**\n * Combination of GET, POST, PATCH, PUT, DELETE\n */\n async all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta> {\n return []\n }\n}\n","import { FileManager, createPlugin } from '@kubb/core'\n\nimport { getSchemas } from './utils/getSchemas.ts'\nimport { parseFromConfig } from './utils/parseFromConfig.ts'\n\nimport path from 'node:path'\nimport type { Config } from '@kubb/core'\nimport type { Logger } from '@kubb/core/logger'\nimport type { Oas } from '@kubb/oas'\nimport { OperationGenerator } from './OperationGenerator.ts'\nimport { SchemaGenerator } from './SchemaGenerator.ts'\nimport { jsonGenerator } from './generators'\nimport type { PluginOas } from './types.ts'\n\nexport const pluginOasName = 'plugin-oas' satisfies PluginOas['name']\n\nexport const pluginOas = createPlugin<PluginOas>((options) => {\n const {\n output = {\n path: 'schemas',\n },\n validate = true,\n generators = [jsonGenerator],\n serverIndex,\n contentType,\n oasClass,\n } = options\n\n const getOas = async ({ config, logger }: { config: Config; logger: Logger }): Promise<Oas> => {\n try {\n // needs to be in a different variable or the catch here will not work(return of a promise instead)\n const oas = await parseFromConfig(config, oasClass)\n\n if (validate) {\n await oas.valdiate()\n }\n\n return oas\n } catch (e) {\n const error = e as Error\n\n logger.emit('warning', error?.message)\n return parseFromConfig(config, oasClass)\n }\n }\n\n return {\n name: pluginOasName,\n options: {\n output,\n ...options,\n },\n context() {\n const { config, logger } = this\n\n return {\n getOas() {\n return getOas({ config, logger })\n },\n async getSchemas({ includes } = {}) {\n const oas = await this.getOas()\n return getSchemas({ oas, contentType, includes })\n },\n async getBaseURL() {\n const oasInstance = await this.getOas()\n if (serverIndex) {\n return oasInstance.api.servers?.at(serverIndex)?.url\n }\n\n return undefined\n },\n contentType,\n }\n },\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n async buildStart() {\n if (!output) {\n return\n }\n\n const oas = await getOas({\n config: this.config,\n logger: this.logger,\n })\n await oas.dereference()\n\n const schemaGenerator = new SchemaGenerator(\n {\n unknownType: 'unknown',\n dateType: 'date',\n transformers: {},\n ...this.plugin.options,\n },\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override: undefined,\n mode: 'split',\n output: output.path,\n },\n )\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.addFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude: undefined,\n include: undefined,\n override: undefined,\n mode: 'split',\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n\n await this.addFile(...operationFiles)\n },\n }\n})\n"]}
|
package/dist/utils.cjs
CHANGED
|
@@ -39,7 +39,10 @@ function getASTParams(operationSchema, {
|
|
|
39
39
|
function getPathParams(operationSchema, options = {}) {
|
|
40
40
|
return getASTParams(operationSchema, options).reduce((acc, curr) => {
|
|
41
41
|
if (curr.name && curr.enabled) {
|
|
42
|
-
|
|
42
|
+
let name = transformers.isValidVarName(curr.name) ? curr.name : transformers.camelCase(curr.name);
|
|
43
|
+
if (options.casing === "camelcase") {
|
|
44
|
+
name = transformers.camelCase(name);
|
|
45
|
+
}
|
|
43
46
|
acc[name] = {
|
|
44
47
|
default: curr.default,
|
|
45
48
|
type: curr.type,
|
package/dist/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/getComments.ts","../src/utils/getParams.ts"],"names":["URLPath","transformers","isParameterObject","isValidVarName","camelCase"],"mappings":";;;;;;;;;;;;AAKO,SAAS,YAAY,SAAgC,EAAA;AAC1D,EAAO,OAAA;AAAA,IACL,UAAU,cAAe,EAAA,IAAK,CAAgB,aAAA,EAAA,SAAA,CAAU,gBAAgB,CAAA,CAAA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AAO,EAAA,CAAA,GAAA,KAAA;AAAA,KACvD;AAEA,IAAO,OAAA,QAAA,GAAW,QAAS,CAAA,IAAI,CAAI,GAAA,IAAA;AAAA,GACpC,CAAA;AACH;AAEO,SAAS,aACd,CAAA,eAAA,EACA,OAII,GAAA,EACJ,EAAA;AACA,EAAA,OAAO,aAAa,eAAiB,EAAA,OAAO,EAAE,MAAO,CAAA,CAAC,KAAK,IAAS,KAAA;AAClE,IAAI,IAAA,IAAA,CAAK,IAAQ,IAAA,IAAA,CAAK,OAAS,EAAA;AAC7B,MAAI,IAAA,IAAA,GAAOC,4BAAe,IAAK,CAAA,IAAI,IAAI,IAAK,CAAA,IAAA,GAAOC,sBAAU,CAAA,IAAA,CAAK,IAAI,CAAA;AAEtE,MAAI,IAAA,OAAA,CAAQ,WAAW,WAAa,EAAA;AAClC,QAAA,IAAA,GAAOA,uBAAU,IAAI,CAAA;AAAA;AAGvB,MAAA,GAAA,CAAI,IAAI,CAAI,GAAA;AAAA,QACV,SAAS,IAAK,CAAA,OAAA;AAAA,QACd,MAAM,IAAK,CAAA,IAAA;AAAA,QACX,QAAA,EAAU,CAAC,IAAK,CAAA;AAAA,OAClB;AAAA;AAGF,IAAO,OAAA,GAAA;AAAA,GACT,EAAG,EAAY,CAAA;AACjB","file":"utils.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"]}
|
package/dist/utils.d.cts
CHANGED
|
@@ -2,8 +2,8 @@ import { Operation, Oas, SchemaObject, OpenAPIV3, OpenAPIV3_1 } from '@kubb/oas'
|
|
|
2
2
|
export { isOptional } from '@kubb/oas';
|
|
3
3
|
import { FunctionParamsAST } from '@kubb/core/utils';
|
|
4
4
|
import { Params } from '@kubb/react/types';
|
|
5
|
-
import { v as OperationSchema } from './OperationGenerator-
|
|
6
|
-
export { z as GetSchemasProps, B as getSchemas } from './OperationGenerator-
|
|
5
|
+
import { v as OperationSchema } from './OperationGenerator-DSwDeEnz.cjs';
|
|
6
|
+
export { z as GetSchemasProps, B as getSchemas } from './OperationGenerator-DSwDeEnz.cjs';
|
|
7
7
|
import { Config } from '@kubb/core';
|
|
8
8
|
import '@kubb/fs/types';
|
|
9
9
|
|
|
@@ -20,6 +20,7 @@ declare function getASTParams(operationSchema: OperationSchema | undefined, { ty
|
|
|
20
20
|
}): FunctionParamsAST[];
|
|
21
21
|
declare function getPathParams(operationSchema: OperationSchema | undefined, options?: {
|
|
22
22
|
typed?: boolean;
|
|
23
|
+
casing?: 'camelcase';
|
|
23
24
|
override?: (data: FunctionParamsAST) => FunctionParamsAST;
|
|
24
25
|
}): Params;
|
|
25
26
|
|
package/dist/utils.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { Operation, Oas, SchemaObject, OpenAPIV3, OpenAPIV3_1 } from '@kubb/oas'
|
|
|
2
2
|
export { isOptional } from '@kubb/oas';
|
|
3
3
|
import { FunctionParamsAST } from '@kubb/core/utils';
|
|
4
4
|
import { Params } from '@kubb/react/types';
|
|
5
|
-
import { v as OperationSchema } from './OperationGenerator-
|
|
6
|
-
export { z as GetSchemasProps, B as getSchemas } from './OperationGenerator-
|
|
5
|
+
import { v as OperationSchema } from './OperationGenerator-DSwDeEnz.js';
|
|
6
|
+
export { z as GetSchemasProps, B as getSchemas } from './OperationGenerator-DSwDeEnz.js';
|
|
7
7
|
import { Config } from '@kubb/core';
|
|
8
8
|
import '@kubb/fs/types';
|
|
9
9
|
|
|
@@ -20,6 +20,7 @@ declare function getASTParams(operationSchema: OperationSchema | undefined, { ty
|
|
|
20
20
|
}): FunctionParamsAST[];
|
|
21
21
|
declare function getPathParams(operationSchema: OperationSchema | undefined, options?: {
|
|
22
22
|
typed?: boolean;
|
|
23
|
+
casing?: 'camelcase';
|
|
23
24
|
override?: (data: FunctionParamsAST) => FunctionParamsAST;
|
|
24
25
|
}): Params;
|
|
25
26
|
|
package/dist/utils.js
CHANGED
|
@@ -34,7 +34,10 @@ function getASTParams(operationSchema, {
|
|
|
34
34
|
function getPathParams(operationSchema, options = {}) {
|
|
35
35
|
return getASTParams(operationSchema, options).reduce((acc, curr) => {
|
|
36
36
|
if (curr.name && curr.enabled) {
|
|
37
|
-
|
|
37
|
+
let name = isValidVarName(curr.name) ? curr.name : camelCase(curr.name);
|
|
38
|
+
if (options.casing === "camelcase") {
|
|
39
|
+
name = camelCase(name);
|
|
40
|
+
}
|
|
38
41
|
acc[name] = {
|
|
39
42
|
default: curr.default,
|
|
40
43
|
type: curr.type,
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/getComments.ts","../src/utils/getParams.ts"],"names":[],"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,IAAI,QAAQ,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,KAAA,YAAA,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,OAA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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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-oas",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Generator swagger",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -76,18 +76,18 @@
|
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@stoplight/yaml": "^4.3.0",
|
|
78
78
|
"remeda": "^2.17.4",
|
|
79
|
-
"@kubb/core": "3.
|
|
80
|
-
"@kubb/fs": "3.
|
|
81
|
-
"@kubb/oas": "3.
|
|
82
|
-
"@kubb/react": "3.
|
|
79
|
+
"@kubb/core": "3.2.0",
|
|
80
|
+
"@kubb/fs": "3.2.0",
|
|
81
|
+
"@kubb/oas": "3.2.0",
|
|
82
|
+
"@kubb/react": "3.2.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@types/react": "^18.3.
|
|
85
|
+
"@types/react": "^18.3.16",
|
|
86
86
|
"react": "^18.3.1",
|
|
87
87
|
"tsup": "^8.3.5",
|
|
88
88
|
"typescript": "^5.7.2",
|
|
89
|
-
"@kubb/config-ts": "3.
|
|
90
|
-
"@kubb/config-tsup": "3.
|
|
89
|
+
"@kubb/config-ts": "3.2.0",
|
|
90
|
+
"@kubb/config-tsup": "3.2.0"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"@kubb/react": "^3.0.0"
|
|
@@ -48,7 +48,7 @@ export class OperationGenerator<
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
if (type === 'operationId') {
|
|
51
|
-
return !!operation.getOperationId().match(pattern)
|
|
51
|
+
return !!operation.getOperationId({ friendlyCase: true }).match(pattern)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
if (type === 'path') {
|
|
@@ -74,7 +74,7 @@ export class OperationGenerator<
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
if (type === 'operationId' && !matched) {
|
|
77
|
-
matched = !!operation.getOperationId().match(pattern)
|
|
77
|
+
matched = !!operation.getOperationId({ friendlyCase: true }).match(pattern)
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
if (type === 'path' && !matched) {
|
|
@@ -99,7 +99,7 @@ export class OperationGenerator<
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
if (type === 'operationId' && !matched) {
|
|
102
|
-
matched = !!operation.getOperationId().match(pattern)
|
|
102
|
+
matched = !!operation.getOperationId({ friendlyCase: true }).match(pattern)
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
if (type === 'path' && !matched) {
|
|
@@ -135,11 +135,11 @@ export class OperationGenerator<
|
|
|
135
135
|
const schema = this.context.oas.getResponseSchema(operation, statusCode)
|
|
136
136
|
|
|
137
137
|
return {
|
|
138
|
-
name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${name}`)),
|
|
138
|
+
name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${name}`)),
|
|
139
139
|
description: (operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject)?.description,
|
|
140
140
|
schema,
|
|
141
141
|
operation,
|
|
142
|
-
operationName: transformers.pascalCase(`${operation.getOperationId()}`),
|
|
142
|
+
operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
143
143
|
statusCode: name === 'error' ? undefined : Number(statusCode),
|
|
144
144
|
keys: schema?.properties ? Object.keys(schema.properties) : undefined,
|
|
145
145
|
keysToOmit: schema?.properties
|
|
@@ -155,37 +155,39 @@ export class OperationGenerator<
|
|
|
155
155
|
return {
|
|
156
156
|
pathParams: pathParamsSchema
|
|
157
157
|
? {
|
|
158
|
-
name: resolveName(transformers.pascalCase(`${operation.getOperationId()} PathParams`)),
|
|
158
|
+
name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} PathParams`)),
|
|
159
159
|
operation,
|
|
160
|
-
operationName: transformers.pascalCase(`${operation.getOperationId()}`),
|
|
160
|
+
operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
161
161
|
schema: pathParamsSchema,
|
|
162
162
|
keys: pathParamsSchema.properties ? Object.keys(pathParamsSchema.properties) : undefined,
|
|
163
163
|
}
|
|
164
164
|
: undefined,
|
|
165
165
|
queryParams: queryParamsSchema
|
|
166
166
|
? {
|
|
167
|
-
name: resolveName(transformers.pascalCase(`${operation.getOperationId()} QueryParams`)),
|
|
167
|
+
name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} QueryParams`)),
|
|
168
168
|
operation,
|
|
169
|
-
operationName: transformers.pascalCase(`${operation.getOperationId()}`),
|
|
169
|
+
operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
170
170
|
schema: queryParamsSchema,
|
|
171
171
|
keys: queryParamsSchema.properties ? Object.keys(queryParamsSchema.properties) : [],
|
|
172
172
|
}
|
|
173
173
|
: undefined,
|
|
174
174
|
headerParams: headerParamsSchema
|
|
175
175
|
? {
|
|
176
|
-
name: resolveName(transformers.pascalCase(`${operation.getOperationId()} HeaderParams`)),
|
|
176
|
+
name: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} HeaderParams`)),
|
|
177
177
|
operation,
|
|
178
|
-
operationName: transformers.pascalCase(`${operation.getOperationId()}`),
|
|
178
|
+
operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
179
179
|
schema: headerParamsSchema,
|
|
180
180
|
keys: headerParamsSchema.properties ? Object.keys(headerParamsSchema.properties) : undefined,
|
|
181
181
|
}
|
|
182
182
|
: undefined,
|
|
183
183
|
request: requestSchema
|
|
184
184
|
? {
|
|
185
|
-
name: resolveName(
|
|
185
|
+
name: resolveName(
|
|
186
|
+
transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${operation.method === 'get' ? 'queryRequest' : 'mutationRequest'}`),
|
|
187
|
+
),
|
|
186
188
|
description: (operation.schema.requestBody as OasTypes.RequestBodyObject)?.description,
|
|
187
189
|
operation,
|
|
188
|
-
operationName: transformers.pascalCase(`${operation.getOperationId()}`),
|
|
190
|
+
operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
189
191
|
schema: requestSchema,
|
|
190
192
|
keys: requestSchema.properties ? Object.keys(requestSchema.properties) : undefined,
|
|
191
193
|
keysToOmit: requestSchema.properties
|
|
@@ -198,9 +200,11 @@ export class OperationGenerator<
|
|
|
198
200
|
}
|
|
199
201
|
: undefined,
|
|
200
202
|
response: {
|
|
201
|
-
name: resolveName(
|
|
203
|
+
name: resolveName(
|
|
204
|
+
transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${operation.method === 'get' ? 'queryResponse' : 'mutationResponse'}`),
|
|
205
|
+
),
|
|
202
206
|
operation,
|
|
203
|
-
operationName: transformers.pascalCase(`${operation.getOperationId()}`),
|
|
207
|
+
operationName: transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })}`),
|
|
204
208
|
schema: {
|
|
205
209
|
oneOf: hasResponses
|
|
206
210
|
? statusCodes
|
|
@@ -208,7 +212,7 @@ export class OperationGenerator<
|
|
|
208
212
|
.map((item) => {
|
|
209
213
|
return {
|
|
210
214
|
...item.schema,
|
|
211
|
-
$ref: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${item.statusCode}`)),
|
|
215
|
+
$ref: resolveName(transformers.pascalCase(`${operation.getOperationId({ friendlyCase: true })} ${item.statusCode}`)),
|
|
212
216
|
}
|
|
213
217
|
})
|
|
214
218
|
: undefined,
|
|
@@ -330,41 +334,6 @@ export class OperationGenerator<
|
|
|
330
334
|
async operation(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {
|
|
331
335
|
return []
|
|
332
336
|
}
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* GET
|
|
336
|
-
*/
|
|
337
|
-
async get(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {
|
|
338
|
-
return []
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* POST
|
|
343
|
-
*/
|
|
344
|
-
async post(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {
|
|
345
|
-
return []
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* PATCH
|
|
349
|
-
*/
|
|
350
|
-
async patch(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {
|
|
351
|
-
return []
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* PUT
|
|
356
|
-
*/
|
|
357
|
-
async put(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {
|
|
358
|
-
return []
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* DELETE
|
|
363
|
-
*/
|
|
364
|
-
async delete(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta> {
|
|
365
|
-
return []
|
|
366
|
-
}
|
|
367
|
-
|
|
368
337
|
/**
|
|
369
338
|
* Combination of GET, POST, PATCH, PUT, DELETE
|
|
370
339
|
*/
|
package/src/utils/getParams.ts
CHANGED
|
@@ -41,12 +41,18 @@ export function getPathParams(
|
|
|
41
41
|
operationSchema: OperationSchema | undefined,
|
|
42
42
|
options: {
|
|
43
43
|
typed?: boolean
|
|
44
|
+
casing?: 'camelcase'
|
|
44
45
|
override?: (data: FunctionParamsAST) => FunctionParamsAST
|
|
45
46
|
} = {},
|
|
46
47
|
) {
|
|
47
48
|
return getASTParams(operationSchema, options).reduce((acc, curr) => {
|
|
48
49
|
if (curr.name && curr.enabled) {
|
|
49
|
-
|
|
50
|
+
let name = isValidVarName(curr.name) ? curr.name : camelCase(curr.name)
|
|
51
|
+
|
|
52
|
+
if (options.casing === 'camelcase') {
|
|
53
|
+
name = camelCase(name)
|
|
54
|
+
}
|
|
55
|
+
|
|
50
56
|
acc[name] = {
|
|
51
57
|
default: curr.default,
|
|
52
58
|
type: curr.type,
|