@kubb/plugin-oas 5.0.0-alpha.1 → 5.0.0-alpha.11
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/{createGenerator-CBXpHeVY.d.ts → createGenerator-Cl7uTbJt.d.ts} +67 -61
- package/dist/{generators-CyWd3UXA.cjs → generators-BfTTScuN.cjs} +7 -7
- package/dist/generators-BfTTScuN.cjs.map +1 -0
- package/dist/{generators-D7C3CXsN.js → generators-BjsINk-u.js} +7 -7
- package/dist/generators-BjsINk-u.js.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +2 -2
- package/dist/generators.js +1 -1
- package/dist/hooks.cjs +44 -63
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.ts +15 -32
- package/dist/hooks.js +47 -65
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +15 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +22 -38
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/{requestBody-mUXoBwsu.js → requestBody-BK5uH1dh.js} +80 -119
- package/dist/requestBody-BK5uH1dh.js.map +1 -0
- package/dist/{requestBody-DIM-iDpM.cjs → requestBody-tngRbzVa.cjs} +90 -129
- package/dist/requestBody-tngRbzVa.cjs.map +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +7 -7
- package/src/OperationGenerator.ts +15 -15
- package/src/SchemaGenerator.ts +21 -24
- package/src/generators/createGenerator.ts +12 -15
- package/src/generators/createReactGenerator.ts +12 -15
- package/src/generators/jsonGenerator.ts +4 -4
- package/src/generators/types.ts +5 -40
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useOas.ts +5 -2
- package/src/hooks/useOperationManager.ts +36 -35
- package/src/hooks/useSchemaManager.ts +16 -15
- package/src/index.ts +2 -2
- package/src/plugin.ts +6 -6
- package/src/types.ts +7 -6
- package/src/utils.tsx +50 -137
- package/dist/generators-CyWd3UXA.cjs.map +0 -1
- package/dist/generators-D7C3CXsN.js.map +0 -1
- package/dist/requestBody-DIM-iDpM.cjs.map +0 -1
- package/dist/requestBody-mUXoBwsu.js.map +0 -1
- package/src/hooks/useRootNode.ts +0 -25
package/src/generators/types.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Config, Plugin, PluginFactoryOptions } from '@kubb/core'
|
|
1
|
+
import type { Config, Generator as CoreV2Generator, Plugin, PluginFactoryOptions } from '@kubb/core'
|
|
3
2
|
import type { Operation, SchemaObject } from '@kubb/oas'
|
|
4
3
|
import type { OperationGenerator } from '../OperationGenerator.ts'
|
|
5
4
|
import type { SchemaGenerator, SchemaGeneratorOptions } from '../SchemaGenerator.ts'
|
|
@@ -7,43 +6,21 @@ import type { Schema } from '../SchemaMapper.ts'
|
|
|
7
6
|
import type { CoreGenerator } from './createGenerator.ts'
|
|
8
7
|
import type { ReactGenerator } from './createReactGenerator.ts'
|
|
9
8
|
|
|
10
|
-
export type
|
|
11
|
-
|
|
12
|
-
export type OperationsV1Props<TOptions extends PluginFactoryOptions> = {
|
|
9
|
+
export type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
13
10
|
config: Config
|
|
14
11
|
generator: Omit<OperationGenerator<TOptions>, 'build'>
|
|
15
12
|
plugin: Plugin<TOptions>
|
|
16
13
|
operations: Array<Operation>
|
|
17
14
|
}
|
|
18
15
|
|
|
19
|
-
export type
|
|
20
|
-
config: Config
|
|
21
|
-
plugin: Plugin<TOptions>
|
|
22
|
-
nodes: Array<OperationNode>
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export type OperationV1Props<TOptions extends PluginFactoryOptions> = {
|
|
16
|
+
export type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
26
17
|
config: Config
|
|
27
18
|
generator: Omit<OperationGenerator<TOptions>, 'build'>
|
|
28
19
|
plugin: Plugin<TOptions>
|
|
29
20
|
operation: Operation
|
|
30
21
|
}
|
|
31
22
|
|
|
32
|
-
export type
|
|
33
|
-
config: Config
|
|
34
|
-
plugin: Plugin<TOptions>
|
|
35
|
-
node: OperationNode
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export type OperationsProps<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'> = TVersion extends '2'
|
|
39
|
-
? OperationsV2Props<TOptions>
|
|
40
|
-
: OperationsV1Props<TOptions>
|
|
41
|
-
|
|
42
|
-
export type OperationProps<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'> = TVersion extends '2'
|
|
43
|
-
? OperationV2Props<TOptions>
|
|
44
|
-
: OperationV1Props<TOptions>
|
|
45
|
-
|
|
46
|
-
export type SchemaV1Props<TOptions extends PluginFactoryOptions> = {
|
|
23
|
+
export type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
47
24
|
config: Config
|
|
48
25
|
generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>
|
|
49
26
|
plugin: Plugin<TOptions>
|
|
@@ -54,16 +31,4 @@ export type SchemaV1Props<TOptions extends PluginFactoryOptions> = {
|
|
|
54
31
|
}
|
|
55
32
|
}
|
|
56
33
|
|
|
57
|
-
export type
|
|
58
|
-
config: Config
|
|
59
|
-
plugin: Plugin<TOptions>
|
|
60
|
-
node: SchemaNode
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export type SchemaProps<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'> = TVersion extends '2'
|
|
64
|
-
? SchemaV2Props<TOptions>
|
|
65
|
-
: SchemaV1Props<TOptions>
|
|
66
|
-
|
|
67
|
-
export type Generator<TOptions extends PluginFactoryOptions, TVersion extends Version = Version> =
|
|
68
|
-
| CoreGenerator<TOptions, TVersion>
|
|
69
|
-
| ReactGenerator<TOptions, TVersion>
|
|
34
|
+
export type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions> | CoreV2Generator<TOptions>
|
package/src/hooks/index.ts
CHANGED
package/src/hooks/useOas.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { Oas } from '@kubb/oas'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { useFabric } from '@kubb/react-fabric'
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated use schemaNode or operationNode instead
|
|
7
|
+
*/
|
|
5
8
|
export function useOas(): Oas {
|
|
6
|
-
const { meta } =
|
|
9
|
+
const { meta } = useFabric<{ oas: Oas }>()
|
|
7
10
|
|
|
8
11
|
return meta.oas
|
|
9
12
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { FileMetaBase,
|
|
2
|
-
import { usePlugin,
|
|
1
|
+
import type { FileMetaBase, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
|
|
2
|
+
import { usePlugin, usePluginDriver } from '@kubb/core/hooks'
|
|
3
3
|
import type { KubbFile } from '@kubb/fabric-core/types'
|
|
4
4
|
import type { Operation, Operation as OperationType } from '@kubb/oas'
|
|
5
5
|
import type { OperationGenerator } from '../OperationGenerator.ts'
|
|
6
6
|
import type { OperationSchemas } from '../types.ts'
|
|
7
7
|
|
|
8
8
|
type FileMeta = FileMetaBase & {
|
|
9
|
-
|
|
9
|
+
pluginName: string
|
|
10
10
|
name: string
|
|
11
11
|
group?: {
|
|
12
12
|
tag?: string
|
|
@@ -31,7 +31,7 @@ type UseOperationManagerResult = {
|
|
|
31
31
|
params: {
|
|
32
32
|
prefix?: string
|
|
33
33
|
suffix?: string
|
|
34
|
-
|
|
34
|
+
pluginName?: string
|
|
35
35
|
type: ResolveNameParams['type']
|
|
36
36
|
},
|
|
37
37
|
) => string
|
|
@@ -40,7 +40,7 @@ type UseOperationManagerResult = {
|
|
|
40
40
|
params?: {
|
|
41
41
|
prefix?: string
|
|
42
42
|
suffix?: string
|
|
43
|
-
|
|
43
|
+
pluginName?: string
|
|
44
44
|
extname?: KubbFile.Extname
|
|
45
45
|
group?: {
|
|
46
46
|
tag?: string
|
|
@@ -51,11 +51,11 @@ type UseOperationManagerResult = {
|
|
|
51
51
|
groupSchemasByName: (
|
|
52
52
|
operation: OperationType,
|
|
53
53
|
params: {
|
|
54
|
-
|
|
54
|
+
pluginName?: string
|
|
55
55
|
type: ResolveNameParams['type']
|
|
56
56
|
},
|
|
57
57
|
) => SchemaNames
|
|
58
|
-
getSchemas: (operation: Operation, params?: {
|
|
58
|
+
getSchemas: (operation: Operation, params?: { pluginName?: string; type?: ResolveNameParams['type'] }) => OperationSchemas
|
|
59
59
|
getGroup: (operation: Operation) => FileMeta['group'] | undefined
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -66,12 +66,13 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
|
|
|
66
66
|
generator: Omit<OperationGenerator<TPluginOptions>, 'build'>,
|
|
67
67
|
): UseOperationManagerResult {
|
|
68
68
|
const plugin = usePlugin()
|
|
69
|
-
const
|
|
69
|
+
const driver = usePluginDriver()
|
|
70
|
+
const defaultPluginName = plugin.name
|
|
70
71
|
|
|
71
|
-
const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '',
|
|
72
|
-
return
|
|
72
|
+
const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '', pluginName = defaultPluginName, type }) => {
|
|
73
|
+
return driver.resolveName({
|
|
73
74
|
name: `${prefix} ${operation.getOperationId()} ${suffix}`,
|
|
74
|
-
|
|
75
|
+
pluginName,
|
|
75
76
|
type,
|
|
76
77
|
})
|
|
77
78
|
}
|
|
@@ -90,23 +91,23 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
|
|
|
90
91
|
|
|
91
92
|
return generator.getSchemas(operation, {
|
|
92
93
|
resolveName: (name) =>
|
|
93
|
-
|
|
94
|
+
driver.resolveName({
|
|
94
95
|
name,
|
|
95
|
-
|
|
96
|
+
pluginName: params?.pluginName ?? defaultPluginName,
|
|
96
97
|
type: params?.type,
|
|
97
98
|
}),
|
|
98
99
|
})
|
|
99
100
|
}
|
|
100
101
|
|
|
101
|
-
const getFile: UseOperationManagerResult['getFile'] = (operation, { prefix, suffix,
|
|
102
|
-
const name = getName(operation, { type: 'file',
|
|
102
|
+
const getFile: UseOperationManagerResult['getFile'] = (operation, { prefix, suffix, pluginName = defaultPluginName, extname = '.ts' } = {}) => {
|
|
103
|
+
const name = getName(operation, { type: 'file', pluginName, prefix, suffix })
|
|
103
104
|
const group = getGroup(operation)
|
|
104
105
|
|
|
105
|
-
const file =
|
|
106
|
+
const file = driver.getFile({
|
|
106
107
|
name,
|
|
107
108
|
extname,
|
|
108
|
-
|
|
109
|
-
options: { type: 'file',
|
|
109
|
+
pluginName,
|
|
110
|
+
options: { type: 'file', pluginName, group },
|
|
110
111
|
})
|
|
111
112
|
|
|
112
113
|
return {
|
|
@@ -114,18 +115,18 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
|
|
|
114
115
|
meta: {
|
|
115
116
|
...file.meta,
|
|
116
117
|
name,
|
|
117
|
-
|
|
118
|
+
pluginName,
|
|
118
119
|
group,
|
|
119
120
|
},
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
const groupSchemasByName: UseOperationManagerResult['groupSchemasByName'] = (operation, {
|
|
124
|
+
const groupSchemasByName: UseOperationManagerResult['groupSchemasByName'] = (operation, { pluginName = defaultPluginName, type }) => {
|
|
124
125
|
if (!generator) {
|
|
125
126
|
throw new Error(`useOperationManager: 'generator' parameter is required but was not provided`)
|
|
126
127
|
}
|
|
127
128
|
|
|
128
|
-
const schemas =
|
|
129
|
+
const schemas = getSchemas(operation)
|
|
129
130
|
|
|
130
131
|
const errors = (schemas.errors || []).reduce(
|
|
131
132
|
(prev, acc) => {
|
|
@@ -133,9 +134,9 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
|
|
|
133
134
|
return prev
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
prev[acc.statusCode] =
|
|
137
|
+
prev[acc.statusCode] = driver.resolveName({
|
|
137
138
|
name: acc.name,
|
|
138
|
-
|
|
139
|
+
pluginName,
|
|
139
140
|
type,
|
|
140
141
|
})
|
|
141
142
|
|
|
@@ -150,9 +151,9 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
|
|
|
150
151
|
return prev
|
|
151
152
|
}
|
|
152
153
|
|
|
153
|
-
prev[acc.statusCode] =
|
|
154
|
+
prev[acc.statusCode] = driver.resolveName({
|
|
154
155
|
name: acc.name,
|
|
155
|
-
|
|
156
|
+
pluginName,
|
|
156
157
|
type,
|
|
157
158
|
})
|
|
158
159
|
|
|
@@ -163,40 +164,40 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
|
|
|
163
164
|
|
|
164
165
|
return {
|
|
165
166
|
request: schemas.request?.name
|
|
166
|
-
?
|
|
167
|
+
? driver.resolveName({
|
|
167
168
|
name: schemas.request.name,
|
|
168
|
-
|
|
169
|
+
pluginName,
|
|
169
170
|
type,
|
|
170
171
|
})
|
|
171
172
|
: undefined,
|
|
172
173
|
parameters: {
|
|
173
174
|
path: schemas.pathParams?.name
|
|
174
|
-
?
|
|
175
|
+
? driver.resolveName({
|
|
175
176
|
name: schemas.pathParams.name,
|
|
176
|
-
|
|
177
|
+
pluginName,
|
|
177
178
|
type,
|
|
178
179
|
})
|
|
179
180
|
: undefined,
|
|
180
181
|
query: schemas.queryParams?.name
|
|
181
|
-
?
|
|
182
|
+
? driver.resolveName({
|
|
182
183
|
name: schemas.queryParams.name,
|
|
183
|
-
|
|
184
|
+
pluginName,
|
|
184
185
|
type,
|
|
185
186
|
})
|
|
186
187
|
: undefined,
|
|
187
188
|
header: schemas.headerParams?.name
|
|
188
|
-
?
|
|
189
|
+
? driver.resolveName({
|
|
189
190
|
name: schemas.headerParams.name,
|
|
190
|
-
|
|
191
|
+
pluginName,
|
|
191
192
|
type,
|
|
192
193
|
})
|
|
193
194
|
: undefined,
|
|
194
195
|
},
|
|
195
196
|
responses: {
|
|
196
197
|
...responses,
|
|
197
|
-
['default']:
|
|
198
|
+
['default']: driver.resolveName({
|
|
198
199
|
name: schemas.response.name,
|
|
199
|
-
|
|
200
|
+
pluginName,
|
|
200
201
|
type,
|
|
201
202
|
}),
|
|
202
203
|
...errors,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { FileMetaBase,
|
|
2
|
-
import { usePlugin,
|
|
1
|
+
import type { FileMetaBase, ResolveNameParams } from '@kubb/core'
|
|
2
|
+
import { usePlugin, usePluginDriver } from '@kubb/core/hooks'
|
|
3
3
|
import type { KubbFile } from '@kubb/fabric-core/types'
|
|
4
4
|
|
|
5
5
|
type FileMeta = FileMetaBase & {
|
|
6
|
-
|
|
6
|
+
pluginName: string
|
|
7
7
|
name: string
|
|
8
8
|
group?: {
|
|
9
9
|
tag?: string
|
|
@@ -12,11 +12,11 @@ type FileMeta = FileMetaBase & {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
type UseSchemaManagerResult = {
|
|
15
|
-
getName: (name: string, params: {
|
|
15
|
+
getName: (name: string, params: { pluginName?: string; type: ResolveNameParams['type'] }) => string
|
|
16
16
|
getFile: (
|
|
17
17
|
name: string,
|
|
18
18
|
params?: {
|
|
19
|
-
|
|
19
|
+
pluginName?: string
|
|
20
20
|
mode?: KubbFile.Mode
|
|
21
21
|
extname?: KubbFile.Extname
|
|
22
22
|
group?: {
|
|
@@ -29,27 +29,28 @@ type UseSchemaManagerResult = {
|
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* `useSchemaManager` returns helper functions to get the schema file and schema name.
|
|
32
|
+
* @deprecated
|
|
32
33
|
*/
|
|
33
34
|
export function useSchemaManager(): UseSchemaManagerResult {
|
|
34
35
|
const plugin = usePlugin()
|
|
35
|
-
const
|
|
36
|
+
const driver = usePluginDriver()
|
|
36
37
|
|
|
37
|
-
const getName: UseSchemaManagerResult['getName'] = (name, {
|
|
38
|
-
return
|
|
38
|
+
const getName: UseSchemaManagerResult['getName'] = (name, { pluginName = plugin.name, type }) => {
|
|
39
|
+
return driver.resolveName({
|
|
39
40
|
name,
|
|
40
|
-
|
|
41
|
+
pluginName,
|
|
41
42
|
type,
|
|
42
43
|
})
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
const getFile: UseSchemaManagerResult['getFile'] = (name, { mode = 'split',
|
|
46
|
-
const resolvedName = mode === 'single' ? '' : getName(name, { type: 'file',
|
|
46
|
+
const getFile: UseSchemaManagerResult['getFile'] = (name, { mode = 'split', pluginName = plugin.name, extname = '.ts', group } = {}) => {
|
|
47
|
+
const resolvedName = mode === 'single' ? '' : getName(name, { type: 'file', pluginName })
|
|
47
48
|
|
|
48
|
-
const file =
|
|
49
|
+
const file = driver.getFile({
|
|
49
50
|
name: resolvedName,
|
|
50
51
|
extname,
|
|
51
|
-
|
|
52
|
-
options: { type: 'file',
|
|
52
|
+
pluginName,
|
|
53
|
+
options: { type: 'file', pluginName, group },
|
|
53
54
|
})
|
|
54
55
|
|
|
55
56
|
return {
|
|
@@ -57,7 +58,7 @@ export function useSchemaManager(): UseSchemaManagerResult {
|
|
|
57
58
|
meta: {
|
|
58
59
|
...file.meta,
|
|
59
60
|
name: resolvedName,
|
|
60
|
-
|
|
61
|
+
pluginName,
|
|
61
62
|
},
|
|
62
63
|
}
|
|
63
64
|
}
|
package/src/index.ts
CHANGED
|
@@ -25,7 +25,7 @@ export type {
|
|
|
25
25
|
} from './SchemaMapper.ts'
|
|
26
26
|
export { isKeyword, schemaKeywords } from './SchemaMapper.ts'
|
|
27
27
|
export type * from './types.ts'
|
|
28
|
-
export {
|
|
28
|
+
export { renderOperation, renderOperations, renderSchema } from './utils.tsx'
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* @deprecated use `import { createGenerator } from '@kubb/plugin-oas/generators'`
|
|
@@ -40,4 +40,4 @@ export const createReactGenerator = _createReactGenerator
|
|
|
40
40
|
/**
|
|
41
41
|
* @deprecated use `import { Generator } from '@kubb/plugin-oas/generators'`
|
|
42
42
|
*/
|
|
43
|
-
export type Generator<TOptions extends PluginFactoryOptions
|
|
43
|
+
export type Generator<TOptions extends PluginFactoryOptions> = _Generator<TOptions>
|
package/src/plugin.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
|
+
import type { AsyncEventEmitter } from '@internals/utils'
|
|
2
3
|
import { camelCase } from '@internals/utils'
|
|
3
|
-
import type
|
|
4
|
-
import { type Config, definePlugin, type Group, getMode, type KubbEvents } from '@kubb/core'
|
|
4
|
+
import { type Config, createPlugin, type Group, getMode, type KubbEvents } from '@kubb/core'
|
|
5
5
|
import type { Oas } from '@kubb/oas'
|
|
6
6
|
import { parseFromConfig, resolveServerUrl } from '@kubb/oas'
|
|
7
7
|
import { jsonGenerator } from './generators'
|
|
@@ -11,7 +11,7 @@ import type { PluginOas } from './types.ts'
|
|
|
11
11
|
|
|
12
12
|
export const pluginOasName = 'plugin-oas' satisfies PluginOas['name']
|
|
13
13
|
|
|
14
|
-
export const pluginOas =
|
|
14
|
+
export const pluginOas = createPlugin<PluginOas>((options) => {
|
|
15
15
|
const {
|
|
16
16
|
output = {
|
|
17
17
|
path: 'schemas',
|
|
@@ -135,7 +135,7 @@ export const pluginOas = definePlugin<PluginOas>((options) => {
|
|
|
135
135
|
async install() {
|
|
136
136
|
const oas = await this.getOas({ validate })
|
|
137
137
|
|
|
138
|
-
if (!output) {
|
|
138
|
+
if (!output || generators.length === 0) {
|
|
139
139
|
return
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -152,7 +152,7 @@ export const pluginOas = definePlugin<PluginOas>((options) => {
|
|
|
152
152
|
{
|
|
153
153
|
fabric: this.fabric,
|
|
154
154
|
oas,
|
|
155
|
-
|
|
155
|
+
driver: this.driver,
|
|
156
156
|
events: this.events,
|
|
157
157
|
plugin: this.plugin,
|
|
158
158
|
contentType,
|
|
@@ -169,7 +169,7 @@ export const pluginOas = definePlugin<PluginOas>((options) => {
|
|
|
169
169
|
const operationGenerator = new OperationGenerator(this.plugin.options, {
|
|
170
170
|
fabric: this.fabric,
|
|
171
171
|
oas,
|
|
172
|
-
|
|
172
|
+
driver: this.driver,
|
|
173
173
|
events: this.events,
|
|
174
174
|
plugin: this.plugin,
|
|
175
175
|
contentType,
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Group, Output,
|
|
1
|
+
import type { Group, Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
|
|
2
2
|
import type { KubbFile } from '@kubb/fabric-core/types'
|
|
3
3
|
|
|
4
4
|
import type { contentType, HttpMethod, Oas, Operation, SchemaObject } from '@kubb/oas'
|
|
@@ -20,7 +20,7 @@ declare global {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export type ResolvePathOptions = {
|
|
23
|
-
|
|
23
|
+
pluginName?: string
|
|
24
24
|
group?: {
|
|
25
25
|
tag?: string
|
|
26
26
|
path?: string
|
|
@@ -136,14 +136,14 @@ export type Options = {
|
|
|
136
136
|
*
|
|
137
137
|
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
138
138
|
*
|
|
139
|
-
* `
|
|
139
|
+
* `pluginName` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
140
140
|
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
141
141
|
*/
|
|
142
142
|
export type Ref = {
|
|
143
143
|
propertyName: string
|
|
144
144
|
originalName: string
|
|
145
145
|
path: KubbFile.Path
|
|
146
|
-
|
|
146
|
+
pluginName?: string
|
|
147
147
|
}
|
|
148
148
|
export type Refs = Record<string, Ref>
|
|
149
149
|
|
|
@@ -220,10 +220,11 @@ type ByContentType = {
|
|
|
220
220
|
pattern: string | RegExp
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
export type Exclude = ByTag | ByOperationId | ByPath | ByMethod | ByContentType
|
|
224
|
-
export type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType
|
|
223
|
+
export type Exclude = ByTag | ByOperationId | ByPath | ByMethod | ByContentType | BySchemaName
|
|
224
|
+
export type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType | BySchemaName
|
|
225
225
|
|
|
226
226
|
export type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
227
|
+
// should be options: Omit<Partial<TOptions>, 'override'>
|
|
227
228
|
options: Partial<TOptions>
|
|
228
229
|
}
|
|
229
230
|
|