@kubb/plugin-oas 5.0.0-alpha.2 → 5.0.0-alpha.21

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.
Files changed (57) hide show
  1. package/dist/{createGenerator-B8BypXNu.d.ts → createGenerator-BiZ9IsdY.d.ts} +106 -58
  2. package/dist/{generators-vAAte6w6.cjs → generators-85sP4GIS.cjs} +7 -7
  3. package/dist/generators-85sP4GIS.cjs.map +1 -0
  4. package/dist/{generators-B8HiBWvT.js → generators-hPE06pZB.js} +7 -7
  5. package/dist/generators-hPE06pZB.js.map +1 -0
  6. package/dist/generators.cjs +1 -1
  7. package/dist/generators.d.ts +4 -3
  8. package/dist/generators.js +1 -1
  9. package/dist/{getFooter-Pw3tLCiV.js → getFooter-Dz4u5Mg4.js} +5 -2
  10. package/dist/getFooter-Dz4u5Mg4.js.map +1 -0
  11. package/dist/{getFooter-BBzsC616.cjs → getFooter-gshcRE1-.cjs} +5 -2
  12. package/dist/getFooter-gshcRE1-.cjs.map +1 -0
  13. package/dist/hooks.cjs +26 -45
  14. package/dist/hooks.cjs.map +1 -1
  15. package/dist/hooks.d.ts +6 -23
  16. package/dist/hooks.js +29 -47
  17. package/dist/hooks.js.map +1 -1
  18. package/dist/index.cjs +15 -15
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.ts +22 -38
  21. package/dist/index.js +14 -14
  22. package/dist/index.js.map +1 -1
  23. package/dist/{requestBody-FpiwLR1p.cjs → requestBody-BHEEK1Z3.cjs} +87 -126
  24. package/dist/requestBody-BHEEK1Z3.cjs.map +1 -0
  25. package/dist/{requestBody-DQMKhTin.js → requestBody-bs_SwfEj.js} +77 -116
  26. package/dist/requestBody-bs_SwfEj.js.map +1 -0
  27. package/dist/utils.cjs +61 -11
  28. package/dist/utils.cjs.map +1 -1
  29. package/dist/utils.d.ts +1 -1
  30. package/dist/utils.js +61 -11
  31. package/dist/utils.js.map +1 -1
  32. package/package.json +7 -7
  33. package/src/OperationGenerator.ts +15 -15
  34. package/src/SchemaGenerator.ts +17 -20
  35. package/src/generators/createGenerator.ts +12 -15
  36. package/src/generators/createReactGenerator.ts +12 -15
  37. package/src/generators/index.ts +2 -2
  38. package/src/generators/jsonGenerator.ts +3 -3
  39. package/src/generators/types.ts +5 -40
  40. package/src/hooks/index.ts +0 -1
  41. package/src/hooks/useOas.ts +5 -2
  42. package/src/hooks/useOperationManager.ts +19 -18
  43. package/src/hooks/useSchemaManager.ts +5 -4
  44. package/src/index.ts +2 -2
  45. package/src/plugin.ts +5 -5
  46. package/src/types.ts +3 -2
  47. package/src/utils/getBanner.ts +1 -1
  48. package/src/utils/getFooter.ts +1 -1
  49. package/src/utils/getParams.ts +2 -2
  50. package/src/utils.tsx +50 -137
  51. package/dist/generators-B8HiBWvT.js.map +0 -1
  52. package/dist/generators-vAAte6w6.cjs.map +0 -1
  53. package/dist/getFooter-BBzsC616.cjs.map +0 -1
  54. package/dist/getFooter-Pw3tLCiV.js.map +0 -1
  55. package/dist/requestBody-DQMKhTin.js.map +0 -1
  56. package/dist/requestBody-FpiwLR1p.cjs.map +0 -1
  57. package/src/hooks/useRootNode.ts +0 -25
@@ -1,30 +1,27 @@
1
1
  import type { PluginFactoryOptions } from '@kubb/core'
2
2
  import type { KubbFile } from '@kubb/fabric-core/types'
3
- import type { OperationProps, OperationsProps, SchemaProps, Version } from './types.ts'
3
+ import type { OperationProps, OperationsProps, SchemaProps } from './types.ts'
4
4
 
