@kubb/swagger-ts 2.18.5 → 2.18.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.
@@ -7,7 +7,7 @@ import { pluginOasName } from "@kubb/plugin-oas";
7
7
 
8
8
  // src/OperationGenerator.tsx
9
9
  import { OperationGenerator as Generator2 } from "@kubb/plugin-oas";
10
- import { Oas as Oas3 } from "@kubb/plugin-oas/components";
10
+ import { Oas as Oas4 } from "@kubb/plugin-oas/components";
11
11
  import { App as App2, createRoot as createRoot2 } from "@kubb/react";
12
12
 
13
13
  // src/components/OasType.tsx
@@ -41,23 +41,31 @@ OasType.File = function({ name, typeName, templates = defaultTemplates }) {
41
41
  OasType.templates = defaultTemplates;
42
42
 
43
43
  // src/components/OperationSchema.tsx
44
- import transformers2 from "@kubb/core/transformers";
44
+ import transformers3 from "@kubb/core/transformers";
45
45
  import { print as print2 } from "@kubb/parser-ts";
46
- import * as factory2 from "@kubb/parser-ts/factory";
47
- import { Oas as Oas2 } from "@kubb/plugin-oas/components";
46
+ import * as factory3 from "@kubb/parser-ts/factory";
47
+ import { Oas as Oas3 } from "@kubb/plugin-oas/components";
48
48
  import { useOas as useOas2, useOperation, useOperationManager } from "@kubb/plugin-oas/hooks";
49
- import { File as File2, Parser as Parser2, useApp as useApp2 } from "@kubb/react";
49
+ import { File as File3, Parser as Parser2, useApp as useApp3 } from "@kubb/react";
50
50
 
51
51
  // src/SchemaGenerator.tsx
52
52
  import { SchemaGenerator as Generator } from "@kubb/plugin-oas";
53
- import { Oas } from "@kubb/plugin-oas/components";
53
+ import { Oas as Oas2 } from "@kubb/plugin-oas/components";
54
54
  import { App, createRoot } from "@kubb/react";
55
55
 
56
- // src/typeParser.ts
57
- import transformers from "@kubb/core/transformers";
56
+ // src/components/Schema.tsx
57
+ import { Oas } from "@kubb/plugin-oas/components";
58
+ import { File as File2, useApp as useApp2 } from "@kubb/react";
59
+ import transformers2 from "@kubb/core/transformers";
58
60
  import { print } from "@kubb/parser-ts";
61
+ import * as factory2 from "@kubb/parser-ts/factory";
62
+ import { SchemaGenerator, schemaKeywords as schemaKeywords2 } from "@kubb/plugin-oas";
63
+ import { useSchema } from "@kubb/plugin-oas/hooks";
64
+
65
+ // src/parser/index.ts
66
+ import transformers from "@kubb/core/transformers";
59
67
  import * as factory from "@kubb/parser-ts/factory";
60
- import { SchemaGenerator, isKeyword, schemaKeywords } from "@kubb/plugin-oas";
68
+ import { isKeyword, schemaKeywords } from "@kubb/plugin-oas";
61
69
  var typeKeywordMapper = {
62
70
  any: () => factory.keywordTypeNodes.any,
63
71
  unknown: () => factory.keywordTypeNodes.unknown,
@@ -151,19 +159,19 @@ var typeKeywordMapper = {
151
159
  catchall: void 0,
152
160
  name: void 0
153
161
  };
154
- function parseTypeMeta(parent, current, options) {
162
+ function parse(parent, current, options) {
155
163
  const value = typeKeywordMapper[current.keyword];
156
164
  if (!value) {
157
165
  return void 0;
158
166
  }
159
167
  if (isKeyword(current, schemaKeywords.union)) {
160
- return typeKeywordMapper.union(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean));
168
+ return typeKeywordMapper.union(current.args.map((schema) => parse(current, schema, options)).filter(Boolean));
161
169
  }
162
170
  if (isKeyword(current, schemaKeywords.and)) {
163
- return typeKeywordMapper.and(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean));
171
+ return typeKeywordMapper.and(current.args.map((schema) => parse(current, schema, options)).filter(Boolean));
164
172
  }
165
173
  if (isKeyword(current, schemaKeywords.array)) {
166
- return typeKeywordMapper.array(current.args.items.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean));
174
+ return typeKeywordMapper.array(current.args.items.map((schema) => parse(current, schema, options)).filter(Boolean));
167
175
  }
168
176
  if (isKeyword(current, schemaKeywords.enum)) {
169
177
  return typeKeywordMapper.enum(current.args.typeName);
@@ -175,7 +183,7 @@ function parseTypeMeta(parent, current, options) {
175
183
  return value();
176
184
  }
177
185
  if (isKeyword(current, schemaKeywords.tuple)) {
178
- return typeKeywordMapper.tuple(current.args.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean));
186
+ return typeKeywordMapper.tuple(current.args.map((schema) => parse(current, schema, options)).filter(Boolean));
179
187
  }
180
188
  if (isKeyword(current, schemaKeywords.const)) {
181
189
  return typeKeywordMapper.const(current.args.name, current.args.format);
@@ -199,7 +207,7 @@ function parseTypeMeta(parent, current, options) {
199
207
  const defaultSchema = schemas.find((schema) => schema.keyword === schemaKeywords.default);
200
208
  const exampleSchema = schemas.find((schema) => schema.keyword === schemaKeywords.example);
201
209
  const schemaSchema = schemas.find((schema) => schema.keyword === schemaKeywords.schema);
202
- let type = schemas.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean)[0];
210
+ let type = schemas.map((schema) => parse(current, schema, options)).filter(Boolean)[0];
203
211
  if (isNullable) {
204
212
  type = factory.createUnionDeclaration({
205
213
  nodes: [type, factory.keywordTypeNodes.null]
@@ -233,7 +241,7 @@ function parseTypeMeta(parent, current, options) {
233
241
  });
234
242
  });
235
243
  const additionalProperties = current.args?.additionalProperties?.length ? factory.createIndexSignature(
236
- current.args.additionalProperties.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean).at(0)
244
+ current.args.additionalProperties.map((schema) => parse(current, schema, options)).filter(Boolean).at(0)
237
245
  ) : void 0;
238
246
  return typeKeywordMapper.object([...properties, additionalProperties].filter(Boolean));
239
247
  }
