@kubb/plugin-ts 5.0.0-alpha.5 → 5.0.0-alpha.7

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.
@@ -1,6 +1,6 @@
1
1
  import { pascalCase } from '@internals/utils'
2
- import type { PluginManager } from '@kubb/core'
3
- import { useMode, usePluginManager } from '@kubb/core/hooks'
2
+ import type { PluginDriver } from '@kubb/core'
3
+ import { useMode, usePluginDriver } from '@kubb/core/hooks'
4
4
  import { safePrint } from '@kubb/fabric-core/parsers/typescript'
5
5
  import type { Operation } from '@kubb/oas'
6
6
  import { isKeyword, type OperationSchemas, type OperationSchema as OperationSchemaType, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'
@@ -15,13 +15,13 @@ import { createUrlTemplateType, getUnknownType, keywordTypeNodes } from '../fact
15
15
  import { pluginTsName } from '../plugin.ts'
16
16
  import type { PluginTs } from '../types'
17
17
 
18
- function printCombinedSchema({ name, schemas, pluginManager }: { name: string; schemas: OperationSchemas; pluginManager: PluginManager }): string {
18
+ function printCombinedSchema({ name, schemas, driver }: { name: string; schemas: OperationSchemas; driver: PluginDriver }): string {
19
19
  const properties: Record<string, ts.TypeNode> = {}
20
20
 
21
21
  if (schemas.response) {
22
22
  properties['response'] = factory.createUnionDeclaration({
23
23
  nodes: schemas.responses.map((res) => {
24
- const identifier = pluginManager.resolveName({
24
+ const identifier = driver.resolveName({
25
25
  name: res.name,
26
26
  pluginName: pluginTsName,
27
27
  type: 'function',
@@ -33,7 +33,7 @@ function printCombinedSchema({ name, schemas, pluginManager }: { name: string; s
33
33
  }
34
34
 
35
35
  if (schemas.request) {
36
- const identifier = pluginManager.resolveName({
36
+ const identifier = driver.resolveName({
37
37
  name: schemas.request.name,
38
38
  pluginName: pluginTsName,
39
39
  type: 'function',
@@ -42,7 +42,7 @@ function printCombinedSchema({ name, schemas, pluginManager }: { name: string; s
42
42
  }
43
43
 
44
44
  if (schemas.pathParams) {
45
- const identifier = pluginManager.resolveName({
45
+ const identifier = driver.resolveName({
46
46
  name: schemas.pathParams.name,
47
47
  pluginName: pluginTsName,
48
48
  type: 'function',
@@ -51,7 +51,7 @@ function printCombinedSchema({ name, schemas, pluginManager }: { name: string; s
51
51
  }
52
52
 
53
53
  if (schemas.queryParams) {
54
- const identifier = pluginManager.resolveName({
54
+ const identifier = driver.resolveName({
55
55
  name: schemas.queryParams.name,
56
56
  pluginName: pluginTsName,
57
57
  type: 'function',
@@ -60,7 +60,7 @@ function printCombinedSchema({ name, schemas, pluginManager }: { name: string; s
60
60
  }
61
61
 
62
62
  if (schemas.headerParams) {
63
- const identifier = pluginManager.resolveName({
63
+ const identifier = driver.resolveName({
64
64
  name: schemas.headerParams.name,
65
65
  pluginName: pluginTsName,
66
66
  type: 'function',
@@ -71,7 +71,7 @@ function printCombinedSchema({ name, schemas, pluginManager }: { name: string; s
71
71
  if (schemas.errors) {
72
72
  properties['errors'] = factory.createUnionDeclaration({
73
73
  nodes: schemas.errors.map((error) => {
74
- const identifier = pluginManager.resolveName({
74
+ const identifier = driver.resolveName({
75
75
  name: error.name,
76
76
  pluginName: pluginTsName,
77
77
  type: 'function',
@@ -109,14 +109,14 @@ function printRequestSchema({
109
109
  baseName,
110
110
  operation,
111
111
  schemas,
112
- pluginManager,
112
+ driver,
113
113
  }: {
114
114
  baseName: string
115
115
  operation: Operation
116
116
  schemas: OperationSchemas
117
- pluginManager: PluginManager
117
+ driver: PluginDriver
118
118
  }): string {
119
- const name = pluginManager.resolveName({
119
+ const name = driver.resolveName({
120
120
  name: `${baseName} Request`,
121
121
  pluginName: pluginTsName,
122
122
  type: 'type',
@@ -128,7 +128,7 @@ function printRequestSchema({
128
128
  const dataRequestProperties: ts.PropertySignature[] = []
129
129
 
130
130
  if (schemas.request) {
131
- const identifier = pluginManager.resolveName({
131
+ const identifier = driver.resolveName({
132
132
  name: schemas.request.name,
133
133
  pluginName: pluginTsName,
134
134
  type: 'type',
@@ -152,7 +152,7 @@ function printRequestSchema({
152
152
 
153
153
  // Add pathParams property
154
154
  if (schemas.pathParams) {
155
- const identifier = pluginManager.resolveName({
155
+ const identifier = driver.resolveName({
156
156
  name: schemas.pathParams.name,
157
157
  pluginName: pluginTsName,
158
158
  type: 'type',
@@ -175,7 +175,7 @@ function printRequestSchema({
175
175
 
176
176
  // Add queryParams property
177
177
  if (schemas.queryParams) {
178
- const identifier = pluginManager.resolveName({
178
+ const identifier = driver.resolveName({
179
179
  name: schemas.queryParams.name,
180
180
  pluginName: pluginTsName,
181
181
  type: 'type',
@@ -199,7 +199,7 @@ function printRequestSchema({
199
199
 
200
200
  // Add headerParams property
201
201
  if (schemas.headerParams) {
202
- const identifier = pluginManager.resolveName({
202
+ const identifier = driver.resolveName({
203
203
  name: schemas.headerParams.name,
204
204
  pluginName: pluginTsName,
205
205
  type: 'type',
@@ -243,17 +243,17 @@ function printRequestSchema({
243
243
  function printResponseSchema({
244
244
  baseName,
245
245
  schemas,
246
- pluginManager,
246
+ driver,
247
247
  unknownType,
248
248
  }: {
249
249
  baseName: string
250
250
  schemas: OperationSchemas
251
- pluginManager: PluginManager
251
+ driver: PluginDriver
252
252
  unknownType: PluginTs['resolvedOptions']['unknownType']
253
253
  }): string {
254
254
  const results: string[] = []
255
255
 
256
- const name = pluginManager.resolveName({
256
+ const name = driver.resolveName({
257
257
  name: `${baseName} ResponseData`,
258
258
  pluginName: pluginTsName,
259
259
  type: 'type',
@@ -262,7 +262,7 @@ function printResponseSchema({
262
262
  // Generate Responses type (mapping status codes to response types)
263
263
  if (schemas.responses && schemas.responses.length > 0) {
264
264
  const responsesProperties: ts.PropertySignature[] = schemas.responses.map((res) => {
265
- const identifier = pluginManager.resolveName({
265
+ const identifier = driver.resolveName({
266
266
  name: res.name,
267
267
  pluginName: pluginTsName,
268
268
  type: 'type',
@@ -314,11 +314,11 @@ export const typeGenerator = createReactGenerator<PluginTs>({
314
314
  Operation({ operation, generator, plugin }) {
315
315
  const {
316
316
  options,
317
- options: { mapper, enumType, enumKeyCasing, syntaxType, optionalType, arrayType, unknownType, paramsCasing },
317
+ options: { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, unknownType, paramsCasing },
318
318
  } = plugin
319
319
 
320
320
  const mode = useMode()
321
- const pluginManager = usePluginManager()
321
+ const driver = usePluginDriver()
322
322
 
323
323
  const oas = useOas()
324
324
  const { getSchemas, getFile, getName, getGroup } = useOperationManager(generator)
@@ -333,7 +333,7 @@ export const typeGenerator = createReactGenerator<PluginTs>({
333
333
  oas,
334
334
  events: generator.context.events,
335
335
  plugin,
336
- pluginManager,
336
+ driver,
337
337
  mode,
338
338
  override: options.override,
339
339
  })
@@ -369,7 +369,6 @@ export const typeGenerator = createReactGenerator<PluginTs>({
369
369
  description={description}
370
370
  tree={tree}
371
371
  schema={transformedSchema}
372
- mapper={mapper}
373
372
  enumType={enumType}
374
373
  enumKeyCasing={enumKeyCasing}
375
374
  optionalType={optionalType}
@@ -392,7 +391,7 @@ export const typeGenerator = createReactGenerator<PluginTs>({
392
391
  baseName={file.baseName}
393
392
  path={file.path}
394
393
  meta={file.meta}
395
- banner={getBanner({ oas, output: plugin.options.output, config: pluginManager.config })}
394
+ banner={getBanner({ oas, output: plugin.options.output, config: driver.config })}
396
395
  footer={getFooter({ oas, output: plugin.options.output })}
397
396
  >
398
397
  {operationSchemas.map(mapOperationSchema)}
@@ -400,15 +399,15 @@ export const typeGenerator = createReactGenerator<PluginTs>({
400
399
  {generator.context.UNSTABLE_NAMING ? (
401
400
  <>
402
401
  <File.Source name={`${name}Request`} isExportable isIndexable isTypeOnly>
403
- {printRequestSchema({ baseName: name, operation, schemas, pluginManager })}
402
+ {printRequestSchema({ baseName: name, operation, schemas, driver })}
404
403
  </File.Source>
405
404
  <File.Source name={responseName} isExportable isIndexable isTypeOnly>
406
- {printResponseSchema({ baseName: name, schemas, pluginManager, unknownType })}
405
+ {printResponseSchema({ baseName: name, schemas, driver, unknownType })}
407
406
  </File.Source>
408
407
  </>
409
408
  ) : (
410
409
  <File.Source name={combinedSchemaName} isExportable isIndexable isTypeOnly>
411
- {printCombinedSchema({ name: combinedSchemaName, schemas, pluginManager })}
410
+ {printCombinedSchema({ name: combinedSchemaName, schemas, driver })}
412
411
  </File.Source>
413
412
  )}
414
413
  </File>
@@ -416,12 +415,12 @@ export const typeGenerator = createReactGenerator<PluginTs>({
416
415
  },
417
416
  Schema({ schema, plugin }) {
418
417
  const {
419
- options: { mapper, enumType, enumKeyCasing, syntaxType, optionalType, arrayType, output },
418
+ options: { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, output },
420
419
  } = plugin
421
420
  const mode = useMode()
422
421
 
423
422
  const oas = useOas()
424
- const pluginManager = usePluginManager()
423
+ const driver = usePluginDriver()
425
424
 
426
425
  const { getName, getFile } = useSchemaManager()
427
426
  const imports = getImports(schema.tree)
@@ -444,7 +443,7 @@ export const typeGenerator = createReactGenerator<PluginTs>({
444
443
  baseName={type.file.baseName}
445
444
  path={type.file.path}
446
445
  meta={type.file.meta}
447
- banner={getBanner({ oas, output, config: pluginManager.config })}
446
+ banner={getBanner({ oas, output, config: driver.config })}
448
447
  footer={getFooter({ oas, output })}
449
448
  >
450
449
  {mode === 'split' &&
@@ -457,7 +456,6 @@ export const typeGenerator = createReactGenerator<PluginTs>({
457
456
  description={schema.value.description}
458
457
  tree={schema.tree}
459
458
  schema={schema.value}
460
- mapper={mapper}
461
459
  enumType={enumType}
462
460
  enumKeyCasing={enumKeyCasing}
463
461
  optionalType={optionalType}
@@ -1,9 +1,11 @@
1
+ import { pascalCase } from '@internals/utils'
1
2
  import { applyParamsCasing } from '@kubb/ast'
2
3
  import type { SchemaNode } from '@kubb/ast/types'
3
4
  import { defineGenerator } from '@kubb/core'
4
5
  import { useKubb } from '@kubb/core/hooks'
5
6
  import { File } from '@kubb/react-fabric'
6
7
  import { Type } from '../../components/v2/Type.tsx'
8
+ import { ENUM_TYPES_WITH_KEY_SUFFIX } from '../../constants.ts'
7
9
  import type { PluginTs } from '../../types'
8
10
  import { buildDataSchemaNode, buildResponsesSchemaNode, buildResponseUnionSchemaNode } from './utils.ts'
9
11
 
@@ -11,10 +13,17 @@ export const typeGenerator = defineGenerator<PluginTs>({
11
13
  name: 'typescript',
12
14
  type: 'react',
13
15
  Operation({ node, adapter, options }) {
14
- const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, mapper } = options
16
+ const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group } = options
15
17
  const { mode, getFile, resolveName } = useKubb<PluginTs>()
16
18
 
17
- const file = getFile({ name: node.operationId, extname: '.ts', mode })
19
+ const file = getFile({
20
+ name: node.operationId,
21
+ extname: '.ts',
22
+ mode,
23
+ options: {
24
+ group: group ? (group.type === 'tag' ? { tag: node.tags[0] } : { path: node.path }) : undefined,
25
+ },
26
+ })
18
27
  const params = applyParamsCasing(node.parameters, paramsCasing)
19
28
 
20
29
  function renderSchemaType({
@@ -51,7 +60,6 @@ export const typeGenerator = defineGenerator<PluginTs>({
51
60
  optionalType={optionalType}
52
61
  arrayType={arrayType}
53
62
  syntaxType={syntaxType}
54
- mapper={mapper}
55
63
  />
56
64
  </>
57
65
  )
@@ -60,8 +68,8 @@ export const typeGenerator = defineGenerator<PluginTs>({
60
68
  const paramTypes = params.map((param) =>
61
69
  renderSchemaType({
62
70
  node: param.schema,
63
- name: resolveName({ name: `${node.operationId} ${param.name}`, type: 'function' }),
64
- typedName: resolveName({ name: `${node.operationId} ${param.name}`, type: 'type' }),
71
+ name: resolveName({ name: `${node.operationId} ${pascalCase(param.in)} ${param.name}`, type: 'function' }),
72
+ typedName: resolveName({ name: `${node.operationId} ${pascalCase(param.in)} ${param.name}`, type: 'type' }),
65
73
  }),
66
74
  )
67
75
 
@@ -70,8 +78,8 @@ export const typeGenerator = defineGenerator<PluginTs>({
70
78
  .map((res) =>
71
79
  renderSchemaType({
72
80
  node: res.schema!,
73
- name: resolveName({ name: `${node.operationId} ${res.statusCode}`, type: 'function' }),
74
- typedName: resolveName({ name: `${node.operationId} ${res.statusCode}`, type: 'type' }),
81
+ name: resolveName({ name: `${node.operationId} Status ${res.statusCode}`, type: 'function' }),
82
+ typedName: resolveName({ name: `${node.operationId} Status ${res.statusCode}`, type: 'type' }),
75
83
  description: res.description,
76
84
  }),
77
85
  )
@@ -79,16 +87,16 @@ export const typeGenerator = defineGenerator<PluginTs>({
79
87
  const requestType = node.requestBody
80
88
  ? renderSchemaType({
81
89
  node: node.requestBody,
82
- name: resolveName({ name: `${node.operationId} MutationRequest`, type: 'function' }),
83
- typedName: resolveName({ name: `${node.operationId} MutationRequest`, type: 'type' }),
90
+ name: resolveName({ name: `${node.operationId} Data`, type: 'function' }),
91
+ typedName: resolveName({ name: `${node.operationId} Data`, type: 'type' }),
84
92
  description: node.requestBody.description,
85
93
  })
86
94
  : null
87
95
 
88
96
  const dataType = renderSchemaType({
89
97
  node: buildDataSchemaNode({ node: { ...node, parameters: params }, resolveName }),
90
- name: resolveName({ name: `${node.operationId} Data`, type: 'function' }),
91
- typedName: resolveName({ name: `${node.operationId} Data`, type: 'type' }),
98
+ name: resolveName({ name: `${node.operationId} RequestConfig`, type: 'function' }),
99
+ typedName: resolveName({ name: `${node.operationId} RequestConfig`, type: 'type' }),
92
100
  })
93
101
 
94
102
  const responsesType = renderSchemaType({
@@ -101,6 +109,7 @@ export const typeGenerator = defineGenerator<PluginTs>({
101
109
  node: buildResponseUnionSchemaNode({ node, resolveName }),
102
110
  name: resolveName({ name: `${node.operationId} Response`, type: 'function' }),
103
111
  typedName: resolveName({ name: `${node.operationId} Response`, type: 'type' }),
112
+ description: 'Union of all possible responses',
104
113
  })
105
114
 
106
115
  return (
@@ -115,7 +124,7 @@ export const typeGenerator = defineGenerator<PluginTs>({
115
124
  )
116
125
  },
117
126
  Schema({ node, adapter, options }) {
118
- const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, mapper } = options
127
+ const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType } = options
119
128
  const { mode, resolveName, getFile } = useKubb<PluginTs>()
120
129
 
121
130
  if (!node.name) {
@@ -130,7 +139,7 @@ export const typeGenerator = defineGenerator<PluginTs>({
130
139
  const isEnumSchema = node.type === 'enum'
131
140
 
132
141
  let typedName = resolveName({ name: node.name, type: 'type' })
133
- if (['asConst', 'asPascalConst'].includes(enumType) && isEnumSchema) {
142
+ if (ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema) {
134
143
  typedName += 'Key'
135
144
  }
136
145
 
@@ -155,7 +164,6 @@ export const typeGenerator = defineGenerator<PluginTs>({
155
164
  optionalType={optionalType}
156
165
  arrayType={arrayType}
157
166
  syntaxType={syntaxType}
158
- mapper={mapper}
159
167
  />
160
168
  </File>
161
169
  )
@@ -1,3 +1,4 @@
1
+ import { pascalCase } from '@internals/utils'
1
2
  import { createProperty, createSchema } from '@kubb/ast'
2
3
  import type { OperationNode, ParameterNode, SchemaNode } from '@kubb/ast/types'
3
4
 
@@ -12,6 +13,8 @@ type BuildParamsSchemaOptions = {
12
13
  /**
13
14
  * Builds an `ObjectSchemaNode` for a group of parameters (path/query/header).
14
15
  * Each property is a `ref` schema pointing to the individually-resolved parameter type.
16
+ * The ref name includes the parameter location so generated type names follow
17
+ * the `<OperationId><Location><ParamName>` convention.
15
18
  */
16
19
  export function buildParamsSchema({ params, operationId, resolveName }: BuildParamsSchemaOptions): SchemaNode {
17
20
  return createSchema({
@@ -21,7 +24,7 @@ export function buildParamsSchema({ params, operationId, resolveName }: BuildPar
21
24
  name: param.name,
22
25
  schema: createSchema({
23
26
  type: 'ref',
24
- name: resolveName({ name: `${operationId} ${param.name}`, type: 'function' }),
27
+ name: resolveName({ name: `${operationId} ${pascalCase(param.in)} ${param.name}`, type: 'function' }),
25
28
  optional: !param.required,
26
29
  }),
27
30
  }),
@@ -35,7 +38,7 @@ type BuildOperationSchemaOptions = {
35
38
  }
36
39
 
37
40
  /**
38
- * Builds an `ObjectSchemaNode` representing the `<OperationId>Data` type:
41
+ * Builds an `ObjectSchemaNode` representing the `<OperationId>RequestConfig` type:
39
42
  * - `data` → request body ref (optional) or `never`
40
43
  * - `pathParams` → inline object of path param refs, or `never`
41
44
  * - `queryParams` → inline object of query param refs (optional), or `never`
@@ -55,7 +58,7 @@ export function buildDataSchemaNode({ node, resolveName }: BuildOperationSchemaO
55
58
  schema: node.requestBody
56
59
  ? createSchema({
57
60
  type: 'ref',
58
- name: resolveName({ name: `${node.operationId} MutationRequest`, type: 'function' }),
61
+ name: resolveName({ name: `${node.operationId} Data`, type: 'function' }),
59
62
  optional: true,
60
63
  })
61
64
  : createSchema({ type: 'never', optional: true }),
@@ -91,11 +94,7 @@ export function buildDataSchemaNode({ node, resolveName }: BuildOperationSchemaO
91
94
 
92
95
  /**
93
96
  * Builds an `ObjectSchemaNode` representing `<OperationId>Responses` — keyed by HTTP status code.
94
- *
95
- * Example output:
96
- * ```ts
97
- * export type PlaceOrderPatchResponses = { 200: PlaceOrderPatch200; 405: PlaceOrderPatch405 }
98
- * ```
97
+ * Numeric status codes produce unquoted numeric keys (e.g. `200:`).
99
98
  */
100
99
  export function buildResponsesSchemaNode({ node, resolveName }: BuildOperationSchemaOptions): SchemaNode | null {
101
100
  const responsesWithSchema = node.responses.filter((res) => res.schema)
@@ -111,7 +110,7 @@ export function buildResponsesSchemaNode({ node, resolveName }: BuildOperationSc
111
110
  name: String(res.statusCode),
112
111
  schema: createSchema({
113
112
  type: 'ref',
114
- name: resolveName({ name: `${node.operationId} ${res.statusCode}`, type: 'function' }),
113
+ name: resolveName({ name: `${node.operationId} Status ${res.statusCode}`, type: 'function' }),
115
114
  }),
116
115
  }),
117
116
  ),
@@ -120,11 +119,7 @@ export function buildResponsesSchemaNode({ node, resolveName }: BuildOperationSc
120
119
 
121
120
  /**
122
121
  * Builds a `UnionSchemaNode` representing `<OperationId>Response` — all response types in union format.
123
- *
124
- * Example output:
125
- * ```ts
126
- * export type PlaceOrderPatchResponse = PlaceOrderPatch200 | PlaceOrderPatch405
127
- * ```
122
+ * Returns `null` when the operation has no responses with schemas.
128
123
  */
129
124
  export function buildResponseUnionSchemaNode({ node, resolveName }: BuildOperationSchemaOptions): SchemaNode | null {
130
125
  const responsesWithSchema = node.responses.filter((res) => res.schema)
@@ -138,7 +133,7 @@ export function buildResponseUnionSchemaNode({ node, resolveName }: BuildOperati
138
133
  members: responsesWithSchema.map((res) =>
139
134
  createSchema({
140
135
  type: 'ref',
141
- name: resolveName({ name: `${node.operationId} ${res.statusCode}`, type: 'function' }),
136
+ name: resolveName({ name: `${node.operationId} Status ${res.statusCode}`, type: 'function' }),
142
137
  }),
143
138
  ),
144
139
  })
package/src/parser.ts CHANGED
@@ -159,7 +159,6 @@ type ParserOptions = {
159
159
  * @note In Kubb v5, `inlineLiteral` becomes the default.
160
160
  */
161
161
  enumType: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral'
162
- mapper?: Record<string, ts.PropertySignature>
163
162
  }
164
163
 
165
164
  /**
@@ -170,7 +169,7 @@ type ParserOptions = {
170
169
  * @param current - The schema node to parse.
171
170
  * @param siblings - Sibling schema nodes, used for context in certain mappings.
172
171
  * @param name - The name of the schema or property being parsed.
173
- * @param options - Parsing options controlling output style, property handling, and custom mappers.
172
+ * @param options - Parsing options controlling output style, property handling.
174
173
  * @returns The generated TypeScript AST node, or `undefined` if the schema keyword is not mapped.
175
174
  */
176
175
  export const parse = createParser<ts.Node | null, ParserOptions>({
@@ -254,12 +253,6 @@ export const parse = createParser<ts.Node | null, ParserOptions>({
254
253
  const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']
255
254
  const mappedName = nameSchema?.args || name
256
255
 
257
- // custom mapper(pluginOptions)
258
- // Use Object.hasOwn to avoid matching inherited properties like 'toString', 'valueOf', etc.
259
- if (options.mapper && Object.hasOwn(options.mapper, mappedName)) {
260
- return options.mapper[mappedName]
261
- }
262
-
263
256
  const isNullish = schemas.some((schema) => schema.keyword === schemaKeywords.nullish)
264
257
  const isNullable = schemas.some((schema) => schema.keyword === schemaKeywords.nullable)
265
258
  const isOptional = schemas.some((schema) => schema.keyword === schemaKeywords.optional)
package/src/plugin.ts CHANGED
@@ -26,7 +26,6 @@ export const pluginTs = definePlugin<PluginTs>((options) => {
26
26
  emptySchemaType = unknownType,
27
27
  syntaxType = 'type',
28
28
  transformers = {},
29
- mapper = {},
30
29
  paramsCasing,
31
30
  generators = [typeGenerator, typeGeneratorV2].filter(Boolean),
32
31
  contentType,
@@ -53,7 +52,6 @@ export const pluginTs = definePlugin<PluginTs>((options) => {
53
52
  syntaxType,
54
53
  group,
55
54
  override,
56
- mapper,
57
55
  paramsCasing,
58
56
  usedEnumNames,
59
57
  },
@@ -102,7 +100,7 @@ export const pluginTs = definePlugin<PluginTs>((options) => {
102
100
  return resolvedName
103
101
  },
104
102
  async install() {
105
- const { config, fabric, plugin, adapter, rootNode, pluginManager, openInStudio } = this
103
+ const { config, fabric, plugin, adapter, rootNode, driver, openInStudio } = this
106
104
 
107
105
  const root = path.resolve(config.root, config.output.path)
108
106
  const mode = getMode(path.resolve(root, output.path))
@@ -129,7 +127,7 @@ export const pluginTs = definePlugin<PluginTs>((options) => {
129
127
  fabric,
130
128
  Component: generator.Schema,
131
129
  plugin,
132
- pluginManager,
130
+ driver,
133
131
  mode,
134
132
  version: generator.version,
135
133
  })
@@ -154,7 +152,7 @@ export const pluginTs = definePlugin<PluginTs>((options) => {
154
152
  fabric,
155
153
  Component: generator.Operation,
156
154
  plugin,
157
- pluginManager,
155
+ driver,
158
156
  mode,
159
157
  version: generator.version,
160
158
  })
@@ -188,7 +186,7 @@ export const pluginTs = definePlugin<PluginTs>((options) => {
188
186
  const schemaGenerator = new SchemaGenerator(this.plugin.options, {
189
187
  fabric: this.fabric,
190
188
  oas,
191
- pluginManager: this.pluginManager,
189
+ driver: this.driver,
192
190
  events: this.events,
193
191
  plugin: this.plugin,
194
192
  contentType,
@@ -204,7 +202,7 @@ export const pluginTs = definePlugin<PluginTs>((options) => {
204
202
  const operationGenerator = new OperationGenerator(this.plugin.options, {
205
203
  fabric: this.fabric,
206
204
  oas,
207
- pluginManager: this.pluginManager,
205
+ driver: this.driver,
208
206
  events: this.events,
209
207
  plugin: this.plugin,
210
208
  contentType,