5
- type UserGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {
5
+ type UserGenerator<TOptions extends PluginFactoryOptions> = {
6
6
  name: string
7
- version?: TVersion
8
- operations?: (props: OperationsProps<TOptions, TVersion>) => Promise<KubbFile.File[]>
9
- operation?: (props: OperationProps<TOptions, TVersion>) => Promise<KubbFile.File[]>
10
- schema?: (props: SchemaProps<TOptions, TVersion>) => Promise<KubbFile.File[]>
7
+ operations?: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>
8
+ operation?: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>
9
+ schema?: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>
11
10
  }
12
11
 
13
- export type CoreGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {
12
+ export type CoreGenerator<TOptions extends PluginFactoryOptions> = {
14
13
  name: string
15
14
  type: 'core'
16
- version: TVersion
17
- operations: (props: OperationsProps<TOptions, TVersion>) => Promise<KubbFile.File[]>
18
- operation: (props: OperationProps<TOptions, TVersion>) => Promise<KubbFile.File[]>
19
- schema: (props: SchemaProps<TOptions, TVersion>) => Promise<KubbFile.File[]>
15
+ version: '1'
16
+ operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>
17
+ operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>
18
+ schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>
20
19
  }
21
20
 
22
- export function createGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'>(
23
- generator: UserGenerator<TOptions, TVersion>,
24
- ): CoreGenerator<TOptions, TVersion> {
21
+ export function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): CoreGenerator<TOptions> {
25
22
  return {
26
23
  type: 'core',
27
- version: (generator.version ?? '1') as TVersion,
24
+ version: '1',
28
25
  async operations() {
29
26
  return []
30
27
  },
@@ -1,22 +1,21 @@
1
1
  import type { PluginFactoryOptions } from '@kubb/core'
2
2
  import type { FabricReactNode } from '@kubb/react-fabric/types'
3
- import type { OperationProps, OperationsProps, SchemaProps, Version } from './types.ts'
3
+ import type { OperationProps, OperationsProps, SchemaProps } from './types.ts'
4
4
 
5
- type UserGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {
5
+ type UserGenerator<TOptions extends PluginFactoryOptions> = {
6
6
  name: string
7
- version?: TVersion
8
- Operations?: (props: OperationsProps<TOptions, TVersion>) => FabricReactNode
9
- Operation?: (props: OperationProps<TOptions, TVersion>) => FabricReactNode
10
- Schema?: (props: SchemaProps<TOptions, TVersion>) => FabricReactNode
7
+ Operations?: (props: OperationsProps<TOptions>) => FabricReactNode
8
+ Operation?: (props: OperationProps<TOptions>) => FabricReactNode
9
+ Schema?: (props: SchemaProps<TOptions>) => FabricReactNode
11
10
  }
12
11
 
13
- export type ReactGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {
12
+ export type ReactGenerator<TOptions extends PluginFactoryOptions> = {
14
13
  name: string
15
14
  type: 'react'
16
- version: TVersion
17
- Operations: (props: OperationsProps<TOptions, TVersion>) => FabricReactNode
18
- Operation: (props: OperationProps<TOptions, TVersion>) => FabricReactNode
19
- Schema: (props: SchemaProps<TOptions, TVersion>) => FabricReactNode
15
+ version: '1'
16
+ Operations: (props: OperationsProps<TOptions>) => FabricReactNode
17
+ Operation: (props: OperationProps<TOptions>) => FabricReactNode
18
+ Schema: (props: SchemaProps<TOptions>) => FabricReactNode
20
19
  }
21
20
 
22
21
  /****
@@ -26,12 +25,10 @@ export type ReactGenerator<TOptions extends PluginFactoryOptions, TVersion exten
26
25
  *
27
26
  * @returns A generator object with async methods for operations, operation, and schema file generation.
28
27
  */
29
- export function createReactGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'>(
30
- generator: UserGenerator<TOptions, TVersion>,
31
- ): ReactGenerator<TOptions, TVersion> {
28
+ export function createReactGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): ReactGenerator<TOptions> {
32
29
  return {
33
30
  type: 'react',
34
- version: (generator.version ?? '1') as TVersion,
31
+ version: '1',
35
32
  Operations() {
36
33
  return null
37
34
  },
@@ -1,4 +1,4 @@
1
- export { createGenerator } from './createGenerator.ts'
2
- export { createReactGenerator } from './createReactGenerator.ts'
1
+ export { type CoreGenerator, createGenerator } from './createGenerator.ts'
2
+ export { createReactGenerator, type ReactGenerator } from './createReactGenerator.ts'
3
3
  export { jsonGenerator } from './jsonGenerator.ts'
4
4
  export type { Generator } from './types.ts'
@@ -7,8 +7,8 @@ import { createGenerator } from './createGenerator.ts'
7
7
  export const jsonGenerator = createGenerator<PluginOas>({
8
8
  name: 'plugin-oas',
9
9
  async schema({ schema, generator }) {
10
- const { pluginManager, plugin } = generator.context
11
- const file = pluginManager.getFile({
10
+ const { driver, plugin } = generator.context
11
+ const file = driver.getFile({
12
12
  name: camelCase(schema.name),
13
13
  extname: '.json',
14
14
  mode: 'split',
@@ -29,7 +29,7 @@ export const jsonGenerator = createGenerator<PluginOas>({
29
29
  banner: getBanner({
30
30
  oas: generator.context.oas,
31
31
  output: plugin.options.output,
32
- config: pluginManager.config,
32
+ config: driver.config,
33
33
  }),
34
34
  format: getFooter({ oas: generator.context.oas, output: plugin.options.output }),
35
35
  },
@@ -1,5 +1,4 @@
1
- import type { OperationNode, SchemaNode } from '@kubb/ast/types'
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 Version = '1' | '2'
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 OperationsV2Props<TOptions extends PluginFactoryOptions> = {
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 OperationV2Props<TOptions extends PluginFactoryOptions> = {
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 SchemaV2Props<TOptions extends PluginFactoryOptions> = {
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>
@@ -1,5 +1,4 @@
1
1
  export { useOas } from './useOas.ts'
2
2
  export type { SchemaNames } from './useOperationManager.ts'
3
3
  export { useOperationManager } from './useOperationManager.ts'
4
- export { useRootNode } from './useRootNode.ts'
5
4
  export { useSchemaManager } from './useSchemaManager.ts'
@@ -1,9 +1,12 @@
1
1
  import type { Oas } from '@kubb/oas'
2
2
 
3
- import { useApp } from '@kubb/react-fabric'
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 } = useApp<{ oas: Oas }>()
9
+ const { meta } = useFabric<{ oas: Oas }>()
7
10
 
8
11
  return meta.oas
9
12
  }
@@ -1,5 +1,5 @@
1
1
  import type { FileMetaBase, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
2
- import { usePlugin, usePluginManager } from '@kubb/core/hooks'
2
+ import { useDriver, usePlugin } 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'
@@ -66,10 +66,11 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
66
66
  generator: Omit<OperationGenerator<TPluginOptions>, 'build'>,
67
67
  ): UseOperationManagerResult {
68
68
  const plugin = usePlugin()
69
- const pluginManager = usePluginManager()
69
+ const driver = useDriver()
70
+ const defaultPluginName = plugin.name
70
71
 
71
- const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '', pluginName = plugin.name, type }) => {
72
- return pluginManager.resolveName({
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,
@@ -78,7 +79,7 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
78
79
 
79
80
  const getGroup: UseOperationManagerResult['getGroup'] = (operation) => {
80
81
  return {
81
- tag: operation.getTags().at(0)?.name,
82
+ tag: operation.getTags().at(0)?.name ?? 'default',
82
83
  path: operation.path,
83
84
  }
84
85
  }
@@ -90,19 +91,19 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
90
91
 
91
92
  return generator.getSchemas(operation, {
92
93
  resolveName: (name) =>
93
- pluginManager.resolveName({
94
+ driver.resolveName({
94
95
  name,
95
- pluginName: params?.pluginName,
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, pluginName = plugin.name, extname = '.ts' } = {}) => {
102
+ const getFile: UseOperationManagerResult['getFile'] = (operation, { prefix, suffix, pluginName = defaultPluginName, extname = '.ts' } = {}) => {
102
103
  const name = getName(operation, { type: 'file', pluginName, prefix, suffix })
103
104
  const group = getGroup(operation)
104
105
 
105
- const file = pluginManager.getFile({
106
+ const file = driver.getFile({
106
107
  name,
107
108
  extname,
108
109
  pluginName,
@@ -120,12 +121,12 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
120
121
  }
121
122
  }
122
123
 
123
- const groupSchemasByName: UseOperationManagerResult['groupSchemasByName'] = (operation, { pluginName = plugin.name, type }) => {
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 = generator.getSchemas(operation)
129
+ const schemas = getSchemas(operation)
129
130
 
130
131
  const errors = (schemas.errors || []).reduce(
131
132
  (prev, acc) => {
@@ -133,7 +134,7 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
133
134
  return prev
134
135
  }
135
136
 
136
- prev[acc.statusCode] = pluginManager.resolveName({
137
+ prev[acc.statusCode] = driver.resolveName({
137
138
  name: acc.name,
138
139
  pluginName,
139
140
  type,
@@ -150,7 +151,7 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
150
151
  return prev
151
152
  }
152
153
 
153
- prev[acc.statusCode] = pluginManager.resolveName({
154
+ prev[acc.statusCode] = driver.resolveName({
154
155
  name: acc.name,
155
156
  pluginName,
156
157
  type,
@@ -163,7 +164,7 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
163
164
 
164
165
  return {
165
166
  request: schemas.request?.name
166
- ? pluginManager.resolveName({
167
+ ? driver.resolveName({
167
168
  name: schemas.request.name,
168
169
  pluginName,
169
170
  type,
@@ -171,21 +172,21 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
171
172
  : undefined,
172
173
  parameters: {
173
174
  path: schemas.pathParams?.name
174
- ? pluginManager.resolveName({
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
- ? pluginManager.resolveName({
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
- ? pluginManager.resolveName({
189
+ ? driver.resolveName({
189
190
  name: schemas.headerParams.name,
190
191
  pluginName,
191
192
  type,
@@ -194,7 +195,7 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
194
195
  },
195
196
  responses: {
196
197
  ...responses,
197
- ['default']: pluginManager.resolveName({
198
+ ['default']: driver.resolveName({
198
199
  name: schemas.response.name,
199
200
  pluginName,
200
201
  type,
@@ -1,5 +1,5 @@
1
1
  import type { FileMetaBase, ResolveNameParams } from '@kubb/core'
2
- import { usePlugin, usePluginManager } from '@kubb/core/hooks'
2
+ import { useDriver, usePlugin } from '@kubb/core/hooks'
3
3
  import type { KubbFile } from '@kubb/fabric-core/types'
4
4
 
5
5
  type FileMeta = FileMetaBase & {
@@ -29,13 +29,14 @@ 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 pluginManager = usePluginManager()
36
+ const driver = useDriver()
36
37
 
37
38
  const getName: UseSchemaManagerResult['getName'] = (name, { pluginName = plugin.name, type }) => {
38
- return pluginManager.resolveName({
39
+ return driver.resolveName({
39
40
  name,
40
41
  pluginName,
41
42
  type,
@@ -45,7 +46,7 @@ export function useSchemaManager(): UseSchemaManagerResult {
45
46
  const getFile: UseSchemaManagerResult['getFile'] = (name, { mode = 'split', pluginName = plugin.name, extname = '.ts', group } = {}) => {
46
47
  const resolvedName = mode === 'single' ? '' : getName(name, { type: 'file', pluginName })
47
48
 
48
- const file = pluginManager.getFile({
49
+ const file = driver.getFile({
49
50
  name: resolvedName,
50
51
  extname,
51
52
  pluginName,
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 { buildOperation, buildOperations, buildSchema } from './utils.tsx'
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, TVersion extends import('./generators/types.ts').Version = '1'> = _Generator<TOptions, TVersion>
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 { AsyncEventEmitter } from '@kubb/core'
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 = definePlugin<PluginOas>((options) => {
14
+ export const pluginOas = createPlugin<PluginOas>((options) => {
15
15
  const {
16
16
  output = {
17
17
  path: 'schemas',
@@ -152,7 +152,7 @@ export const pluginOas = definePlugin<PluginOas>((options) => {
152
152
  {
153
153
  fabric: this.fabric,
154
154
  oas,
155
- pluginManager: this.pluginManager,
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
- pluginManager: this.pluginManager,
172
+ driver: this.driver,
173
173
  events: this.events,
174
174
  plugin: this.plugin,
175
175
  contentType,
package/src/types.ts CHANGED
@@ -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
 
@@ -67,7 +67,7 @@ export function getBanner<TOas extends Oas>({ output, oas, config }: Props<TOas>
67
67
  }
68
68
 
69
69
  if (isFunction(output.banner)) {
70
- return `${output.banner(oas)}\n${banner}`
70
+ return `${output.banner(oas as any)}\n${banner}`
71
71
  }
72
72
 
73
73
  return `${output.banner}\n${banner}`
@@ -13,7 +13,7 @@ export function getFooter<TOas extends Oas>({ output, oas }: Props<TOas>) {
13
13
  }
14
14
 
15
15
  if (isFunction(output.footer)) {
16
- return output.footer(oas)
16
+ return output.footer(oas as any)
17
17
  }
18
18
 
19
19
  return output.footer
@@ -20,7 +20,7 @@ export function getASTParams(
20
20
  override?: (data: FunctionParamsAST) => FunctionParamsAST
21
21
  } = {},
22
22
  ): FunctionParamsAST[] {
23
- if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) {
23
+ if (!operationSchema?.schema.properties || !operationSchema.name) {
24
24
  return []
25
25
  }
26
26
 
@@ -82,7 +82,7 @@ export function getParamsMapping(
82
82
  casing?: 'camelcase'
83
83
  } = {},
84
84
  ): Record<string, string> | undefined {
85
- if (!operationSchema || !operationSchema.schema.properties) {
85
+ if (!operationSchema?.schema.properties) {
86
86
  return undefined
87
87
  }
88
88