@@ -251,57 +259,78 @@ function parseTypeMeta(parent, current, options) {
251
259
  }
252
260
  return void 0;
253
261
  }
254
- function typeParser(schemas, options) {
262
+
263
+ // src/components/Schema.tsx
264
+ import { jsx as jsx2 } from "@kubb/react/jsx-runtime";
265
+ function Schema(props) {
266
+ const { keysToOmit, description } = props;
267
+ const { tree, name } = useSchema();
268
+ const {
269
+ pluginManager,
270
+ plugin: {
271
+ options: { enumType, optionalType }
272
+ }
273
+ } = useApp2();
274
+ const resolvedName = pluginManager.resolveName({
275
+ name,
276
+ pluginKey: [pluginTsName],
277
+ type: "function"
278
+ });
279
+ const typeName = pluginManager.resolveName({
280
+ name,
281
+ pluginKey: [pluginTsName],
282
+ type: "type"
283
+ });
255
284
  const nodes = [];
256
285
  const extraNodes = [];
257
- if (!schemas.length) {
286
+ if (!tree.length) {
258
287
  return "";
259
288
  }
260
- const isNullish = schemas.some((item) => item.keyword === schemaKeywords.nullish);
261
- const isNullable = schemas.some((item) => item.keyword === schemaKeywords.nullable);
262
- const isOptional = schemas.some((item) => item.keyword === schemaKeywords.optional);
263
- let type = schemas.map((schema) => parseTypeMeta(void 0, schema, options)).filter(Boolean).at(0) || typeKeywordMapper.undefined();
289
+ const isNullish = tree.some((item) => item.keyword === schemaKeywords2.nullish);
290
+ const isNullable = tree.some((item) => item.keyword === schemaKeywords2.nullable);
291
+ const isOptional = tree.some((item) => item.keyword === schemaKeywords2.optional);
292
+ let type = tree.map((schema) => parse(void 0, schema, { name: resolvedName, typeName, description, keysToOmit, optionalType, enumType })).filter(Boolean).at(0) || typeKeywordMapper.undefined();
264
293
  if (isNullable) {
265
- type = factory.createUnionDeclaration({
266
- nodes: [type, factory.keywordTypeNodes.null]
294
+ type = factory2.createUnionDeclaration({
295
+ nodes: [type, factory2.keywordTypeNodes.null]
267
296
  });
268
297
  }
269
- if (isNullish && ["undefined", "questionTokenAndUndefined"].includes(options.optionalType)) {
270
- type = factory.createUnionDeclaration({
271
- nodes: [type, factory.keywordTypeNodes.undefined]
298
+ if (isNullish && ["undefined", "questionTokenAndUndefined"].includes(optionalType)) {
299
+ type = factory2.createUnionDeclaration({
300
+ nodes: [type, factory2.keywordTypeNodes.undefined]
272
301
  });
273
302
  }
274
- if (isOptional && ["undefined", "questionTokenAndUndefined"].includes(options.optionalType)) {
275
- type = factory.createUnionDeclaration({
276
- nodes: [type, factory.keywordTypeNodes.undefined]
303
+ if (isOptional && ["undefined", "questionTokenAndUndefined"].includes(optionalType)) {
304
+ type = factory2.createUnionDeclaration({
305
+ nodes: [type, factory2.keywordTypeNodes.undefined]
277
306
  });
278
307
  }
279
- const node = factory.createTypeAliasDeclaration({
280
- modifiers: [factory.modifiers.export],
281
- name: options.name,
282
- type: options.keysToOmit?.length ? factory.createOmitDeclaration({
283
- keys: options.keysToOmit,
308
+ const node = factory2.createTypeAliasDeclaration({
309
+ modifiers: [factory2.modifiers.export],
310
+ name: resolvedName,
311
+ type: keysToOmit?.length ? factory2.createOmitDeclaration({
312
+ keys: keysToOmit,
284
313
  type,
285
314
  nonNullable: true
286
315
  }) : type
287
316
  });
288
- const enumSchemas = SchemaGenerator.deepSearch(schemas, schemaKeywords.enum);
317
+ const enumSchemas = SchemaGenerator.deepSearch(tree, schemaKeywords2.enum);
289
318
  if (enumSchemas) {
290
319
  enumSchemas.forEach((enumSchema) => {
291
320
  extraNodes.push(
292
- ...factory.createEnumDeclaration({
293
- name: transformers.camelCase(enumSchema.args.name),
321
+ ...factory2.createEnumDeclaration({
322
+ name: transformers2.camelCase(enumSchema.args.name),
294
323
  typeName: enumSchema.args.typeName,
295
- enums: enumSchema.args.items.map((item) => item.value === void 0 ? void 0 : [transformers.trimQuotes(item.name?.toString()), item.value]).filter(Boolean),
296
- type: options.enumType
324
+ enums: enumSchema.args.items.map((item) => item.value === void 0 ? void 0 : [transformers2.trimQuotes(item.name?.toString()), item.value]).filter(Boolean),
325
+ type: enumType
297
326
  })
298
327
  );
299
328
  });
300
329
  }
301
330
  nodes.push(
302
- factory.appendJSDocToNode({
331
+ factory2.appendJSDocToNode({
303
332
  node,
304
- comments: [options.description ? `@description ${transformers.jsStringEscape(options.description)}` : void 0].filter(Boolean)
333
+ comments: [description ? `@description ${transformers2.jsStringEscape(description)}` : void 0].filter(Boolean)
305
334
  })
306
335
  );
307
336
  const filterdNodes = nodes.filter(
@@ -311,57 +340,30 @@ function typeParser(schemas, options) {
311
340
  );
312
341
  return print([...extraNodes, ...filterdNodes]);
313
342
  }
343
+ Schema.File = function({}) {
344
+ const { pluginManager } = useApp2();
345
+ const { schema } = useSchema();
346
+ return /* @__PURE__ */ jsx2(Oas.Schema.File, { output: pluginManager.config.output.path, children: /* @__PURE__ */ jsx2(File2.Source, { children: /* @__PURE__ */ jsx2(Schema, { description: schema?.description }) }) });
347
+ };
314
348
 
315
349
  // src/SchemaGenerator.tsx
316
- import { jsx as jsx2 } from "@kubb/react/jsx-runtime";
350
+ import { jsx as jsx3 } from "@kubb/react/jsx-runtime";
317
351
  var SchemaGenerator2 = class extends Generator {
318
352
  async schema(name, schema) {
319
- const { oas, pluginManager, mode, plugin, output } = this.context;
353
+ const { oas, pluginManager, plugin, mode, output } = this.context;
320
354
  const root = createRoot({
321
355
  logger: pluginManager.logger
322
356
  });
323
357
  const tree = this.parse({ schema, name });
324
- const source = this.getSource(name, tree);
325
358
  root.render(
326
- /* @__PURE__ */ jsx2(App, { pluginManager, plugin, mode, children: /* @__PURE__ */ jsx2(Oas, { oas, children: /* @__PURE__ */ jsx2(Oas.Schema, { name, value: schema, tree, children: /* @__PURE__ */ jsx2(Oas.Schema.File, { isTypeOnly: true, output, children: source.join("\n") }) }) }) })
359
+ /* @__PURE__ */ jsx3(App, { pluginManager, plugin, mode, children: /* @__PURE__ */ jsx3(Oas2, { oas, children: /* @__PURE__ */ jsx3(Oas2.Schema, { name, value: schema, tree, children: /* @__PURE__ */ jsx3(Schema.File, {}) }) }) })
327
360
  );
328
361
  return root.files;
329
362
  }
330
- // TODO convert to a react component called `Schema.Parser` with props parser as part of the SchemaContext
331
- getSource(name, schemas, { keysToOmit, description } = {}) {
332
- const texts = [];
333
- const resolvedName = this.context.pluginManager.resolveName({
334
- name,
335
- pluginKey: [pluginTsName],
336
- type: "function"
337
- });
338
- const resolvedTypeName = this.context.pluginManager.resolveName({
339
- name,
340
- pluginKey: [pluginTsName],
341
- type: "type"
342
- });
343
- const typeOutput = typeParser(schemas, {
344
- name: resolvedName,
345
- typeName: resolvedTypeName,
346
- description,
347
- enumType: this.options.enumType || "asConst",
348
- optionalType: this.options.optionalType,
349
- keysToOmit
350
- });
351
- texts.push(typeOutput);
352
- return texts;
353
- }
354
- /**
355
- * @deprecated only used for testing
356
- */
357
- buildSource(name, schema, options = {}) {
358
- const schemas = this.parse({ schema, name });
359
- return this.getSource(name, schemas, options);
360
- }
361
363
  };
362
364
 
363
365
  // src/components/OperationSchema.tsx
364
- import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "@kubb/react/jsx-runtime";
366
+ import { jsx as jsx4, jsxs as jsxs2 } from "@kubb/react/jsx-runtime";
365
367
  function printCombinedSchema({
366
368
  name,
367
369
  operation,
@@ -375,7 +377,7 @@ function printCombinedSchema({
375
377
  pluginKey: [pluginTsName],
376
378
  type: "function"
377
379
  });
378
- properties["response"] = factory2.createTypeReferenceNode(factory2.createIdentifier(identifier), void 0);
380
+ properties["response"] = factory3.createTypeReferenceNode(factory3.createIdentifier(identifier), void 0);
379
381
  }
380
382
  if (schemas.request) {
381
383
  const identifier = pluginManager.resolveName({
@@ -383,7 +385,7 @@ function printCombinedSchema({
383
385
  pluginKey: [pluginTsName],
384
386
  type: "function"
385
387
  });
386
- properties["request"] = factory2.createTypeReferenceNode(factory2.createIdentifier(identifier), void 0);
388
+ properties["request"] = factory3.createTypeReferenceNode(factory3.createIdentifier(identifier), void 0);
387
389
  }
388
390
  if (schemas.pathParams) {
389
391
  const identifier = pluginManager.resolveName({
@@ -391,7 +393,7 @@ function printCombinedSchema({
391
393
  pluginKey: [pluginTsName],
392
394
  type: "function"
393
395
  });
394
- properties["pathParams"] = factory2.createTypeReferenceNode(factory2.createIdentifier(identifier), void 0);
396
+ properties["pathParams"] = factory3.createTypeReferenceNode(factory3.createIdentifier(identifier), void 0);
395
397
  }
396
398
  if (schemas.queryParams) {
397
399
  const identifier = pluginManager.resolveName({
@@ -399,7 +401,7 @@ function printCombinedSchema({
399
401
  pluginKey: [pluginTsName],
400
402
  type: "function"
401
403
  });
402
- properties["queryParams"] = factory2.createTypeReferenceNode(factory2.createIdentifier(identifier), void 0);
404
+ properties["queryParams"] = factory3.createTypeReferenceNode(factory3.createIdentifier(identifier), void 0);
403
405
  }
404
406
  if (schemas.headerParams) {
405
407
  const identifier = pluginManager.resolveName({
@@ -407,43 +409,43 @@ function printCombinedSchema({
407
409
  pluginKey: [pluginTsName],
408
410
  type: "function"
409
411
  });
410
- properties["headerParams"] = factory2.createTypeReferenceNode(factory2.createIdentifier(identifier), void 0);
412
+ properties["headerParams"] = factory3.createTypeReferenceNode(factory3.createIdentifier(identifier), void 0);
411
413
  }
412
414
  if (schemas.errors) {
413
- properties["errors"] = factory2.createUnionDeclaration({
415
+ properties["errors"] = factory3.createUnionDeclaration({
414
416
  nodes: schemas.errors.map((error) => {
415
417
  const identifier = pluginManager.resolveName({
416
418
  name: error.name,
417
419
  pluginKey: [pluginTsName],
418
420
  type: "function"
419
421
  });
420
- return factory2.createTypeReferenceNode(factory2.createIdentifier(identifier), void 0);
422
+ return factory3.createTypeReferenceNode(factory3.createIdentifier(identifier), void 0);
421
423
  })
422
424
  });
423
425
  }
424
- const namespaceNode = factory2.createTypeAliasDeclaration({
426
+ const namespaceNode = factory3.createTypeAliasDeclaration({
425
427
  name: operation.method === "get" ? `${name}Query` : `${name}Mutation`,
426
- type: factory2.createTypeLiteralNode(
428
+ type: factory3.createTypeLiteralNode(
427
429
  Object.keys(properties).map((key) => {
428
430
  const type = properties[key];
429
431
  if (!type) {
430
432
  return void 0;
431
433
  }
432
- return factory2.createPropertySignature({
433
- name: transformers2.pascalCase(key),
434
+ return factory3.createPropertySignature({
435
+ name: transformers3.pascalCase(key),
434
436
  type
435
437
  });
436
438
  }).filter(Boolean)
437
439
  ),
438
- modifiers: [factory2.modifiers.export]
440
+ modifiers: [factory3.modifiers.export]
439
441
  });
440
442
  return print2(namespaceNode);
441
443
  }
442
- function OperationSchema({}) {
443
- return /* @__PURE__ */ jsx3(Fragment2, {});
444
+ function OperationSchema({ keysToOmit, description }) {
445
+ return /* @__PURE__ */ jsx4(Schema, { keysToOmit, description });
444
446
  }
445
447
  OperationSchema.File = function({}) {
446
- const { pluginManager, plugin, mode, fileManager } = useApp2();
448
+ const { pluginManager, plugin, mode, fileManager } = useApp3();
447
449
  const oas = useOas2();
448
450
  const { getSchemas, getFile, getName } = useOperationManager();
449
451
  const operation = useOperation();
@@ -458,22 +460,21 @@ OperationSchema.File = function({}) {
458
460
  override: plugin.options.override
459
461
  });
460
462
  const items = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response].flat().filter(Boolean);
461
- const mapItem = ({ name, schema, ...options }, i) => {
463
+ const mapItem = ({ name, schema, description, keysToOmit, ...options }, i) => {
462
464
  const tree = generator.parse({ schema, name });
463
- const source = generator.getSource(name, tree, options);
464
- return /* @__PURE__ */ jsxs2(Oas2.Schema, { name, value: schema, tree, children: [
465
- mode === "split" && /* @__PURE__ */ jsx3(Oas2.Schema.Imports, { isTypeOnly: true }),
466
- /* @__PURE__ */ jsx3(File2.Source, { children: source.join("\n") })
465
+ return /* @__PURE__ */ jsxs2(Oas3.Schema, { name, value: schema, tree, children: [
466
+ mode === "split" && /* @__PURE__ */ jsx4(Oas3.Schema.Imports, { isTypeOnly: true }),
467
+ /* @__PURE__ */ jsx4(File3.Source, { children: /* @__PURE__ */ jsx4(OperationSchema, { description, keysToOmit }) })
467
468
  ] }, i);
468
469
  };
469
- return /* @__PURE__ */ jsx3(Parser2, { language: "typescript", children: /* @__PURE__ */ jsxs2(File2, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
470
+ return /* @__PURE__ */ jsx4(Parser2, { language: "typescript", children: /* @__PURE__ */ jsxs2(File3, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
470
471
  items.map(mapItem),
471
- /* @__PURE__ */ jsx3(File2.Source, { children: printCombinedSchema({ name: factoryName, operation, schemas, pluginManager }) })
472
+ /* @__PURE__ */ jsx4(File3.Source, { children: printCombinedSchema({ name: factoryName, operation, schemas, pluginManager }) })
472
473
  ] }) });
473
474
  };
474
475
 
475
476
  // src/OperationGenerator.tsx
476
- import { jsx as jsx4 } from "@kubb/react/jsx-runtime";
477
+ import { jsx as jsx5 } from "@kubb/react/jsx-runtime";
477
478
  var OperationGenerator = class extends Generator2 {
478
479
  async all(operations) {
479
480
  const { oas, pluginManager, plugin, mode } = this.context;
@@ -481,7 +482,7 @@ var OperationGenerator = class extends Generator2 {
481
482
  logger: pluginManager.logger
482
483
  });
483
484
  root.render(
484
- /* @__PURE__ */ jsx4(App2, { pluginManager, plugin, mode, children: /* @__PURE__ */ jsx4(Oas3, { oas, operations, generator: this, children: plugin.options.oasType && /* @__PURE__ */ jsx4(OasType.File, { name: "oas", typeName: "Oas" }) }) })
485
+ /* @__PURE__ */ jsx5(App2, { pluginManager, plugin, mode, children: /* @__PURE__ */ jsx5(Oas4, { oas, operations, generator: this, children: plugin.options.oasType && /* @__PURE__ */ jsx5(OasType.File, { name: "oas", typeName: "Oas" }) }) })
485
486
  );
486
487
  return root.files;
487
488
  }
@@ -491,7 +492,7 @@ var OperationGenerator = class extends Generator2 {
491
492
  logger: pluginManager.logger
492
493
  });
493
494
  root.render(
494
- /* @__PURE__ */ jsx4(App2, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ jsx4(Oas3, { oas, operations: [operation], generator: this, children: /* @__PURE__ */ jsx4(Oas3.Operation, { operation, children: /* @__PURE__ */ jsx4(OperationSchema.File, {}) }) }) })
495
+ /* @__PURE__ */ jsx5(App2, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ jsx5(Oas4, { oas, operations: [operation], generator: this, children: /* @__PURE__ */ jsx5(Oas4.Operation, { operation, children: /* @__PURE__ */ jsx5(OperationSchema.File, {}) }) }) })
495
496
  );
496
497
  return root.files;
497
498
  }
@@ -511,14 +512,14 @@ var pluginTs = createPlugin((options) => {
511
512
  dateType = "string",
512
513
  unknownType = "any",
513
514
  optionalType = "questionToken",
514
- transformers: transformers3 = {},
515
+ transformers: transformers4 = {},
515
516
  oasType = false
516
517
  } = options;
517
518
  const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`;
518
519
  return {
519
520
  name: pluginTsName,
520
521
  options: {
521
- transformers: transformers3,
522
+ transformers: transformers4,
522
523
  dateType,
523
524
  optionalType,
524
525
  oasType,
@@ -545,7 +546,7 @@ var pluginTs = createPlugin((options) => {
545
546
  resolveName(name, type) {
546
547
  const resolvedName = pascalCase(name, { isFile: type === "file" });
547
548
  if (type) {
548
- return transformers3?.name?.(resolvedName, type) || resolvedName;
549
+ return transformers4?.name?.(resolvedName, type) || resolvedName;
549
550
  }
550
551
  return resolvedName;
551
552
  },
@@ -607,10 +608,11 @@ var src_default = definePluginDefault;
607
608
 
608
609
  export {
609
610
  OasType,
611
+ Schema,
610
612
  OperationSchema,
611
613
  pluginTsName,
612
614
  pluginTs,
613
615
  definePlugin,
614
616
  src_default
615
617
  };
616
- //# sourceMappingURL=chunk-THUX7LK4.js.map
618
+ //# sourceMappingURL=chunk-UJR52JIE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugin.ts","../src/OperationGenerator.tsx","../src/components/OasType.tsx","../src/components/OperationSchema.tsx","../src/SchemaGenerator.tsx","../src/components/Schema.tsx","../src/parser/index.ts","../src/index.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { SchemaGenerator } from './SchemaGenerator.tsx'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport type { PluginTs } from './types.ts'\n\nexport const pluginTsName = 'plugin-ts' satisfies PluginTs['name']\n\nexport const pluginTs = createPlugin<PluginTs>((options) => {\n const {\n output = { path: 'types' },\n group,\n exclude = [],\n include,\n override = [],\n enumType = 'asConst',\n enumSuffix = '',\n dateType = 'string',\n unknownType = 'any',\n optionalType = 'questionToken',\n transformers = {},\n oasType = false,\n } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginTsName,\n options: {\n transformers,\n dateType,\n optionalType,\n oasType,\n enumType,\n enumSuffix,\n // keep the used enumnames between SchemaGenerator and OperationGenerator per plugin(pluginKey)\n usedEnumNames: {},\n unknownType,\n override,\n },\n pre: [pluginOasName],\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 if (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = pascalCase(name, { isFile: type === 'file' })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async writeFile(path, source) {\n if (!path.endsWith('.ts') || !source) {\n return\n }\n\n return this.fileManager.write(path, source, { sanity: false })\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.api.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.api.contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build()\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: swaggerPlugin.api.contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build()\n await this.addFile(...operationFiles)\n },\n async buildEnd() {\n if (this.config.output.write === false) {\n return\n }\n\n const root = path.resolve(this.config.root, this.config.output.path)\n\n await this.fileManager.addIndexes({\n root,\n output,\n meta: { pluginKey: this.plugin.key },\n logger: this.logger,\n })\n },\n }\n})\n","import { OperationGenerator as Generator } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\n\nimport { OasType } from './components/OasType.tsx'\nimport { OperationSchema } from './components/OperationSchema.tsx'\n\nimport type { Operation } from '@kubb/oas'\nimport type { OperationMethodResult } from '@kubb/plugin-oas'\nimport type { FileMeta, PluginTs } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginTs['resolvedOptions'], PluginTs> {\n async all(operations: Operation[]): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={this}>\n {plugin.options.oasType && <OasType.File name=\"oas\" typeName=\"Oas\" />}\n </Oas>\n </App>,\n )\n\n return root.files\n }\n\n async operation(operation: Operation, options: PluginTs['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={this}>\n <Oas.Operation operation={operation}>\n <OperationSchema.File />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n}\n","import { Parser, File, Type, useApp } from '@kubb/react'\nimport { useOas } from '@kubb/plugin-oas/hooks'\n\nimport type { OasTypes } from '@kubb/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginTs } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n api: OasTypes.OASDocument\n}\n\nfunction Template({ name, typeName, api }: TemplateProps): ReactNode {\n return (\n <>\n {`export const ${name} = ${JSON.stringify(api, undefined, 2)} as const`}\n <br />\n <Type name={typeName} export>\n {`Infer<typeof ${name}>`}\n </Type>\n </>\n )\n}\n\nconst defaultTemplates = { default: Template } as const\n\ntype Props = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function OasType({ name, typeName, Template = defaultTemplates.default }: Props): ReactNode {\n const oas = useOas()\n\n return <Template name={name} typeName={typeName} api={oas.api} />\n}\n\ntype FileProps = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: typeof defaultTemplates\n}\n\nOasType.File = function ({ name, typeName, templates = defaultTemplates }: FileProps): ReactNode {\n const {\n pluginManager,\n plugin: { key: pluginKey },\n } = useApp<PluginTs>()\n const file = pluginManager.getFile({ name, extName: '.ts', pluginKey })\n\n const Template = templates.default\n\n return (\n <Parser language=\"typescript\">\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n <File.Import name={['Infer']} path=\"@kubb/swagger-ts/oas\" isTypeOnly />\n <File.Source>\n <OasType Template={Template} name={name} typeName={typeName} />\n </File.Source>\n </File>\n </Parser>\n )\n}\n\nOasType.templates = defaultTemplates\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser-ts'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { useOas, useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { File, Parser, useApp } from '@kubb/react'\n\nimport { SchemaGenerator } from '../SchemaGenerator.tsx'\n\nimport type { PluginManager } from '@kubb/core'\nimport type { Operation } from '@kubb/oas'\nimport type { ts } from '@kubb/parser-ts'\nimport type { OperationSchema as OperationSchemaType } from '@kubb/plugin-oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/swagger-ts'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginTs } from '../types.ts'\nimport { Schema } from './Schema.tsx'\n\nfunction printCombinedSchema({\n name,\n operation,\n schemas,\n pluginManager,\n}: { name: string; operation: Operation; schemas: OperationSchemas; pluginManager: PluginManager }): string {\n const properties: Record<string, ts.TypeNode> = {}\n\n if (schemas.response) {\n const identifier = pluginManager.resolveName({\n name: schemas.response.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['response'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.request) {\n const identifier = pluginManager.resolveName({\n name: schemas.request.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['request'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.pathParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.pathParams.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['pathParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.queryParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.queryParams.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['queryParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.headerParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.headerParams.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['headerParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map((error) => {\n const identifier = pluginManager.resolveName({\n name: error.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n\n return factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }),\n })!\n }\n\n const namespaceNode = factory.createTypeAliasDeclaration({\n name: operation.method === 'get' ? `${name}Query` : `${name}Mutation`,\n type: factory.createTypeLiteralNode(\n Object.keys(properties)\n .map((key) => {\n const type = properties[key]\n if (!type) {\n return undefined\n }\n\n return factory.createPropertySignature({\n name: transformers.pascalCase(key),\n type,\n })\n })\n .filter(Boolean),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n return print(namespaceNode)\n}\n\ntype Props = {\n description?: string\n keysToOmit?: string[]\n}\n\nexport function OperationSchema({ keysToOmit, description }: Props): ReactNode {\n return <Schema keysToOmit={keysToOmit} description={description} />\n}\n\ntype FileProps = {}\n\nOperationSchema.File = function ({}: FileProps): ReactNode {\n const { pluginManager, plugin, mode, fileManager } = useApp<PluginTs>()\n const oas = useOas()\n const { getSchemas, getFile, getName } = useOperationManager()\n const operation = useOperation()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const factoryName = getName(operation, { type: 'type' })\n const generator = new SchemaGenerator(plugin.options, {\n oas,\n plugin,\n pluginManager,\n mode,\n override: plugin.options.override,\n })\n const items = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response].flat().filter(Boolean)\n\n const mapItem = ({ name, schema, description, keysToOmit, ...options }: OperationSchemaType, i: number) => {\n const tree = generator.parse({ schema, name })\n\n return (\n <Oas.Schema key={i} name={name} value={schema} tree={tree}>\n {mode === 'split' && <Oas.Schema.Imports isTypeOnly />}\n <File.Source>\n <OperationSchema description={description} keysToOmit={keysToOmit} />\n </File.Source>\n </Oas.Schema>\n )\n }\n\n return (\n <Parser language=\"typescript\">\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n {items.map(mapItem)}\n\n <File.Source>{printCombinedSchema({ name: factoryName, operation, schemas, pluginManager })}</File.Source>\n </File>\n </Parser>\n )\n}\n","import type { SchemaObject } from '@kubb/oas'\nimport { SchemaGenerator as Generator } from '@kubb/plugin-oas'\nimport type { SchemaMethodResult } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\nimport { Schema } from './components/Schema.tsx'\nimport type { FileMeta, PluginTs } from './types.ts'\n\nexport class SchemaGenerator extends Generator<PluginTs['resolvedOptions'], PluginTs> {\n async schema(name: string, schema: SchemaObject): SchemaMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode, output } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const tree = this.parse({ schema, name })\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={name} value={schema} tree={tree}>\n <Schema.File />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n}\n","import { Oas } from '@kubb/plugin-oas/components'\nimport { File, useApp } from '@kubb/react'\n\nimport transformers from '@kubb/core/transformers'\nimport { print, type ts } from '@kubb/parser-ts'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { useSchema } from '@kubb/plugin-oas/hooks'\nimport type { ReactNode } from 'react'\nimport { parse, typeKeywordMapper } from '../parser/index.ts'\nimport { pluginTsName } from '../plugin.ts'\nimport type { PluginTs } from '../types.ts'\n\ntype Props = {\n description?: string\n keysToOmit?: string[]\n}\n\nexport function Schema(props: Props): ReactNode {\n const { keysToOmit, description } = props\n const { tree, name } = useSchema()\n const {\n pluginManager,\n plugin: {\n options: { enumType, optionalType },\n },\n } = useApp<PluginTs>()\n\n // all checks are also inside this.schema(React)\n const resolvedName = pluginManager.resolveName({\n name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n\n const typeName = pluginManager.resolveName({\n name,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n\n const nodes: ts.Node[] = []\n const extraNodes: ts.Node[] = []\n\n if (!tree.length) {\n return ''\n }\n\n const isNullish = tree.some((item) => item.keyword === schemaKeywords.nullish)\n const isNullable = tree.some((item) => item.keyword === schemaKeywords.nullable)\n const isOptional = tree.some((item) => item.keyword === schemaKeywords.optional)\n\n let type =\n (tree\n .map((schema) => parse(undefined, schema, { name: resolvedName, typeName, description, keysToOmit, optionalType, enumType }))\n .filter(Boolean)\n .at(0) as ts.TypeNode) || typeKeywordMapper.undefined()\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n const node = factory.createTypeAliasDeclaration({\n modifiers: [factory.modifiers.export],\n name: resolvedName,\n type: keysToOmit?.length\n ? factory.createOmitDeclaration({\n keys: keysToOmit,\n type,\n nonNullable: true,\n })\n : type,\n })\n\n const enumSchemas = SchemaGenerator.deepSearch(tree, schemaKeywords.enum)\n if (enumSchemas) {\n enumSchemas.forEach((enumSchema) => {\n extraNodes.push(\n ...factory.createEnumDeclaration({\n name: transformers.camelCase(enumSchema.args.name),\n typeName: enumSchema.args.typeName,\n enums: enumSchema.args.items\n .map((item) => (item.value === undefined ? undefined : [transformers.trimQuotes(item.name?.toString()), item.value]))\n .filter(Boolean) as unknown as [string, string][],\n type: enumType,\n }),\n )\n })\n }\n\n nodes.push(\n factory.appendJSDocToNode({\n node,\n comments: [description ? `@description ${transformers.jsStringEscape(description)}` : undefined].filter(Boolean),\n }),\n )\n\n const filterdNodes = nodes.filter(\n (node: ts.Node) =>\n !extraNodes.some(\n (extraNode: ts.Node) => (extraNode as ts.TypeAliasDeclaration)?.name?.escapedText === (node as ts.TypeAliasDeclaration)?.name?.escapedText,\n ),\n )\n\n return print([...extraNodes, ...filterdNodes])\n}\n\ntype FileProps = {}\n\nSchema.File = function ({}: FileProps): ReactNode {\n const { pluginManager } = useApp<PluginTs>()\n const { schema } = useSchema()\n\n return (\n <Oas.Schema.File output={pluginManager.config.output.path}>\n <File.Source>\n <Schema description={schema?.description} />\n </File.Source>\n </Oas.Schema.File>\n )\n}\n","import transformers from '@kubb/core/transformers'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { isKeyword, schemaKeywords } from '@kubb/plugin-oas'\n\nimport type { ts } from '@kubb/parser-ts'\nimport type { Schema, SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'\n\nexport const typeKeywordMapper = {\n any: () => factory.keywordTypeNodes.any,\n unknown: () => factory.keywordTypeNodes.unknown,\n number: () => factory.keywordTypeNodes.number,\n integer: () => factory.keywordTypeNodes.number,\n object: (nodes?: ts.TypeElement[]) => {\n if (!nodes) {\n return factory.keywordTypeNodes.object\n }\n\n return factory.createTypeLiteralNode(nodes)\n },\n string: () => factory.keywordTypeNodes.string,\n boolean: () => factory.keywordTypeNodes.boolean,\n undefined: () => factory.keywordTypeNodes.undefined,\n nullable: undefined,\n null: () => factory.keywordTypeNodes.null,\n nullish: undefined,\n array: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createArrayDeclaration({ nodes })\n },\n tuple: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createTupleTypeNode(nodes)\n },\n enum: (name?: string) => {\n if (!name) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(name, undefined)\n },\n union: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createUnionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n const: (name?: string | number, format?: 'string' | 'number') => {\n if (!name) {\n return undefined\n }\n\n if (format === 'number') {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(name))\n }\n\n return factory.createLiteralTypeNode(factory.createStringLiteral(name.toString()))\n },\n datetime: () => factory.keywordTypeNodes.string,\n date: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n time: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n uuid: undefined,\n url: undefined,\n strict: undefined,\n default: undefined,\n and: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createIntersectionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n describe: undefined,\n min: undefined,\n max: undefined,\n optional: undefined,\n matches: undefined,\n email: undefined,\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n ref: (propertyName?: string) => {\n if (!propertyName) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(propertyName, undefined)\n },\n blob: () => factory.createTypeReferenceNode('Blob', []),\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: undefined,\n name: undefined,\n} satisfies SchemaMapper<ts.Node | null | undefined>\n\ntype ParserOptions = {\n name: string\n typeName?: string\n description?: string\n /**\n * @default `'questionToken'`\n */\n optionalType: 'questionToken' | 'undefined' | 'questionTokenAndUndefined'\n /**\n * @default `'asConst'`\n */\n enumType: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n keysToOmit?: string[]\n mapper?: SchemaMapper\n}\n\nexport function parse(parent: Schema | undefined, current: Schema, options: ParserOptions): ts.Node | null | undefined {\n const value = typeKeywordMapper[current.keyword as keyof typeof typeKeywordMapper]\n\n if (!value) {\n return undefined\n }\n\n if (isKeyword(current, schemaKeywords.union)) {\n return typeKeywordMapper.union(current.args.map((schema) => parse(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.and)) {\n return typeKeywordMapper.and(current.args.map((schema) => parse(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.array)) {\n return typeKeywordMapper.array(current.args.items.map((schema) => parse(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.enum)) {\n return typeKeywordMapper.enum(current.args.typeName)\n }\n\n if (isKeyword(current, schemaKeywords.ref)) {\n return typeKeywordMapper.ref(current.args.name)\n }\n\n if (isKeyword(current, schemaKeywords.blob)) {\n return value()\n }\n\n if (isKeyword(current, schemaKeywords.tuple)) {\n return typeKeywordMapper.tuple(current.args.map((schema) => parse(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.const)) {\n return typeKeywordMapper.const(current.args.name, current.args.format)\n }\n\n if (isKeyword(current, schemaKeywords.object)) {\n const properties = Object.entries(current.args?.properties || {})\n .filter((item) => {\n const schemas = item[1]\n return schemas && typeof schemas.map === 'function'\n })\n .map(([_name, schemas]) => {\n let name = _name\n const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n\n if (nameSchema) {\n name = nameSchema.args\n }\n\n const isNullish = schemas.some((schema) => schema.keyword === schemaKeywords.nullish)\n const isNullable = schemas.some((schema) => schema.keyword === schemaKeywords.nullable)\n const isOptional = schemas.some((schema) => schema.keyword === schemaKeywords.optional)\n const isReadonly = schemas.some((schema) => schema.keyword === schemaKeywords.readOnly)\n const describeSchema = schemas.find((schema) => schema.keyword === schemaKeywords.describe) as SchemaKeywordMapper['describe'] | undefined\n const deprecatedSchema = schemas.find((schema) => schema.keyword === schemaKeywords.deprecated) as SchemaKeywordMapper['deprecated'] | undefined\n const defaultSchema = schemas.find((schema) => schema.keyword === schemaKeywords.default) as SchemaKeywordMapper['default'] | undefined\n const exampleSchema = schemas.find((schema) => schema.keyword === schemaKeywords.example) as SchemaKeywordMapper['example'] | undefined\n const schemaSchema = schemas.find((schema) => schema.keyword === schemaKeywords.schema) as SchemaKeywordMapper['schema'] | undefined\n\n let type = schemas.map((schema) => parse(current, schema, options)).filter(Boolean)[0] as ts.TypeNode\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n const propertySignature = factory.createPropertySignature({\n questionToken: isOptional || isNullish ? ['questionToken', 'questionTokenAndUndefined'].includes(options.optionalType as string) : false,\n name,\n type,\n readOnly: isReadonly,\n })\n\n return factory.appendJSDocToNode({\n node: propertySignature,\n comments: [\n describeSchema ? `@description ${transformers.jsStringEscape(describeSchema.args)}` : undefined,\n deprecatedSchema ? '@deprecated' : undefined,\n defaultSchema ? `@default ${defaultSchema.args}` : undefined,\n exampleSchema ? `@example ${exampleSchema.args}` : undefined,\n schemaSchema?.args?.type || schemaSchema?.args?.format\n ? [`@type ${schemaSchema?.args?.type || 'unknown'}${!isOptional ? '' : ' | undefined'}`, schemaSchema?.args?.format].filter(Boolean).join(', ')\n : undefined,\n ].filter(Boolean),\n })\n })\n\n const additionalProperties = current.args?.additionalProperties?.length\n ? factory.createIndexSignature(\n current.args.additionalProperties\n .map((schema) => parse(current, schema, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode,\n )\n : undefined\n\n return typeKeywordMapper.object([...properties, additionalProperties].filter(Boolean))\n }\n\n if (isKeyword(current, schemaKeywords.datetime)) {\n return typeKeywordMapper.datetime()\n }\n\n if (isKeyword(current, schemaKeywords.date)) {\n return typeKeywordMapper.date(current.args.type)\n }\n\n if (isKeyword(current, schemaKeywords.time)) {\n return typeKeywordMapper.time(current.args.type)\n }\n\n if (current.keyword in typeKeywordMapper) {\n return value()\n }\n\n return undefined\n}\n","import { pluginTs } from './plugin.ts'\n\nexport { pluginTs, pluginTsName } from './plugin.ts'\nexport type { PluginTs } from './types.ts'\n\n/**\n * @deprecated Use `import { pluginTs } from '@kubb/swagger-ts'` instead\n */\nconst definePluginDefault = pluginTs\n/**\n * @deprecated Use `import { pluginTs } from '@kubb/swagger-ts'` instead\n */\nexport const definePlugin = pluginTs\n\nexport default definePluginDefault\n"],"mappings":";AAAA,OAAO,UAAU;AAEjB,SAAS,aAAa,eAAe,oBAAoB;AACzD,SAAS,WAAW,kBAAkB;AACtC,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;;;ACL9B,SAAS,sBAAsBA,kBAAiB;AAChD,SAAS,OAAAC,YAAW;AACpB,SAAS,OAAAC,MAAK,cAAAC,mBAAkB;;;ACFhC,SAAS,QAAQ,MAAM,MAAM,cAAc;AAC3C,SAAS,cAAc;AAiBnB,mBAEE,KAFF;AAFJ,SAAS,SAAS,EAAE,MAAM,UAAU,IAAI,GAA6B;AACnE,SACE,iCACG;AAAA,oBAAgB,IAAI,MAAM,KAAK,UAAU,KAAK,QAAW,CAAC,CAAC;AAAA,IAC5D,oBAAC,QAAG;AAAA,IACJ,oBAAC,QAAK,MAAM,UAAU,QAAM,MACzB,0BAAgB,IAAI,KACvB;AAAA,KACF;AAEJ;AAEA,IAAM,mBAAmB,EAAE,SAAS,SAAS;AAWtC,SAAS,QAAQ,EAAE,MAAM,UAAU,UAAAC,YAAW,iBAAiB,QAAQ,GAAqB;AACjG,QAAM,MAAM,OAAO;AAEnB,SAAO,oBAACA,WAAA,EAAS,MAAY,UAAoB,KAAK,IAAI,KAAK;AACjE;AAWA,QAAQ,OAAO,SAAU,EAAE,MAAM,UAAU,YAAY,iBAAiB,GAAyB;AAC/F,QAAM;AAAA,IACJ;AAAA,IACA,QAAQ,EAAE,KAAK,UAAU;AAAA,EAC3B,IAAI,OAAiB;AACrB,QAAM,OAAO,cAAc,QAAQ,EAAE,MAAM,SAAS,OAAO,UAAU,CAAC;AAEtE,QAAMA,YAAW,UAAU;AAE3B,SACE,oBAAC,UAAO,UAA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A,EACF;AACF,CAAC;;;AO9HD,IAAM,sBAAsB;AAIrB,IAAM,eAAe;AAE5B,IAAO,cAAQ;","names":["Generator","Oas","App","createRoot","Template","transformers","print","factory","Oas","useOas","File","Parser","useApp","Oas","File","useApp","transformers","factory","schemaKeywords","jsx","useApp","schemaKeywords","transformers","node","File","jsx","SchemaGenerator","Oas","jsx","jsxs","transformers","print","useApp","useOas","SchemaGenerator","Oas","File","Parser","jsx","Generator","createRoot","App","Oas","transformers","options","path","SchemaGenerator"]}
@@ -1,9 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkL3VGPEJScjs = require('./chunk-L3VGPEJS.cjs');
5
4
 
5
+ var _chunkDRW5SRC6cjs = require('./chunk-DRW5SRC6.cjs');
6
6
 
7
7
 
8
- exports.OasType = _chunkL3VGPEJScjs.OasType; exports.OperationSchema = _chunkL3VGPEJScjs.OperationSchema;
8
+
9
+
10
+ exports.OasType = _chunkDRW5SRC6cjs.OasType; exports.OperationSchema = _chunkDRW5SRC6cjs.OperationSchema; exports.Schema = _chunkDRW5SRC6cjs.Schema;
9
11
  //# sourceMappingURL=components.cjs.map
@@ -13,7 +13,7 @@ declare function Template({ name, typeName, api }: TemplateProps): ReactNode;
13
13
  declare const defaultTemplates: {
14
14
  readonly default: typeof Template;
15
15
  };
16
- type Props$1 = {
16
+ type Props$2 = {
17
17
  name: string;
18
18
  typeName: string;
19
19
  /**
@@ -21,14 +21,14 @@ type Props$1 = {
21
21
  */
22
22
  Template?: React.ComponentType<React.ComponentProps<typeof Template>>;
23
23
  };
24
- declare function OasType({ name, typeName, Template }: Props$1): ReactNode;
24
+ declare function OasType({ name, typeName, Template }: Props$2): ReactNode;
25
25
  declare namespace OasType {
26
- var File: ({ name, typeName, templates }: FileProps$1) => ReactNode;
26
+ var File: ({ name, typeName, templates }: FileProps$2) => ReactNode;
27
27
  var templates: {
28
28
  readonly default: typeof Template;
29
29
  };
30
30
  }
31
- type FileProps$1 = {
31
+ type FileProps$2 = {
32
32
  name: string;
33
33
  typeName: string;
34
34
  /**
@@ -37,11 +37,24 @@ type FileProps$1 = {
37
37
  templates?: typeof defaultTemplates;
38
38
  };
39
39
 
40
- type Props = {};
41
- declare function OperationSchema({}: Props): ReactNode;
40
+ type Props$1 = {
41
+ description?: string;
42
+ keysToOmit?: string[];
43
+ };
44
+ declare function OperationSchema({ keysToOmit, description }: Props$1): ReactNode;
42
45
  declare namespace OperationSchema {
46
+ var File: ({}: FileProps$1) => ReactNode;
47
+ }
48
+ type FileProps$1 = {};
49
+
50
+ type Props = {
51
+ description?: string;
52
+ keysToOmit?: string[];
53
+ };
54
+ declare function Schema(props: Props): ReactNode;
55
+ declare namespace Schema {
43
56
  var File: ({}: FileProps) => ReactNode;
44
57
  }
45
58
  type FileProps = {};
46
59
 
47
- export { OasType, OperationSchema };
60
+ export { OasType, OperationSchema, Schema };