@kubb/plugin-oas 3.5.6 → 3.5.8

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/{OperationGenerator-ID776sgX.d.cts → OperationGenerator-C_n_FNWe.d.cts} +6 -16
  2. package/dist/{OperationGenerator-ID776sgX.d.ts → OperationGenerator-C_n_FNWe.d.ts} +6 -16
  3. package/dist/{Schema-DXifFLPy.d.cts → Schema-0TEphQBX.d.cts} +1 -1
  4. package/dist/{Schema-BhKPR3fk.d.ts → Schema-CisxeooY.d.ts} +1 -1
  5. package/dist/{chunk-6BM3CVIN.js → chunk-3DX5ALTN.js} +5 -5
  6. package/dist/chunk-3DX5ALTN.js.map +1 -0
  7. package/dist/{chunk-XNCEFOE6.js → chunk-3Y4QGY6D.js} +13 -11
  8. package/dist/chunk-3Y4QGY6D.js.map +1 -0
  9. package/dist/{chunk-QAFBZLJA.cjs → chunk-B7KP5ZFA.cjs} +13 -11
  10. package/dist/chunk-B7KP5ZFA.cjs.map +1 -0
  11. package/dist/{chunk-Y2G53DHK.js → chunk-EMSV6TX2.js} +3 -3
  12. package/dist/{chunk-Y2G53DHK.js.map → chunk-EMSV6TX2.js.map} +1 -1
  13. package/dist/{chunk-W5N2APGH.cjs → chunk-FNXIO7AH.cjs} +5 -5
  14. package/dist/{chunk-W5N2APGH.cjs.map → chunk-FNXIO7AH.cjs.map} +1 -1
  15. package/dist/{chunk-4QYJW6ME.cjs → chunk-I2J55EM2.cjs} +20 -20
  16. package/dist/chunk-I2J55EM2.cjs.map +1 -0
  17. package/dist/{chunk-ZGRPPBK4.js → chunk-M7Q45QED.js} +18 -18
  18. package/dist/chunk-M7Q45QED.js.map +1 -0
  19. package/dist/{chunk-XXKSJDBY.cjs → chunk-TKFFW62C.cjs} +5 -5
  20. package/dist/chunk-TKFFW62C.cjs.map +1 -0
  21. package/dist/components.d.cts +2 -2
  22. package/dist/components.d.ts +2 -2
  23. package/dist/generators.cjs +4 -4
  24. package/dist/generators.d.cts +1 -1
  25. package/dist/generators.d.ts +1 -1
  26. package/dist/generators.js +3 -3
  27. package/dist/hooks.cjs +9 -9
  28. package/dist/hooks.cjs.map +1 -1
  29. package/dist/hooks.d.cts +2 -2
  30. package/dist/hooks.d.ts +2 -2
  31. package/dist/hooks.js +8 -8
  32. package/dist/hooks.js.map +1 -1
  33. package/dist/index.cjs +34 -40
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +2 -2
  36. package/dist/index.d.ts +2 -2
  37. package/dist/index.js +27 -33
  38. package/dist/index.js.map +1 -1
  39. package/dist/utils.cjs +11 -11
  40. package/dist/utils.d.cts +11 -4
  41. package/dist/utils.d.ts +11 -4
  42. package/dist/utils.js +2 -2
  43. package/package.json +9 -9
  44. package/src/OperationGenerator.ts +2 -4
  45. package/src/SchemaGenerator.ts +1 -1
  46. package/src/hooks/useOperationManager.ts +1 -1
  47. package/src/hooks/useSchemaManager.ts +1 -1
  48. package/src/plugin.ts +0 -6
  49. package/src/types.ts +5 -8
  50. package/src/utils/getSchemas.ts +1 -1
  51. package/src/utils/index.ts +0 -1
  52. package/dist/chunk-4QYJW6ME.cjs.map +0 -1
  53. package/dist/chunk-6BM3CVIN.js.map +0 -1
  54. package/dist/chunk-QAFBZLJA.cjs.map +0 -1
  55. package/dist/chunk-XNCEFOE6.js.map +0 -1
  56. package/dist/chunk-XXKSJDBY.cjs.map +0 -1
  57. package/dist/chunk-ZGRPPBK4.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { Plugin, ResolveNameParams, Output, Group, PluginFactoryOptions, FileMetaBase, BaseGenerator, PluginManager } from '@kubb/core';
2
2
  import * as KubbFile from '@kubb/fs/types';
3
- import { Oas, contentType, OasTypes, SchemaObject, Operation, HttpMethod } from '@kubb/oas';
3
+ import { Oas, contentType, SchemaObject, Operation, HttpMethod } from '@kubb/oas';
4
4
  import { KubbNode } from '@kubb/react/types';
5
5
 
6
6
  type SchemaKeywordMapper = {
@@ -265,14 +265,6 @@ type SchemaTree = {
265
265
  };
266
266
  declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
267
267
 
268
- type Mode = 'schemas' | 'responses' | 'requestBodies';
269
- type GetSchemasProps = {
270
- oas: Oas;
271
- contentType?: contentType;
272
- includes?: Mode[];
273
- };
274
- declare function getSchemas({ oas, contentType, includes }: GetSchemasProps): Record<string, OasTypes.SchemaObject>;
275
-
276
268
  type ResolvePathOptions = {
277
269
  pluginKey?: Plugin['key'];
278
270
  group?: {
@@ -283,9 +275,7 @@ type ResolvePathOptions = {
283
275
  };
284
276
  type API = {
285
277
  getOas: () => Promise<Oas>;
286
- getSchemas: (options?: Pick<GetSchemasProps, 'includes'>) => Promise<Record<string, SchemaObject>>;
287
278
  getBaseURL: () => Promise<string | undefined>;
288
- contentType?: contentType;
289
279
  };
290
280
  type Options = {
291
281
  /**
@@ -311,7 +301,7 @@ type Options = {
311
301
  serverIndex?: number;
312
302
  /**
313
303
  * Define which contentType should be used.
314
- * By default, this is set based on the contentType being found.
304
+ * By default, the first JSON valid mediaType will be used
315
305
  */
316
306
  contentType?: contentType;
317
307
  /**
@@ -474,7 +464,7 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
474
464
  /**
475
465
  * Schema
476
466
  */
477
- schema(name: string, object: SchemaObject, options: TOptions): SchemaMethodResult<TFileMeta>;
467
+ schema(_name: string, _object: SchemaObject, _options: TOptions): SchemaMethodResult<TFileMeta>;
478
468
  }
479
469
 
480
470
  type OperationsProps<TOptions extends PluginFactoryOptions> = {
@@ -538,11 +528,11 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
538
528
  /**
539
529
  * Operation
540
530
  */
541
- operation(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
531
+ operation(_operation: Operation, _options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
542
532
  /**
543
533
  * Combination of GET, POST, PATCH, PUT, DELETE
544
534
  */
545
- all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta>;
535
+ all(_operations: Operation[], _paths: OperationsByMethod): OperationMethodResult<TFileMeta>;
546
536
  }
547
537
 
548
- export { type API as A, getSchemas as B, type Exclude as E, type GetSchemaGeneratorOptions as G, type Include as I, type Options as O, type PluginOas as P, type ReactGeneratorOptions as R, type SchemaGeneratorBuildOptions as S, type OperationMethodResult as a, OperationGenerator as b, type SchemaGeneratorOptions as c, type SchemaMethodResult as d, SchemaGenerator as e, type Schema as f, type SchemaTree as g, type SchemaKeyword as h, type SchemaKeywordBase as i, type SchemaKeywordMapper as j, type SchemaMapper as k, isKeyword as l, createGenerator as m, createReactGenerator as n, type Generator as o, type GeneratorOptions as p, type ResolvePathOptions as q, type Ref as r, schemaKeywords as s, type Refs as t, type Resolver as u, type OperationSchema as v, type OperationSchemas as w, type OperationsByMethod as x, type Override as y, type GetSchemasProps as z };
538
+ export { type API as A, type Exclude as E, type GetSchemaGeneratorOptions as G, type Include as I, type Options as O, type PluginOas as P, type ReactGeneratorOptions as R, type SchemaGeneratorBuildOptions as S, type OperationMethodResult as a, OperationGenerator as b, type SchemaGeneratorOptions as c, type SchemaMethodResult as d, SchemaGenerator as e, type Schema as f, type SchemaTree as g, type SchemaKeyword as h, type SchemaKeywordBase as i, type SchemaKeywordMapper as j, type SchemaMapper as k, isKeyword as l, createGenerator as m, createReactGenerator as n, type Generator as o, type GeneratorOptions as p, type ResolvePathOptions as q, type Ref as r, schemaKeywords as s, type Refs as t, type Resolver as u, type OperationSchema as v, type OperationSchemas as w, type OperationsByMethod as x, type Override as y };
@@ -1,6 +1,6 @@
1
1
  import { Plugin, ResolveNameParams, Output, Group, PluginFactoryOptions, FileMetaBase, BaseGenerator, PluginManager } from '@kubb/core';
2
2
  import * as KubbFile from '@kubb/fs/types';
3
- import { Oas, contentType, OasTypes, SchemaObject, Operation, HttpMethod } from '@kubb/oas';
3
+ import { Oas, contentType, SchemaObject, Operation, HttpMethod } from '@kubb/oas';
4
4
  import { KubbNode } from '@kubb/react/types';
5
5
 
6
6
  type SchemaKeywordMapper = {
@@ -265,14 +265,6 @@ type SchemaTree = {
265
265
  };
266
266
  declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
267
267
 
268
- type Mode = 'schemas' | 'responses' | 'requestBodies';
269
- type GetSchemasProps = {
270
- oas: Oas;
271
- contentType?: contentType;
272
- includes?: Mode[];
273
- };
274
- declare function getSchemas({ oas, contentType, includes }: GetSchemasProps): Record<string, OasTypes.SchemaObject>;
275
-
276
268
  type ResolvePathOptions = {
277
269
  pluginKey?: Plugin['key'];
278
270
  group?: {
@@ -283,9 +275,7 @@ type ResolvePathOptions = {
283
275
  };
284
276
  type API = {
285
277
  getOas: () => Promise<Oas>;
286
- getSchemas: (options?: Pick<GetSchemasProps, 'includes'>) => Promise<Record<string, SchemaObject>>;
287
278
  getBaseURL: () => Promise<string | undefined>;
288
- contentType?: contentType;
289
279
  };
290
280
  type Options = {
291
281
  /**
@@ -311,7 +301,7 @@ type Options = {
311
301
  serverIndex?: number;
312
302
  /**
313
303
  * Define which contentType should be used.
314
- * By default, this is set based on the contentType being found.
304
+ * By default, the first JSON valid mediaType will be used
315
305
  */
316
306
  contentType?: contentType;
317
307
  /**
@@ -474,7 +464,7 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
474
464
  /**
475
465
  * Schema
476
466
  */
477
- schema(name: string, object: SchemaObject, options: TOptions): SchemaMethodResult<TFileMeta>;
467
+ schema(_name: string, _object: SchemaObject, _options: TOptions): SchemaMethodResult<TFileMeta>;
478
468
  }
479
469
 
480
470
  type OperationsProps<TOptions extends PluginFactoryOptions> = {
@@ -538,11 +528,11 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
538
528
  /**
539
529
  * Operation
540
530
  */
541
- operation(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
531
+ operation(_operation: Operation, _options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
542
532
  /**
543
533
  * Combination of GET, POST, PATCH, PUT, DELETE
544
534
  */
545
- all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta>;
535
+ all(_operations: Operation[], _paths: OperationsByMethod): OperationMethodResult<TFileMeta>;
546
536
  }
547
537
 
548
- export { type API as A, getSchemas as B, type Exclude as E, type GetSchemaGeneratorOptions as G, type Include as I, type Options as O, type PluginOas as P, type ReactGeneratorOptions as R, type SchemaGeneratorBuildOptions as S, type OperationMethodResult as a, OperationGenerator as b, type SchemaGeneratorOptions as c, type SchemaMethodResult as d, SchemaGenerator as e, type Schema as f, type SchemaTree as g, type SchemaKeyword as h, type SchemaKeywordBase as i, type SchemaKeywordMapper as j, type SchemaMapper as k, isKeyword as l, createGenerator as m, createReactGenerator as n, type Generator as o, type GeneratorOptions as p, type ResolvePathOptions as q, type Ref as r, schemaKeywords as s, type Refs as t, type Resolver as u, type OperationSchema as v, type OperationSchemas as w, type OperationsByMethod as x, type Override as y, type GetSchemasProps as z };
538
+ export { type API as A, type Exclude as E, type GetSchemaGeneratorOptions as G, type Include as I, type Options as O, type PluginOas as P, type ReactGeneratorOptions as R, type SchemaGeneratorBuildOptions as S, type OperationMethodResult as a, OperationGenerator as b, type SchemaGeneratorOptions as c, type SchemaMethodResult as d, SchemaGenerator as e, type Schema as f, type SchemaTree as g, type SchemaKeyword as h, type SchemaKeywordBase as i, type SchemaKeywordMapper as j, type SchemaMapper as k, isKeyword as l, createGenerator as m, createReactGenerator as n, type Generator as o, type GeneratorOptions as p, type ResolvePathOptions as q, type Ref as r, schemaKeywords as s, type Refs as t, type Resolver as u, type OperationSchema as v, type OperationSchemas as w, type OperationsByMethod as x, type Override as y };
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { SchemaObject } from '@kubb/oas';
3
3
  import { Key, KubbNode } from '@kubb/react/types';
4
- import { f as Schema$1 } from './OperationGenerator-ID776sgX.cjs';
4
+ import { f as Schema$1 } from './OperationGenerator-C_n_FNWe.cjs';
5
5
 
6
6
  type SchemaContextProps = {
7
7
  name: string;
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { SchemaObject } from '@kubb/oas';
3
3
  import { Key, KubbNode } from '@kubb/react/types';
4
- import { f as Schema$1 } from './OperationGenerator-ID776sgX.js';
4
+ import { f as Schema$1 } from './OperationGenerator-C_n_FNWe.js';
5
5
 
6
6
  type SchemaContextProps = {
7
7
  name: string;
@@ -28,7 +28,7 @@ function getASTParams(operationSchema, {
28
28
  name,
29
29
  enabled: !!name,
30
30
  required: isParam ? schema.required : true,
31
- type: typed ? `${operationSchema.name}["${name}"]` : void 0
31
+ type: typed ? `${operationSchema.name}["${name}"]` : undefined
32
32
  };
33
33
  return override ? override(data) : data;
34
34
  });
@@ -70,7 +70,7 @@ function parseFromConfig(config, oasClass = Oas) {
70
70
  }
71
71
  function getBanner({ output, oas }) {
72
72
  if (!output.banner) {
73
- return void 0;
73
+ return undefined;
74
74
  }
75
75
  if (isFunction(output.banner)) {
76
76
  return output.banner(oas);
@@ -79,7 +79,7 @@ function getBanner({ output, oas }) {
79
79
  }
80
80
  function getFooter({ output, oas }) {
81
81
  if (!output.footer) {
82
- return void 0;
82
+ return undefined;
83
83
  }
84
84
  if (isFunction(output.footer)) {
85
85
  return output.footer(oas);
@@ -88,5 +88,5 @@ function getFooter({ output, oas }) {
88
88
  }
89
89
 
90
90
  export { getASTParams, getBanner, getComments, getFooter, getPathParams, parseFromConfig };
91
- //# sourceMappingURL=chunk-6BM3CVIN.js.map
92
- //# sourceMappingURL=chunk-6BM3CVIN.js.map
91
+ //# sourceMappingURL=chunk-3DX5ALTN.js.map
92
+ //# sourceMappingURL=chunk-3DX5ALTN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/getComments.ts","../src/utils/getParams.ts","../src/utils/parseFromConfig.ts","../src/utils/getBanner.ts","../src/utils/getFooter.ts"],"names":["api","URLPath","isFunction"],"mappings":";;;;;;;;;AAKO,SAAS,YAAY,SAAgC,EAAA;AAC1D,EAAO,OAAA;AAAA,IACL,UAAU,cAAe,EAAA,IAAK,CAAgB,aAAA,EAAA,SAAA,CAAU,gBAAgB,CAAA,CAAA;AAAA,IACxE,UAAU,UAAW,EAAA,IAAK,CAAY,SAAA,EAAA,SAAA,CAAU,YAAY,CAAA,CAAA;AAAA,IAC5D,SAAA,CAAU,QAAQ,CAAU,OAAA,EAAA,IAAI,QAAQ,SAAU,CAAA,IAAI,EAAE,GAAG,CAAA,CAAA,CAAA;AAAA,IAC3D,SAAA,CAAU,cAAkB,IAAA;AAAA,GAC9B,CACG,MAAO,CAAA,OAAO,CACd,CAAA,GAAA,CAAI,CAAC,IAAS,KAAA,YAAA,CAAa,IAAK,CAAA,IAAI,CAAC,CAAA;AAC1C;ACFO,SAAS,aACd,eACA,EAAA;AAAA,EACE,KAAQ,GAAA,KAAA;AAAA,EACR;AACF,CAAA,GAGI,EACiB,EAAA;AACrB,EAAI,IAAA,CAAC,mBAAmB,CAAC,eAAA,CAAgB,OAAO,UAAc,IAAA,CAAC,gBAAgB,IAAM,EAAA;AACnF,IAAA,OAAO,EAAC;AAAA;AAGV,EAAO,OAAA,MAAA,CAAO,OAAQ,CAAA,eAAA,CAAgB,MAAO,CAAA,UAAU,CAAE,CAAA,GAAA,CAAI,CAAC,CAAC,IAAM,EAAA,MAAM,CAAuC,KAAA;AAChH,IAAM,MAAA,OAAA,GAAU,kBAAkB,MAAM,CAAA;AACxC,IAAA,MAAM,IAA0B,GAAA;AAAA,MAC9B,IAAA;AAAA,MACA,OAAA,EAAS,CAAC,CAAC,IAAA;AAAA,MACX,QAAA,EAAU,OAAU,GAAA,MAAA,CAAO,QAAW,GAAA,IAAA;AAAA,MACtC,MAAM,KAAQ,GAAA,CAAA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/transformers'\nimport { URLPath } from '@kubb/core/utils'\n\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `{@link ${new URLPath(operation.path).URL}}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter(Boolean)\n .map((text) => transformers.trim(text))\n}\n","import { isParameterObject } from '@kubb/oas'\n\nimport { camelCase, isValidVarName } from '@kubb/core/transformers'\nimport type { FunctionParamsAST } from '@kubb/core/utils'\nimport type { OasTypes } from '@kubb/oas'\nimport type { Params } from '@kubb/react/types'\nimport type { OperationSchema } from '../types.ts'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n override,\n }: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) {\n return []\n }\n\n return Object.entries(operationSchema.schema.properties).map(([name, schema]: [string, OasTypes.SchemaObject]) => {\n const isParam = isParameterObject(schema)\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: isParam ? schema.required : true,\n type: typed ? `${operationSchema.name}[\"${name}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n casing?: 'camelcase'\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n let name = isValidVarName(curr.name) ? curr.name : camelCase(curr.name)\n\n if (options.casing === 'camelcase') {\n name = camelCase(name)\n }\n\n acc[name] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n","import { resolve } from 'node:path'\n\nimport { URLPath } from '@kubb/core/utils'\n\nimport { parse } from '@kubb/oas'\n\nimport type { Config } from '@kubb/core'\nimport { Oas, type OasTypes } from '@kubb/oas'\nimport yaml from '@stoplight/yaml'\n\nexport function parseFromConfig(config: Config, oasClass: typeof Oas = Oas): Promise<Oas> {\n if ('data' in config.input) {\n if (typeof config.input.data === 'object') {\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n return parse(api, oasClass)\n }\n\n try {\n const api: string = yaml.parse(config.input.data as string) as string\n\n return parse(api, oasClass)\n } catch (e) {\n /* empty */\n }\n\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n\n return parse(api, oasClass)\n }\n\n if (new URLPath(config.input.path).isURL) {\n return parse(config.input.path, oasClass)\n }\n\n return parse(resolve(config.root, config.input.path), oasClass)\n}\n","import type { Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props = {\n oas: Oas\n output: Output<Oas>\n}\n\nexport function getBanner({ output, oas }: Props) {\n if (!output.banner) {\n return undefined\n }\n\n if (isFunction(output.banner)) {\n return output.banner(oas)\n }\n\n return output.banner\n}\n","import type { Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props = {\n oas: Oas\n output: Output<Oas>\n}\n\nexport function getFooter({ output, oas }: Props) {\n if (!output.footer) {\n return undefined\n }\n\n if (isFunction(output.footer)) {\n return output.footer(oas)\n }\n\n return output.footer\n}\n"]}
@@ -1,5 +1,16 @@
1
1
  import { isOpenApiV3_1Document } from '@kubb/oas';
2
2
 
3
+ // src/utils/getSchemaFactory.ts
4
+ function getSchemaFactory(oas) {
5
+ return (schema) => {
6
+ const version = isOpenApiV3_1Document(oas.api) ? "3.1" : "3.0";
7
+ return {
8
+ schema: oas.dereferenceWithRef(schema),
9
+ version
10
+ };
11
+ };
12
+ }
13
+
3
14
  // src/utils/getSchemas.ts
4
15
  function getSchemas({ oas, contentType, includes = ["schemas", "requestBodies", "responses"] }) {
5
16
  const components = oas.getDefinition().components;
@@ -30,16 +41,7 @@ function getSchemas({ oas, contentType, includes = ["schemas", "requestBodies",
30
41
  }
31
42
  return schemas;
32
43
  }
33
- function getSchemaFactory(oas) {
34
- return (schema) => {
35
- const version = isOpenApiV3_1Document(oas.api) ? "3.1" : "3.0";
36
- return {
37
- schema: oas.dereferenceWithRef(schema),
38
- version
39
- };
40
- };
41
- }
42
44
 
43
45
  export { getSchemaFactory, getSchemas };
44
- //# sourceMappingURL=chunk-XNCEFOE6.js.map
45
- //# sourceMappingURL=chunk-XNCEFOE6.js.map
46
+ //# sourceMappingURL=chunk-3Y4QGY6D.js.map
47
+ //# sourceMappingURL=chunk-3Y4QGY6D.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/getSchemaFactory.ts","../src/utils/getSchemas.ts"],"names":[],"mappings":";;;AAuBO,SAAS,iBAAmD,GAA6D,EAAA;AAC9H,EAAA,OAAO,CAAC,MAA0B,KAAA;AAChC,IAAA,MAAM,OAAU,GAAA,qBAAA,CAAsB,GAAI,CAAA,GAAG,IAAI,KAAQ,GAAA,KAAA;AAEzD,IAAO,OAAA;AAAA,MACL,MAAA,EAAQ,GAAI,CAAA,kBAAA,CAAmB,MAAM,CAAA;AAAA,MACrC;AAAA,KACF;AAAA,GACF;AACF;;;ACtBO,SAAS,UAAA,CAAW,EAAE,GAAA,EAAK,WAAa,EAAA,QAAA,GAAW,CAAC,SAAW,EAAA,eAAA,EAAiB,WAAW,CAAA,EAA6D,EAAA;AAC7J,EAAM,MAAA,UAAA,GAAa,GAAI,CAAA,aAAA,EAAgB,CAAA,UAAA;AAEvC,EAAA,IAAI,UAAiD,EAAC;AAEtD,EAAI,IAAA,QAAA,CAAS,QAAS,CAAA,SAAS,CAAG,EAAA;AAChC,IAAU,OAAA,GAAA;AAAA,MACR,GAAG,OAAA;AAAA,MACH,GAAK,UAAY,EAAA,OAAA,IAA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OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'\n\n/**\n * Make it possible to narrow down the schema based on a specific version(3 or 3.1)\n */\ntype SchemaResult<TWithRef extends boolean = false> =\n | {\n schema?: (TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.0'\n }\n | {\n schema?: (TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.1'\n }\n\nexport function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef> {\n return (schema?: SchemaObject) => {\n const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'\n\n return {\n schema: oas.dereferenceWithRef(schema),\n version,\n } as SchemaResult<TWithRef>\n }\n}\n","import type { Oas, OasTypes, contentType } from '@kubb/oas'\n\ntype Mode = 'schemas' | 'responses' | 'requestBodies'\n\ntype GetSchemasProps = {\n oas: Oas\n contentType?: contentType\n includes?: Mode[]\n}\n\nexport function getSchemas({ oas, contentType, includes = ['schemas', 'requestBodies', 'responses'] }: GetSchemasProps): Record<string, OasTypes.SchemaObject> {\n const components = oas.getDefinition().components\n\n let schemas: Record<string, OasTypes.SchemaObject> = {}\n\n if (includes.includes('schemas')) {\n schemas = {\n ...schemas,\n ...((components?.schemas as Record<string, OasTypes.SchemaObject>) || {}),\n }\n }\n\n const requestBodies = components?.requestBodies || {}\n if (includes.includes('responses')) {\n const responses = components?.responses || {}\n\n Object.entries(responses).forEach(([name, response]: [string, OasTypes.ResponseObject]) => {\n if (response.content && !schemas[name]) {\n const firstContentType = Object.keys(response.content)[0] || 'application/json'\n schemas[name] = response.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n if (includes.includes('requestBodies')) {\n Object.entries(requestBodies).forEach(([name, request]: [string, OasTypes.RequestBodyObject]) => {\n if (request.content && !schemas[name]) {\n const firstContentType = Object.keys(request.content)[0] || 'application/json'\n schemas[name] = request.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n return schemas\n}\n"]}
@@ -2,6 +2,17 @@
2
2
 
3
3
  var oas = require('@kubb/oas');
4
4
 
5
+ // src/utils/getSchemaFactory.ts
6
+ function getSchemaFactory(oas$1) {
7
+ return (schema) => {
8
+ const version = oas.isOpenApiV3_1Document(oas$1.api) ? "3.1" : "3.0";
9
+ return {
10
+ schema: oas$1.dereferenceWithRef(schema),
11
+ version
12
+ };
13
+ };
14
+ }
15
+
5
16
  // src/utils/getSchemas.ts
6
17
  function getSchemas({ oas, contentType, includes = ["schemas", "requestBodies", "responses"] }) {
7
18
  const components = oas.getDefinition().components;
@@ -32,17 +43,8 @@ function getSchemas({ oas, contentType, includes = ["schemas", "requestBodies",
32
43
  }
33
44
  return schemas;
34
45
  }
35
- function getSchemaFactory(oas$1) {
36
- return (schema) => {
37
- const version = oas.isOpenApiV3_1Document(oas$1.api) ? "3.1" : "3.0";
38
- return {
39
- schema: oas$1.dereferenceWithRef(schema),
40
- version
41
- };
42
- };
43
- }
44
46
 
45
47
  exports.getSchemaFactory = getSchemaFactory;
46
48
  exports.getSchemas = getSchemas;
47
- //# sourceMappingURL=chunk-QAFBZLJA.cjs.map
48
- //# sourceMappingURL=chunk-QAFBZLJA.cjs.map
49
+ //# sourceMappingURL=chunk-B7KP5ZFA.cjs.map
50
+ //# sourceMappingURL=chunk-B7KP5ZFA.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/getSchemaFactory.ts","../src/utils/getSchemas.ts"],"names":["oas","isOpenApiV3_1Document"],"mappings":";;;;;AAuBO,SAAS,iBAAmDA,KAA6D,EAAA;AAC9H,EAAA,OAAO,CAAC,MAA0B,KAAA;AAChC,IAAA,MAAM,OAAU,GAAAC,yBAAA,CAAsB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A;AACtC,IAAO,MAAA,CAAA,OAAA,CAAQ,aAAa,CAAE,CAAA,OAAA,CAAQ,CAAC,CAAC,IAAA,EAAM,OAAO,CAA4C,KAAA;AAC/F,MAAA,IAAI,OAAQ,CAAA,OAAA,IAAW,CAAC,OAAA,CAAQ,IAAI,CAAG,EAAA;AACrC,QAAA,MAAM,mBAAmB,MAAO,CAAA,IAAA,CAAK,QAAQ,OAAO,CAAA,CAAE,CAAC,CAAK,IAAA,kBAAA;AAC5D,QAAA,OAAA,CAAQ,IAAI,CAAI,GAAA,OAAA,CAAQ,OAAU,GAAA,WAAA,IAAe,gBAAgB,CAAG,EAAA,MAAA;AAAA;AACtE,KACD,CAAA;AAAA;AAGH,EAAO,OAAA,OAAA;AACT","file":"chunk-B7KP5ZFA.cjs","sourcesContent":["import { isOpenApiV3_1Document } from '@kubb/oas'\n\nimport type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'\n\n/**\n * Make it possible to narrow down the schema based on a specific version(3 or 3.1)\n */\ntype SchemaResult<TWithRef extends boolean = false> =\n | {\n schema?: (TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.0'\n }\n | {\n schema?: (TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.1'\n }\n\nexport function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef> {\n return (schema?: SchemaObject) => {\n const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'\n\n return {\n schema: oas.dereferenceWithRef(schema),\n version,\n } as SchemaResult<TWithRef>\n }\n}\n","import type { Oas, OasTypes, contentType } from '@kubb/oas'\n\ntype Mode = 'schemas' | 'responses' | 'requestBodies'\n\ntype GetSchemasProps = {\n oas: Oas\n contentType?: contentType\n includes?: Mode[]\n}\n\nexport function getSchemas({ oas, contentType, includes = ['schemas', 'requestBodies', 'responses'] }: GetSchemasProps): Record<string, OasTypes.SchemaObject> {\n const components = oas.getDefinition().components\n\n let schemas: Record<string, OasTypes.SchemaObject> = {}\n\n if (includes.includes('schemas')) {\n schemas = {\n ...schemas,\n ...((components?.schemas as Record<string, OasTypes.SchemaObject>) || {}),\n }\n }\n\n const requestBodies = components?.requestBodies || {}\n if (includes.includes('responses')) {\n const responses = components?.responses || {}\n\n Object.entries(responses).forEach(([name, response]: [string, OasTypes.ResponseObject]) => {\n if (response.content && !schemas[name]) {\n const firstContentType = Object.keys(response.content)[0] || 'application/json'\n schemas[name] = response.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n if (includes.includes('requestBodies')) {\n Object.entries(requestBodies).forEach(([name, request]: [string, OasTypes.RequestBodyObject]) => {\n if (request.content && !schemas[name]) {\n const firstContentType = Object.keys(request.content)[0] || 'application/json'\n schemas[name] = request.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n return schemas\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { getBanner, getFooter } from './chunk-6BM3CVIN.js';
1
+ import { getBanner, getFooter } from './chunk-3DX5ALTN.js';
2
2
  import { Oas } from './chunk-BAU7PO7T.js';
3
3
  import { camelCase } from '@kubb/core/transformers';
4
4
  import { createRoot, App } from '@kubb/react';
@@ -85,5 +85,5 @@ var jsonGenerator = createGenerator({
85
85
  });
86
86
 
87
87
  export { createGenerator, createReactGenerator, jsonGenerator };
88
- //# sourceMappingURL=chunk-Y2G53DHK.js.map
89
- //# sourceMappingURL=chunk-Y2G53DHK.js.map
88
+ //# sourceMappingURL=chunk-EMSV6TX2.js.map
89
+ //# sourceMappingURL=chunk-EMSV6TX2.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/generator.tsx","../src/generators/jsonGenerator.ts"],"names":[],"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ChF,KACF;AAAA;AAEJ,CAAC","file":"chunk-Y2G53DHK.js","sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\nimport type { Schema } from './SchemaMapper.ts'\nimport type { OperationsByMethod } from './types.ts'\n\ntype OperationsProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operations: Array<Operation>\n operationsByMethod: OperationsByMethod\n}\n\ntype OperationProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operation: Operation\n}\n\ntype SchemaProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n schema: {\n name: string\n tree: Array<Schema>\n value: SchemaObject\n }\n}\n\nexport type GeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions> {\n return parseOptions\n}\n\nexport type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (this: ReactGeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => KubbNode\n Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode\n Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode\n}\n\nexport function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions> {\n return {\n ...parseOptions,\n async operations({ instance, options, operations, operationsByMethod }) {\n if (!parseOptions.Operations) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Operations.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={instance}>\n <Component operations={operations} instance={instance} operationsByMethod={operationsByMethod} options={options} />\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async operation({ instance, operation, options }) {\n if (!parseOptions.Operation) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Operation.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={instance}>\n <Oas.Operation operation={operation}>\n <Component operation={operation} options={options} instance={instance} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async schema({ instance, schema, options }) {\n if (!parseOptions.Schema) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Schema.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={schema.name} value={schema.value} tree={schema.tree}>\n <Component schema={schema} options={options} instance={instance} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n }\n}\n","import { camelCase } from '@kubb/core/transformers'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { createGenerator } from '../generator.tsx'\nimport type { PluginOas } from '../types.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, instance }) {\n const { pluginManager, plugin } = instance.context\n const file = pluginManager.getFile({\n name: camelCase(schema.name),\n extname: '.json',\n mode: 'split',\n pluginKey: plugin.key,\n })\n\n return [\n {\n ...file,\n sources: [\n {\n name: camelCase(schema.name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema.value),\n },\n ],\n banner: getBanner({ oas: instance.context.oas, output: plugin.options.output }),\n format: getFooter({ oas: instance.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"]}
1
+ {"version":3,"sources":["../src/generator.tsx","../src/generators/jsonGenerator.ts"],"names":[],"mappings":";;;;;;AA2CO,SAAS,gBAAuD,YAA+D,EAAA;AACpI,EAAO,OAAA,YAAA;AACT;AASO,SAAS,qBAA4D,YAAoE,EAAA;AAC9I,EAAO,OAAA;AAAA,IACL,GAAG,YAAA;AAAA,IACH,MAAM,UAAW,CAAA,EAAE,UAAU,OAAS,EAAA,UAAA,EAAY,oBAAsB,EAAA;AACtE,MAAI,IAAA,CAAC,aAAa,UAAY,EAAA;AAC5B,QAAA,OAAO,EAAC;AAAA;AAGV,MAAA,MAAM,EAAE,aAAe,EAAA,GAAA,EAAK,MAAQ,EAAA,IAAA,KAAS,QAAS,CAAA,OAAA;AACtD,MAAA,MAAM,OAAO,UAAW,CAAA;AAAA,QACtB,QAAQ,aAAc,CAAA;AAAA,OACvB,CAAA;AAED,MAAA,MAAM,SAAY,GAAA,YAAA,CAAa,UAAW,CAAA,IAAA,CAAK,IAAI,CAAA;AAEnD,MAAK,IAAA,CAAA,MAAA;AAAA,4BACF,GAAI,EAAA,EAAA,aAAA,EAA8B,QAAgB,IACjD,EAAA,QAAA,kBAAA,GAAA,CAAC,OAAI,GAAU,EAAA,UAAA,EAAwB,SAAW,EAAA,QA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,UACP;AAAA,YACE,IAAA,EAAM,SAAU,CAAA,MAAA,CAAO,IAAI,CAAA;AAAA,YAC3B,YAAc,EAAA,KAAA;AAAA,YACd,WAAa,EAAA,KAAA;AAAA,YACb,KAAO,EAAA,IAAA,CAAK,SAAU,CAAA,MAAA,CAAO,KAAK;AAAA;AACpC,SACF;AAAA,QACA,MAAA,EAAQ,SAAU,CAAA,EAAE,GAAK,EAAA,QAAA,CAAS,OAAQ,CAAA,GAAA,EAAK,MAAQ,EAAA,MAAA,CAAO,OAAQ,CAAA,MAAA,EAAQ,CAAA;AAAA,QAC9E,MAAA,EAAQ,SAAU,CAAA,EAAE,GAAK,EAAA,QAAA,CAAS,OAAQ,CAAA,GAAA,EAAK,MAAQ,EAAA,MAAA,CAAO,OAAQ,CAAA,MAAA,EAAQ;AAAA;AAChF,KACF;AAAA;AAEJ,CAAC","file":"chunk-EMSV6TX2.js","sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\nimport type { Schema } from './SchemaMapper.ts'\nimport type { OperationsByMethod } from './types.ts'\n\ntype OperationsProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operations: Array<Operation>\n operationsByMethod: OperationsByMethod\n}\n\ntype OperationProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operation: Operation\n}\n\ntype SchemaProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n schema: {\n name: string\n tree: Array<Schema>\n value: SchemaObject\n }\n}\n\nexport type GeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions> {\n return parseOptions\n}\n\nexport type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (this: ReactGeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => KubbNode\n Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode\n Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode\n}\n\nexport function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions> {\n return {\n ...parseOptions,\n async operations({ instance, options, operations, operationsByMethod }) {\n if (!parseOptions.Operations) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Operations.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={instance}>\n <Component operations={operations} instance={instance} operationsByMethod={operationsByMethod} options={options} />\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async operation({ instance, operation, options }) {\n if (!parseOptions.Operation) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Operation.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={instance}>\n <Oas.Operation operation={operation}>\n <Component operation={operation} options={options} instance={instance} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async schema({ instance, schema, options }) {\n if (!parseOptions.Schema) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Schema.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={schema.name} value={schema.value} tree={schema.tree}>\n <Component schema={schema} options={options} instance={instance} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n }\n}\n","import { camelCase } from '@kubb/core/transformers'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { createGenerator } from '../generator.tsx'\nimport type { PluginOas } from '../types.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, instance }) {\n const { pluginManager, plugin } = instance.context\n const file = pluginManager.getFile({\n name: camelCase(schema.name),\n extname: '.json',\n mode: 'split',\n pluginKey: plugin.key,\n })\n\n return [\n {\n ...file,\n sources: [\n {\n name: camelCase(schema.name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema.value),\n },\n ],\n banner: getBanner({ oas: instance.context.oas, output: plugin.options.output }),\n format: getFooter({ oas: instance.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkXXKSJDBY_cjs = require('./chunk-XXKSJDBY.cjs');
3
+ var chunkTKFFW62C_cjs = require('./chunk-TKFFW62C.cjs');
4
4
  var chunkKXB5DUFD_cjs = require('./chunk-KXB5DUFD.cjs');
5
5
  var transformers = require('@kubb/core/transformers');
6
6
  var react = require('@kubb/react');
@@ -79,8 +79,8 @@ var jsonGenerator = createGenerator({
79
79
  value: JSON.stringify(schema.value)
80
80
  }
81
81
  ],
82
- banner: chunkXXKSJDBY_cjs.getBanner({ oas: instance.context.oas, output: plugin.options.output }),
83
- format: chunkXXKSJDBY_cjs.getFooter({ oas: instance.context.oas, output: plugin.options.output })
82
+ banner: chunkTKFFW62C_cjs.getBanner({ oas: instance.context.oas, output: plugin.options.output }),
83
+ format: chunkTKFFW62C_cjs.getFooter({ oas: instance.context.oas, output: plugin.options.output })
84
84
  }
85
85
  ];
86
86
  }
@@ -89,5 +89,5 @@ var jsonGenerator = createGenerator({
89
89
  exports.createGenerator = createGenerator;
90
90
  exports.createReactGenerator = createReactGenerator;
91
91
  exports.jsonGenerator = jsonGenerator;
92
- //# sourceMappingURL=chunk-W5N2APGH.cjs.map
93
- //# sourceMappingURL=chunk-W5N2APGH.cjs.map
92
+ //# sourceMappingURL=chunk-FNXIO7AH.cjs.map
93
+ //# sourceMappingURL=chunk-FNXIO7AH.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/generator.tsx","../src/generators/jsonGenerator.ts"],"names":["createRoot","App","jsx","Oas","camelCase","getBanner","getFooter"],"mappings":";;;;;;;;AA2CO,SAAS,gBAAuD,YAA+D,EAAA;AACpI,EAAO,OAAA,YAAA;AACT;AASO,SAAS,qBAA4D,YAAoE,EAAA;AAC9I,EAAO,OAAA;AAAA,IACL,GAAG,YAAA;AAAA,IACH,MAAM,UAAW,CAAA,EAAE,UAAU,OAAS,EAAA,UAAA,EAAY,oBAAsB,EAAA;AACtE,MAAI,IAAA,CAAC,aAAa,UAAY,EAAA;AAC5B,QAAA,OAAO,EAAC;AAAA;AAGV,MAAA,MAAM,EAAE,aAAe,EAAA,GAAA,EAAK,MAAQ,EAAA,IAAA,KAAS,QAAS,CAAA,OAAA;AACtD,MAAA,MAAM,OAAOA,gBAAW,CAAA;AAAA,QACtB,QAAQ,aAAc,CAAA;AAAA,OACvB,CAAA;AAED,MAAA,MAAM,SAAY,GAAA,YAAA,CAA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A,EAAME,sBAAU,CAAA,MAAA,CAAO,IAAI,CAAA;AAAA,MAC3B,OAAS,EAAA,OAAA;AAAA,MACT,IAAM,EAAA,OAAA;AAAA,MACN,WAAW,MAAO,CAAA;AAAA,KACnB,CAAA;AAED,IAAO,OAAA;AAAA,MACL;AAAA,QACE,GAAG,IAAA;AAAA,QACH,OAAS,EAAA;AAAA,UACP;AAAA,YACE,IAAA,EAAMA,sBAAU,CAAA,MAAA,CAAO,IAAI,CAAA;AAAA,YAC3B,YAAc,EAAA,KAAA;AAAA,YACd,WAAa,EAAA,KAAA;AAAA,YACb,KAAO,EAAA,IAAA,CAAK,SAAU,CAAA,MAAA,CAAO,KAAK;AAAA;AACpC,SACF;AAAA,QACA,MAAA,EAAQC,2BAAU,CAAA,EAAE,GAAK,EAAA,QAAA,CAAS,OAAQ,CAAA,GAAA,EAAK,MAAQ,EAAA,MAAA,CAAO,OAAQ,CAAA,MAAA,EAAQ,CAAA;AAAA,QAC9E,MAAA,EAAQC,2BAAU,CAAA,EAAE,GAAK,EAAA,QAAA,CAAS,OAAQ,CAAA,GAAA,EAAK,MAAQ,EAAA,MAAA,CAAO,OAAQ,CAAA,MAAA,EAAQ;AAAA;AAChF,KACF;AAAA;AAEJ,CAAC","file":"chunk-W5N2APGH.cjs","sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\nimport type { Schema } from './SchemaMapper.ts'\nimport type { OperationsByMethod } from './types.ts'\n\ntype OperationsProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operations: Array<Operation>\n operationsByMethod: OperationsByMethod\n}\n\ntype OperationProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operation: Operation\n}\n\ntype SchemaProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n schema: {\n name: string\n tree: Array<Schema>\n value: SchemaObject\n }\n}\n\nexport type GeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions> {\n return parseOptions\n}\n\nexport type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (this: ReactGeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => KubbNode\n Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode\n Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode\n}\n\nexport function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions> {\n return {\n ...parseOptions,\n async operations({ instance, options, operations, operationsByMethod }) {\n if (!parseOptions.Operations) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Operations.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={instance}>\n <Component operations={operations} instance={instance} operationsByMethod={operationsByMethod} options={options} />\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async operation({ instance, operation, options }) {\n if (!parseOptions.Operation) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Operation.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={instance}>\n <Oas.Operation operation={operation}>\n <Component operation={operation} options={options} instance={instance} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async schema({ instance, schema, options }) {\n if (!parseOptions.Schema) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Schema.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={schema.name} value={schema.value} tree={schema.tree}>\n <Component schema={schema} options={options} instance={instance} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n }\n}\n","import { camelCase } from '@kubb/core/transformers'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { createGenerator } from '../generator.tsx'\nimport type { PluginOas } from '../types.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, instance }) {\n const { pluginManager, plugin } = instance.context\n const file = pluginManager.getFile({\n name: camelCase(schema.name),\n extname: '.json',\n mode: 'split',\n pluginKey: plugin.key,\n })\n\n return [\n {\n ...file,\n sources: [\n {\n name: camelCase(schema.name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema.value),\n },\n ],\n banner: getBanner({ oas: instance.context.oas, output: plugin.options.output }),\n format: getFooter({ oas: instance.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"]}
1
+ {"version":3,"sources":["../src/generator.tsx","../src/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,QAAA,CAAS,OAAQ,CAAA,GAAA,EAAK,MAAQ,EAAA,MAAA,CAAO,OAAQ,CAAA,MAAA,EAAQ;AAAA;AAChF,KACF;AAAA;AAEJ,CAAC","file":"chunk-FNXIO7AH.cjs","sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\nimport type { Schema } from './SchemaMapper.ts'\nimport type { OperationsByMethod } from './types.ts'\n\ntype OperationsProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operations: Array<Operation>\n operationsByMethod: OperationsByMethod\n}\n\ntype OperationProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operation: Operation\n}\n\ntype SchemaProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n schema: {\n name: string\n tree: Array<Schema>\n value: SchemaObject\n }\n}\n\nexport type GeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions> {\n return parseOptions\n}\n\nexport type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (this: ReactGeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => KubbNode\n Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode\n Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode\n}\n\nexport function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions> {\n return {\n ...parseOptions,\n async operations({ instance, options, operations, operationsByMethod }) {\n if (!parseOptions.Operations) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Operations.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={instance}>\n <Component operations={operations} instance={instance} operationsByMethod={operationsByMethod} options={options} />\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async operation({ instance, operation, options }) {\n if (!parseOptions.Operation) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Operation.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={instance}>\n <Oas.Operation operation={operation}>\n <Component operation={operation} options={options} instance={instance} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n async schema({ instance, schema, options }) {\n if (!parseOptions.Schema) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const Component = parseOptions.Schema.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={schema.name} value={schema.value} tree={schema.tree}>\n <Component schema={schema} options={options} instance={instance} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n\n return root.files\n },\n }\n}\n","import { camelCase } from '@kubb/core/transformers'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { createGenerator } from '../generator.tsx'\nimport type { PluginOas } from '../types.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, instance }) {\n const { pluginManager, plugin } = instance.context\n const file = pluginManager.getFile({\n name: camelCase(schema.name),\n extname: '.json',\n mode: 'split',\n pluginKey: plugin.key,\n })\n\n return [\n {\n ...file,\n sources: [\n {\n name: camelCase(schema.name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema.value),\n },\n ],\n banner: getBanner({ oas: instance.context.oas, output: plugin.options.output }),\n format: getFooter({ oas: instance.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkQAFBZLJA_cjs = require('./chunk-QAFBZLJA.cjs');
3
+ var chunkB7KP5ZFA_cjs = require('./chunk-B7KP5ZFA.cjs');
4
4
  var core = require('@kubb/core');
5
5
  var transformers = require('@kubb/core/transformers');
6
6
  var utils = require('@kubb/core/utils');
@@ -127,7 +127,7 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
127
127
  return foundItems;
128
128
  }
129
129
  static findInObject(tree, keyword) {
130
- let foundItem = void 0;
130
+ let foundItem = undefined;
131
131
  tree?.forEach((schema) => {
132
132
  if (!foundItem && schema.keyword === keyword) {
133
133
  foundItem = schema;
@@ -149,7 +149,7 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
149
149
  return foundItem;
150
150
  }
151
151
  static find(tree, keyword) {
152
- let foundItem = void 0;
152
+ let foundItem = undefined;
153
153
  tree?.forEach((schema) => {
154
154
  if (!foundItem && schema.keyword === keyword) {
155
155
  foundItem = schema;
@@ -295,7 +295,7 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
295
295
  ];
296
296
  }
297
297
  #getParsedSchemaObject(schema) {
298
- const parsedSchema = chunkQAFBZLJA_cjs.getSchemaFactory(this.context.oas)(schema);
298
+ const parsedSchema = chunkB7KP5ZFA_cjs.getSchemaFactory(this.context.oas)(schema);
299
299
  return parsedSchema;
300
300
  }
301
301
  /**
@@ -318,11 +318,11 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
318
318
  }
319
319
  }
320
320
  ];
321
- const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? void 0;
322
- const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? void 0;
321
+ const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined;
322
+ const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined;
323
323
  const nullable = schema.nullable ?? schema["x-nullable"] ?? false;
324
324
  const defaultNullAndNullable = schema.default === null && nullable;
325
- if (schema.default !== void 0 && !defaultNullAndNullable && !Array.isArray(schema.default)) {
325
+ if (schema.default !== undefined && !defaultNullAndNullable && !Array.isArray(schema.default)) {
326
326
  if (typeof schema.default === "string") {
327
327
  baseItems.push({
328
328
  keyword: schemaKeywords.default,
@@ -351,10 +351,10 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
351
351
  args: schema.description
352
352
  });
353
353
  }
354
- if (max !== void 0) {
354
+ if (max !== undefined) {
355
355
  baseItems.unshift({ keyword: schemaKeywords.max, args: max });
356
356
  }
357
- if (min !== void 0) {
357
+ if (min !== undefined) {
358
358
  baseItems.unshift({ keyword: schemaKeywords.min, args: min });
359
359
  }
360
360
  if (nullable) {
@@ -388,7 +388,7 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
388
388
  ].filter(Boolean);
389
389
  }
390
390
  if (schema.oneOf) {
391
- const schemaWithoutOneOf = { ...schema, oneOf: void 0 };
391
+ const schemaWithoutOneOf = { ...schema, oneOf: undefined };
392
392
  const union = {
393
393
  keyword: schemaKeywords.union,
394
394
  args: schema.oneOf.map((item) => {
@@ -411,7 +411,7 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
411
411
  return [union, ...baseItems];
412
412
  }
413
413
  if (schema.anyOf) {
414
- const schemaWithoutAnyOf = { ...schema, anyOf: void 0 };
414
+ const schemaWithoutAnyOf = { ...schema, anyOf: undefined };
415
415
  const union = {
416
416
  keyword: schemaKeywords.union,
417
417
  args: schema.anyOf.map((item) => {
@@ -437,7 +437,7 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
437
437
  return [union, ...baseItems];
438
438
  }
439
439
  if (schema.allOf) {
440
- const schemaWithoutAllOf = { ...schema, allOf: void 0 };
440
+ const schemaWithoutAllOf = { ...schema, allOf: undefined };
441
441
  const and = {
442
442
  keyword: schemaKeywords.and,
443
443
  args: schema.allOf.map((item) => {
@@ -580,8 +580,8 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
580
580
  }
581
581
  if ("prefixItems" in schema) {
582
582
  const prefixItems = schema.prefixItems;
583
- const min2 = schema.minimum ?? schema.minLength ?? schema.minItems ?? void 0;
584
- const max2 = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? void 0;
583
+ const min2 = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined;
584
+ const max2 = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined;
585
585
  return [
586
586
  {
587
587
  keyword: schemaKeywords.tuple,
@@ -680,8 +680,8 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
680
680
  return baseItems;
681
681
  }
682
682
  if ("items" in schema || schema.type === "array") {
683
- const min2 = schema.minimum ?? schema.minLength ?? schema.minItems ?? void 0;
684
- const max2 = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? void 0;
683
+ const min2 = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined;
684
+ const max2 = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined;
685
685
  const items = this.parse({ schema: "items" in schema ? schema.items : [], name, parentName });
686
686
  const unique = !!schema.uniqueItems;
687
687
  return [
@@ -725,7 +725,7 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
725
725
  async build(...generators) {
726
726
  const { oas, contentType, include } = this.context;
727
727
  oas.resolveDiscriminators();
728
- const schemas = chunkQAFBZLJA_cjs.getSchemas({ oas, contentType, includes: include });
728
+ const schemas = chunkB7KP5ZFA_cjs.getSchemas({ oas, contentType, includes: include });
729
729
  const promises = Object.entries(schemas).reduce((acc, [name, value]) => {
730
730
  if (!value) {
731
731
  return acc;
@@ -764,7 +764,7 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
764
764
  /**
765
765
  * Schema
766
766
  */
767
- async schema(name, object, options) {
767
+ async schema(_name, _object, _options) {
768
768
  return [];
769
769
  }
770
770
  };
@@ -772,5 +772,5 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
772
772
  exports.SchemaGenerator = SchemaGenerator;
773
773
  exports.isKeyword = isKeyword;
774
774
  exports.schemaKeywords = schemaKeywords;
775
- //# sourceMappingURL=chunk-4QYJW6ME.cjs.map
776
- //# sourceMappingURL=chunk-4QYJW6ME.cjs.map
775
+ //# sourceMappingURL=chunk-I2J55EM2.cjs.map
776
+ //# sourceMappingURL=chunk-I2J55EM2.cjs.map