@kubb/plugin-oas 4.1.3 → 4.2.0

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 (56) hide show
  1. package/README.md +16 -16
  2. package/dist/{Oas-CuqAnIw-.js → Oas-DoN76W2_.js} +2 -2
  3. package/dist/{Oas-CuqAnIw-.js.map → Oas-DoN76W2_.js.map} +1 -1
  4. package/dist/{OperationGenerator-B3oFps4I.d.ts → OperationGenerator-D9MJSd3H.d.ts} +78 -104
  5. package/dist/{OperationGenerator-aKcfGbOt.d.cts → OperationGenerator-DiPab7wp.d.cts} +78 -104
  6. package/dist/{Schema-DxWT5L8_.d.ts → Schema-DzjTOgNU.d.ts} +7 -8
  7. package/dist/{Schema-CEmdFRTN.d.cts → Schema-lFrS1u1u.d.cts} +7 -8
  8. package/dist/{SchemaGenerator-BQG5bN6q.cjs → SchemaGenerator-BQUPa5AD.cjs} +4 -4
  9. package/dist/SchemaGenerator-BQUPa5AD.cjs.map +1 -0
  10. package/dist/{SchemaGenerator-B0NuJl4f.js → SchemaGenerator-DYOXlswO.js} +7 -7
  11. package/dist/SchemaGenerator-DYOXlswO.js.map +1 -0
  12. package/dist/{SchemaMapper-BiagBQN4.d.cts → SchemaMapper-BWDIvdP9.d.ts} +2 -2
  13. package/dist/{SchemaMapper-C2J2d3o4.d.ts → SchemaMapper-BvE5JflR.d.cts} +2 -2
  14. package/dist/{SchemaMapper-BaZQKrQB.js → SchemaMapper-CqOUibvI.js} +2 -2
  15. package/dist/{SchemaMapper-BaZQKrQB.js.map → SchemaMapper-CqOUibvI.js.map} +1 -1
  16. package/dist/components.d.cts +7 -19
  17. package/dist/components.d.ts +7 -19
  18. package/dist/components.js +1 -1
  19. package/dist/{generators-CW7v1RgJ.js → generators-CC4tK-sV.js} +79 -64
  20. package/dist/generators-CC4tK-sV.js.map +1 -0
  21. package/dist/{generators-L3av7_7B.cjs → generators-DeiYqSf3.cjs} +75 -60
  22. package/dist/generators-DeiYqSf3.cjs.map +1 -0
  23. package/dist/generators.cjs +1 -1
  24. package/dist/generators.d.cts +2 -2
  25. package/dist/generators.d.ts +2 -2
  26. package/dist/generators.js +3 -3
  27. package/dist/{getFooter-DM8B8cnC.js → getFooter-DrSj240h.js} +2 -2
  28. package/dist/{getFooter-DM8B8cnC.js.map → getFooter-DrSj240h.js.map} +1 -1
  29. package/dist/{getSchemas-WoSBIxG8.js → getSchemas-CvUX0jWa.js} +2 -2
  30. package/dist/{getSchemas-WoSBIxG8.js.map → getSchemas-CvUX0jWa.js.map} +1 -1
  31. package/dist/hooks.cjs +7 -3
  32. package/dist/hooks.cjs.map +1 -1
  33. package/dist/hooks.d.cts +3 -3
  34. package/dist/hooks.d.ts +3 -3
  35. package/dist/hooks.js +10 -7
  36. package/dist/hooks.js.map +1 -1
  37. package/dist/index.cjs +2 -2
  38. package/dist/index.d.cts +2 -2
  39. package/dist/index.d.ts +2 -2
  40. package/dist/index.js +7 -7
  41. package/dist/mocks.d.cts +1 -1
  42. package/dist/mocks.d.ts +1 -1
  43. package/dist/mocks.js +1 -1
  44. package/dist/{parseFromConfig-DoynWlIk.js → parseFromConfig-DSI6Meg0.js} +2 -2
  45. package/dist/{parseFromConfig-DoynWlIk.js.map → parseFromConfig-DSI6Meg0.js.map} +1 -1
  46. package/dist/utils.d.cts +3 -3
  47. package/dist/utils.d.ts +3 -3
  48. package/dist/utils.js +3 -3
  49. package/package.json +6 -8
  50. package/src/generator.tsx +50 -43
  51. package/src/hooks/useOperationManager.ts +5 -6
  52. package/src/hooks/useSchemaManager.ts +3 -3
  53. package/dist/SchemaGenerator-B0NuJl4f.js.map +0 -1
  54. package/dist/SchemaGenerator-BQG5bN6q.cjs.map +0 -1
  55. package/dist/generators-CW7v1RgJ.js.map +0 -1
  56. package/dist/generators-L3av7_7B.cjs.map +0 -1
package/dist/hooks.js CHANGED
@@ -1,8 +1,9 @@
1
- import { SchemaGenerator } from "./SchemaGenerator-B0NuJl4f.js";
2
- import { Oas, Operation, Schema } from "./Oas-CuqAnIw-.js";
3
- import { schemaKeywords } from "./SchemaMapper-BaZQKrQB.js";
4
- import "./getSchemas-WoSBIxG8.js";
5
- import { useApp, useContext } from "@kubb/react";
1
+ import { t as SchemaGenerator } from "./SchemaGenerator-DYOXlswO.js";
2
+ import { n as Schema, r as Operation, t as Oas } from "./Oas-DoN76W2_.js";
3
+ import { n as schemaKeywords } from "./SchemaMapper-CqOUibvI.js";
4
+ import "./getSchemas-CvUX0jWa.js";
5
+ import { useContext } from "@kubb/react";
6
+ import { usePlugin, usePluginManager } from "@kubb/core/hooks";
6
7
 
7
8
  //#region src/hooks/useOas.ts
8
9
  function useOas() {
@@ -28,7 +29,8 @@ function useOperation() {
28
29
  * `useOperationManager` will return some helper functions that can be used to get the operation file, get the operation name.
29
30
  */
30
31
  function useOperationManager() {
31
- const { plugin, pluginManager } = useApp();
32
+ const plugin = usePlugin();
33
+ const pluginManager = usePluginManager();
32
34
  const { generator } = useContext(Oas.Context);
33
35
  const getName = (operation, { prefix = "", suffix = "", pluginKey = plugin.key, type }) => {
34
36
  return pluginManager.resolveName({
@@ -173,7 +175,8 @@ function useSchema() {
173
175
  * `useSchemaManager` will return some helper functions that can be used to get the schema file, get the schema name.
174
176
  */
175
177
  function useSchemaManager() {
176
- const { plugin, pluginManager } = useApp();
178
+ const plugin = usePlugin();
179
+ const pluginManager = usePluginManager();
177
180
  const getName = (name, { pluginKey = plugin.key, type }) => {
178
181
  return pluginManager.resolveName({
179
182
  name,
package/dist/hooks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","names":["getName: UseOperationManagerResult['getName']","getGroup: UseOperationManagerResult['getGroup']","getSchemas: UseOperationManagerResult['getSchemas']","getFile: UseOperationManagerResult['getFile']","groupSchemasByName: UseOperationManagerResult['groupSchemasByName']","getName: UseSchemaManagerResult['getName']","getFile: UseSchemaManagerResult['getFile']","getImports: UseSchemaManagerResult['getImports']"],"sources":["../src/hooks/useOas.ts","../src/hooks/useOperation.ts","../src/hooks/useOperationManager.ts","../src/hooks/useOperations.ts","../src/hooks/useSchema.ts","../src/hooks/useSchemaManager.ts"],"sourcesContent":["import { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { Oas as OasType } from '@kubb/oas'\n\nexport function useOas(): OasType {\n const { oas } = useContext(Oas.Context)\n\n if (!oas) {\n throw new Error('Oas is not defined')\n }\n\n return oas\n}\n","import { useContext } from '@kubb/react'\n\nimport { Operation } from '../components/Operation.tsx'\n\nimport type { Operation as OperationType } from '@kubb/oas'\n\n/**\n * `useOperation` will return the current `Operation`\n */\nexport function useOperation(): OperationType {\n const { operation } = useContext(Operation.Context)\n\n if (!operation) {\n throw new Error('Operation is not defined')\n }\n\n return operation\n}\n","import { useApp, useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'\n\nimport type { KubbFile } from '@kubb/core/fs'\nimport type { Operation, Operation as OperationType } from '@kubb/oas'\nimport type { OperationSchemas } from '../types.ts'\n\ntype FileMeta = FileMetaBase & {\n pluginKey: Plugin['key']\n name: string\n group?: {\n tag?: string\n path?: string\n }\n}\n\nexport type SchemaNames = {\n request: string | undefined\n parameters: {\n path: string | undefined\n query: string | undefined\n header: string | undefined\n }\n responses: { default?: string } & Record<number | string, string>\n errors: Record<number | string, string>\n}\n\ntype UseOperationManagerResult = {\n getName: (\n operation: OperationType,\n params: {\n prefix?: string\n suffix?: string\n pluginKey?: Plugin['key']\n type: ResolveNameParams['type']\n },\n ) => string\n getFile: (\n operation: OperationType,\n params?: {\n prefix?: string\n suffix?: string\n pluginKey?: Plugin['key']\n extname?: KubbFile.Extname\n group?: {\n tag?: string\n path?: string\n }\n },\n ) => KubbFile.File<FileMeta>\n groupSchemasByName: (\n operation: OperationType,\n params: {\n pluginKey?: Plugin['key']\n type: ResolveNameParams['type']\n },\n ) => SchemaNames\n getSchemas: (operation: Operation, params?: { pluginKey?: Plugin['key']; type?: ResolveNameParams['type'] }) => OperationSchemas\n getGroup: (operation: Operation) => FileMeta['group'] | undefined\n}\n\n/**\n * `useOperationManager` will return some helper functions that can be used to get the operation file, get the operation name.\n */\nexport function useOperationManager(): UseOperationManagerResult {\n const { plugin, pluginManager } = useApp()\n const { generator } = useContext(Oas.Context)\n\n const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '', pluginKey = plugin.key, type }) => {\n return pluginManager.resolveName({\n name: `${prefix} ${operation.getOperationId()} ${suffix}`,\n pluginKey,\n type,\n })\n }\n\n const getGroup: UseOperationManagerResult['getGroup'] = (operation) => {\n return {\n tag: operation.getTags().at(0)?.name,\n path: operation.path,\n }\n }\n\n const getSchemas: UseOperationManagerResult['getSchemas'] = (operation, params) => {\n if (!generator) {\n throw new Error(`'generator' is not defined`)\n }\n\n return generator.getSchemas(operation, {\n resolveName: (name) =>\n pluginManager.resolveName({\n name,\n pluginKey: params?.pluginKey,\n type: params?.type,\n }),\n })\n }\n\n const getFile: UseOperationManagerResult['getFile'] = (operation, { prefix, suffix, pluginKey = plugin.key, extname = '.ts' } = {}) => {\n const name = getName(operation, { type: 'file', pluginKey, prefix, suffix })\n const group = getGroup(operation)\n\n const file = pluginManager.getFile({\n name,\n extname,\n pluginKey,\n options: { type: 'file', pluginKey, group },\n })\n\n return {\n ...file,\n meta: {\n ...file.meta,\n name,\n pluginKey,\n group,\n },\n }\n }\n\n const groupSchemasByName: UseOperationManagerResult['groupSchemasByName'] = (operation, { pluginKey = plugin.key, type }) => {\n if (!generator) {\n throw new Error(`'generator' is not defined`)\n }\n\n const schemas = generator.getSchemas(operation)\n\n const errors = (schemas.errors || []).reduce(\n (prev, acc) => {\n if (!acc.statusCode) {\n return prev\n }\n\n prev[acc.statusCode] = pluginManager.resolveName({\n name: acc.name,\n pluginKey,\n type,\n })\n\n return prev\n },\n {} as Record<number, string>,\n )\n\n const responses = (schemas.responses || []).reduce(\n (prev, acc) => {\n if (!acc.statusCode) {\n return prev\n }\n\n prev[acc.statusCode] = pluginManager.resolveName({\n name: acc.name,\n pluginKey,\n type,\n })\n\n return prev\n },\n {} as Record<number, string>,\n )\n\n return {\n request: schemas.request?.name\n ? pluginManager.resolveName({\n name: schemas.request.name,\n pluginKey,\n type,\n })\n : undefined,\n parameters: {\n path: schemas.pathParams?.name\n ? pluginManager.resolveName({\n name: schemas.pathParams.name,\n pluginKey,\n type,\n })\n : undefined,\n query: schemas.queryParams?.name\n ? pluginManager.resolveName({\n name: schemas.queryParams.name,\n pluginKey,\n type,\n })\n : undefined,\n header: schemas.headerParams?.name\n ? pluginManager.resolveName({\n name: schemas.headerParams.name,\n pluginKey,\n type,\n })\n : undefined,\n },\n responses: {\n ...responses,\n ['default']: pluginManager.resolveName({\n name: schemas.response.name,\n pluginKey,\n type,\n }),\n ...errors,\n },\n errors,\n }\n }\n\n return {\n getName,\n getFile,\n getSchemas,\n groupSchemasByName,\n getGroup,\n }\n}\n","import { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { HttpMethod, Operation } from '@kubb/oas'\n\ntype UseOperationsProps = {\n /**\n * Filter based on path\n * Weight: 2\n */\n path?: string\n /**\n * Filter based on method\n * Weight: 1\n */\n method?: HttpMethod\n}\n\n/**\n * `useOperations` will return all the Operations\n */\nexport function useOperations({ method, path }: UseOperationsProps = {}): Operation[] {\n const { operations } = useContext(Oas.Context)\n\n if (!operations) {\n throw new Error('Operations is not defined')\n }\n let items = operations\n\n if (path) {\n items = items.filter((item) => item.path === path)\n }\n\n if (method) {\n items = items.filter((item) => item.method === method)\n }\n\n return items\n}\n","import { useContext } from '@kubb/react'\n\nimport { Schema } from '../components/Schema.tsx'\n\nimport type { SchemaContextProps } from '../components/Schema.tsx'\n\ntype UseSchemaResult = SchemaContextProps\n\n/**\n * `useSchema` will return the current `schema properties`\n */\nexport function useSchema(): UseSchemaResult {\n const props = useContext(Schema.Context)\n\n return props as UseSchemaResult\n}\n","import { useApp } from '@kubb/react'\n\nimport type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport { SchemaGenerator } from '../SchemaGenerator.ts'\nimport { type Schema, schemaKeywords } from '../SchemaMapper'\n\ntype FileMeta = FileMetaBase & {\n pluginKey: Plugin['key']\n name: string\n group?: {\n tag?: string\n path?: string\n }\n}\n\ntype UseSchemaManagerResult = {\n getName: (name: string, params: { pluginKey?: Plugin['key']; type: ResolveNameParams['type'] }) => string\n getFile: (\n name: string,\n params?: {\n pluginKey?: Plugin['key']\n mode?: KubbFile.Mode\n extname?: KubbFile.Extname\n group?: {\n tag?: string\n path?: string\n }\n },\n ) => KubbFile.File<FileMeta>\n getImports: (tree: Array<Schema>) => Array<KubbFile.Import>\n}\n\n/**\n * `useSchemaManager` will return some helper functions that can be used to get the schema file, get the schema name.\n */\nexport function useSchemaManager(): UseSchemaManagerResult {\n const { plugin, pluginManager } = useApp()\n\n const getName: UseSchemaManagerResult['getName'] = (name, { pluginKey = plugin.key, type }) => {\n return pluginManager.resolveName({\n name,\n pluginKey,\n type,\n })\n }\n\n const getFile: UseSchemaManagerResult['getFile'] = (name, { mode = 'split', pluginKey = plugin.key, extname = '.ts', group } = {}) => {\n const resolvedName = mode === 'single' ? '' : getName(name, { type: 'file', pluginKey })\n\n const file = pluginManager.getFile({\n name: resolvedName,\n extname,\n pluginKey,\n options: { type: 'file', pluginKey, group },\n })\n\n return {\n ...file,\n meta: {\n ...file.meta,\n name: resolvedName,\n pluginKey,\n },\n }\n }\n\n const getImports: UseSchemaManagerResult['getImports'] = (tree) => {\n const refs = SchemaGenerator.deepSearch(tree, schemaKeywords.ref)\n\n return refs\n ?.map((item) => {\n if (!item.args.path || !item.args.isImportable) {\n return undefined\n }\n\n return {\n name: [item.args.name],\n path: item.args.path,\n }\n })\n .filter(Boolean)\n }\n\n return {\n getName,\n getFile,\n getImports,\n }\n}\n"],"mappings":";;;;;;;AAMA,SAAgB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AW,IAAI,QAAQ;AAE9C,KAAI,CAAC,WACH,OAAM,IAAI,MAAM,4BAA4B;CAE9C,IAAI,QAAQ;AAEZ,KAAI,KACF,SAAQ,MAAM,QAAQ,SAAS,KAAK,SAAS,KAAK;AAGpD,KAAI,OACF,SAAQ,MAAM,QAAQ,SAAS,KAAK,WAAW,OAAO;AAGxD,QAAO;;;;;;;;AC3BT,SAAgB,YAA6B;AAG3C,QAFc,WAAW,OAAO,QAAQ;;;;;;;;ACwB1C,SAAgB,mBAA2C;CACzD,MAAM,EAAE,QAAQ,kBAAkB,QAAQ;CAE1C,MAAMC,WAA8C,MAAM,EAAE,YAAY,OAAO,KAAK,WAAW;AAC7F,SAAO,cAAc,YAAY;GAC/B;GACA;GACA;GACD,CAAC;;CAGJ,MAAMC,WAA8C,MAAM,EAAE,OAAO,SAAS,YAAY,OAAO,KAAK,UAAU,OAAO,UAAU,EAAE,KAAK;EACpI,MAAM,eAAe,SAAS,WAAW,KAAK,QAAQ,MAAM;GAAE,MAAM;GAAQ;GAAW,CAAC;EAExF,MAAM,OAAO,cAAc,QAAQ;GACjC,MAAM;GACN;GACA;GACA,SAAS;IAAE,MAAM;IAAQ;IAAW;IAAO;GAC5C,CAAC;AAEF,SAAO;GACL,GAAG;GACH,MAAM;IACJ,GAAG,KAAK;IACR,MAAM;IACN;IACD;GACF;;CAGH,MAAMC,cAAoD,SAAS;AAGjE,SAFa,gBAAgB,WAAW,MAAM,eAAe,IAAI,EAG7D,KAAK,SAAS;AACd,OAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,KAAK,aAChC;AAGF,UAAO;IACL,MAAM,CAAC,KAAK,KAAK,KAAK;IACtB,MAAM,KAAK,KAAK;IACjB;IACD,CACD,OAAO,QAAQ;;AAGpB,QAAO;EACL;EACA;EACA;EACD"}
1
+ {"version":3,"file":"hooks.js","names":["getName: UseOperationManagerResult['getName']","getGroup: UseOperationManagerResult['getGroup']","getSchemas: UseOperationManagerResult['getSchemas']","getFile: UseOperationManagerResult['getFile']","groupSchemasByName: UseOperationManagerResult['groupSchemasByName']","getName: UseSchemaManagerResult['getName']","getFile: UseSchemaManagerResult['getFile']","getImports: UseSchemaManagerResult['getImports']"],"sources":["../src/hooks/useOas.ts","../src/hooks/useOperation.ts","../src/hooks/useOperationManager.ts","../src/hooks/useOperations.ts","../src/hooks/useSchema.ts","../src/hooks/useSchemaManager.ts"],"sourcesContent":["import { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { Oas as OasType } from '@kubb/oas'\n\nexport function useOas(): OasType {\n const { oas } = useContext(Oas.Context)\n\n if (!oas) {\n throw new Error('Oas is not defined')\n }\n\n return oas\n}\n","import { useContext } from '@kubb/react'\n\nimport { Operation } from '../components/Operation.tsx'\n\nimport type { Operation as OperationType } from '@kubb/oas'\n\n/**\n * `useOperation` will return the current `Operation`\n */\nexport function useOperation(): OperationType {\n const { operation } = useContext(Operation.Context)\n\n if (!operation) {\n throw new Error('Operation is not defined')\n }\n\n return operation\n}\n","import type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport { usePlugin, usePluginManager } from '@kubb/core/hooks'\nimport type { Operation, Operation as OperationType } from '@kubb/oas'\nimport { useContext } from '@kubb/react'\nimport { Oas } from '../components/Oas.tsx'\nimport type { OperationSchemas } from '../types.ts'\n\ntype FileMeta = FileMetaBase & {\n pluginKey: Plugin['key']\n name: string\n group?: {\n tag?: string\n path?: string\n }\n}\n\nexport type SchemaNames = {\n request: string | undefined\n parameters: {\n path: string | undefined\n query: string | undefined\n header: string | undefined\n }\n responses: { default?: string } & Record<number | string, string>\n errors: Record<number | string, string>\n}\n\ntype UseOperationManagerResult = {\n getName: (\n operation: OperationType,\n params: {\n prefix?: string\n suffix?: string\n pluginKey?: Plugin['key']\n type: ResolveNameParams['type']\n },\n ) => string\n getFile: (\n operation: OperationType,\n params?: {\n prefix?: string\n suffix?: string\n pluginKey?: Plugin['key']\n extname?: KubbFile.Extname\n group?: {\n tag?: string\n path?: string\n }\n },\n ) => KubbFile.File<FileMeta>\n groupSchemasByName: (\n operation: OperationType,\n params: {\n pluginKey?: Plugin['key']\n type: ResolveNameParams['type']\n },\n ) => SchemaNames\n getSchemas: (operation: Operation, params?: { pluginKey?: Plugin['key']; type?: ResolveNameParams['type'] }) => OperationSchemas\n getGroup: (operation: Operation) => FileMeta['group'] | undefined\n}\n\n/**\n * `useOperationManager` will return some helper functions that can be used to get the operation file, get the operation name.\n */\nexport function useOperationManager(): UseOperationManagerResult {\n const plugin = usePlugin()\n const pluginManager = usePluginManager()\n const { generator } = useContext(Oas.Context)\n\n const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '', pluginKey = plugin.key, type }) => {\n return pluginManager.resolveName({\n name: `${prefix} ${operation.getOperationId()} ${suffix}`,\n pluginKey,\n type,\n })\n }\n\n const getGroup: UseOperationManagerResult['getGroup'] = (operation) => {\n return {\n tag: operation.getTags().at(0)?.name,\n path: operation.path,\n }\n }\n\n const getSchemas: UseOperationManagerResult['getSchemas'] = (operation, params) => {\n if (!generator) {\n throw new Error(`'generator' is not defined`)\n }\n\n return generator.getSchemas(operation, {\n resolveName: (name) =>\n pluginManager.resolveName({\n name,\n pluginKey: params?.pluginKey,\n type: params?.type,\n }),\n })\n }\n\n const getFile: UseOperationManagerResult['getFile'] = (operation, { prefix, suffix, pluginKey = plugin.key, extname = '.ts' } = {}) => {\n const name = getName(operation, { type: 'file', pluginKey, prefix, suffix })\n const group = getGroup(operation)\n\n const file = pluginManager.getFile({\n name,\n extname,\n pluginKey,\n options: { type: 'file', pluginKey, group },\n })\n\n return {\n ...file,\n meta: {\n ...file.meta,\n name,\n pluginKey,\n group,\n },\n }\n }\n\n const groupSchemasByName: UseOperationManagerResult['groupSchemasByName'] = (operation, { pluginKey = plugin.key, type }) => {\n if (!generator) {\n throw new Error(`'generator' is not defined`)\n }\n\n const schemas = generator.getSchemas(operation)\n\n const errors = (schemas.errors || []).reduce(\n (prev, acc) => {\n if (!acc.statusCode) {\n return prev\n }\n\n prev[acc.statusCode] = pluginManager.resolveName({\n name: acc.name,\n pluginKey,\n type,\n })\n\n return prev\n },\n {} as Record<number, string>,\n )\n\n const responses = (schemas.responses || []).reduce(\n (prev, acc) => {\n if (!acc.statusCode) {\n return prev\n }\n\n prev[acc.statusCode] = pluginManager.resolveName({\n name: acc.name,\n pluginKey,\n type,\n })\n\n return prev\n },\n {} as Record<number, string>,\n )\n\n return {\n request: schemas.request?.name\n ? pluginManager.resolveName({\n name: schemas.request.name,\n pluginKey,\n type,\n })\n : undefined,\n parameters: {\n path: schemas.pathParams?.name\n ? pluginManager.resolveName({\n name: schemas.pathParams.name,\n pluginKey,\n type,\n })\n : undefined,\n query: schemas.queryParams?.name\n ? pluginManager.resolveName({\n name: schemas.queryParams.name,\n pluginKey,\n type,\n })\n : undefined,\n header: schemas.headerParams?.name\n ? pluginManager.resolveName({\n name: schemas.headerParams.name,\n pluginKey,\n type,\n })\n : undefined,\n },\n responses: {\n ...responses,\n ['default']: pluginManager.resolveName({\n name: schemas.response.name,\n pluginKey,\n type,\n }),\n ...errors,\n },\n errors,\n }\n }\n\n return {\n getName,\n getFile,\n getSchemas,\n groupSchemasByName,\n getGroup,\n }\n}\n","import { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { HttpMethod, Operation } from '@kubb/oas'\n\ntype UseOperationsProps = {\n /**\n * Filter based on path\n * Weight: 2\n */\n path?: string\n /**\n * Filter based on method\n * Weight: 1\n */\n method?: HttpMethod\n}\n\n/**\n * `useOperations` will return all the Operations\n */\nexport function useOperations({ method, path }: UseOperationsProps = {}): Operation[] {\n const { operations } = useContext(Oas.Context)\n\n if (!operations) {\n throw new Error('Operations is not defined')\n }\n let items = operations\n\n if (path) {\n items = items.filter((item) => item.path === path)\n }\n\n if (method) {\n items = items.filter((item) => item.method === method)\n }\n\n return items\n}\n","import { useContext } from '@kubb/react'\n\nimport { Schema } from '../components/Schema.tsx'\n\nimport type { SchemaContextProps } from '../components/Schema.tsx'\n\ntype UseSchemaResult = SchemaContextProps\n\n/**\n * `useSchema` will return the current `schema properties`\n */\nexport function useSchema(): UseSchemaResult {\n const props = useContext(Schema.Context)\n\n return props as UseSchemaResult\n}\n","import type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport { usePlugin, usePluginManager } from '@kubb/core/hooks'\nimport { SchemaGenerator } from '../SchemaGenerator.ts'\nimport { type Schema, schemaKeywords } from '../SchemaMapper'\n\ntype FileMeta = FileMetaBase & {\n pluginKey: Plugin['key']\n name: string\n group?: {\n tag?: string\n path?: string\n }\n}\n\ntype UseSchemaManagerResult = {\n getName: (name: string, params: { pluginKey?: Plugin['key']; type: ResolveNameParams['type'] }) => string\n getFile: (\n name: string,\n params?: {\n pluginKey?: Plugin['key']\n mode?: KubbFile.Mode\n extname?: KubbFile.Extname\n group?: {\n tag?: string\n path?: string\n }\n },\n ) => KubbFile.File<FileMeta>\n getImports: (tree: Array<Schema>) => Array<KubbFile.Import>\n}\n\n/**\n * `useSchemaManager` will return some helper functions that can be used to get the schema file, get the schema name.\n */\nexport function useSchemaManager(): UseSchemaManagerResult {\n const plugin = usePlugin()\n const pluginManager = usePluginManager()\n\n const getName: UseSchemaManagerResult['getName'] = (name, { pluginKey = plugin.key, type }) => {\n return pluginManager.resolveName({\n name,\n pluginKey,\n type,\n })\n }\n\n const getFile: UseSchemaManagerResult['getFile'] = (name, { mode = 'split', pluginKey = plugin.key, extname = '.ts', group } = {}) => {\n const resolvedName = mode === 'single' ? '' : getName(name, { type: 'file', pluginKey })\n\n const file = pluginManager.getFile({\n name: resolvedName,\n extname,\n pluginKey,\n options: { type: 'file', pluginKey, group },\n })\n\n return {\n ...file,\n meta: {\n ...file.meta,\n name: resolvedName,\n pluginKey,\n },\n }\n }\n\n const getImports: UseSchemaManagerResult['getImports'] = (tree) => {\n const refs = SchemaGenerator.deepSearch(tree, schemaKeywords.ref)\n\n return refs\n ?.map((item) => {\n if (!item.args.path || !item.args.isImportable) {\n return undefined\n }\n\n return {\n name: [item.args.name],\n path: item.args.path,\n }\n })\n .filter(Boolean)\n }\n\n return {\n getName,\n getFile,\n getImports,\n }\n}\n"],"mappings":";;;;;;;;AAMA,SAAgB,SAAkB;CAChC,MAAM,EAAE,QAAQ,WAAW,IAAI,QAAQ;AAEvC,KAAI,CAAC,IACH,OAAM,IAAI,MAAM,qBAAqB;AAGvC,QAAO;;;;;;;;ACJT,SAAgB,eAA8B;CAC5C,MAAM,EAAE,cAAc,WAAW,UAAU,QAAQ;AAEnD,KAAI,CAAC,UACH,OAAM,IAAI,MAAM,2BAA2B;AAG7C,QAAO;;;;;;;;ACiDT,SAAgB,sBAAiD;CAC/D,MAAM,SAAS,WAAW;CAC1B,MAAM,gBAAgB,kBAAkB;CACxC,MAAM,EAAE,cAAc,WAAW,IAAI,QAAQ;CAE7C,MAAMA,WAAiD,WAAW,EAAE,SAAS,IAAI,SAAS,IAAI,YAAY,OAAO,KAAK,WAAW;AAC/H,SAAO,cAAc,YAAY;GAC/B,MAAM,GAAG,OAAO,GAAG,UAAU,gBAAgB,CAAC,GAAG;GACjD;GACA;GACD,CAAC;;CAGJ,MAAMC,YAAmD,cAAc;AACrE,SAAO;GACL,KAAK,UAAU,SAAS,CAAC,GAAG,EAAE,EAAE;GAChC,MAAM,UAAU;GACjB;;CAGH,MAAMC,cAAuD,WAAW,WAAW;AACjF,MAAI,CAAC,UACH,OAAM,IAAI,MAAM,6BAA6B;AAG/C,SAAO,UAAU,WAAW,WAAW,EACrC,cAAc,SACZ,cAAc,YAAY;GACxB;GACA,WAAW,QAAQ;GACnB,MAAM,QAAQ;GACf,CAAC,EACL,CAAC;;CAGJ,MAAMC,WAAiD,WAAW,EAAE,QAAQ,QAAQ,YAAY,OAAO,KAAK,UAAU,UAAU,EAAE,KAAK;EACrI,MAAM,OAAO,QAAQ,WAAW;GA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,UAAO;IACL,MAAM,CAAC,KAAK,KAAK,KAAK;IACtB,MAAM,KAAK,KAAK;IACjB;IACD,CACD,OAAO,QAAQ;;AAGpB,QAAO;EACL;EACA;EACA;EACD"}
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_SchemaGenerator = require('./SchemaGenerator-BQG5bN6q.cjs');
2
+ const require_SchemaGenerator = require('./SchemaGenerator-BQUPa5AD.cjs');
3
3
  require('./Oas--cvTRMTA.cjs');
4
- const require_generators = require('./generators-L3av7_7B.cjs');
4
+ const require_generators = require('./generators-DeiYqSf3.cjs');
5
5
  require('./getFooter-B_nmsoeK.cjs');
6
6
  const require_SchemaMapper = require('./SchemaMapper-D8J0V9Pj.cjs');
7
7
  require('./getSchemas-08CU8KWq.cjs');
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { API, Exclude, Generator, GeneratorOptions, GetSchemaGeneratorOptions, Include, OperationGenerator, OperationMethodResult, OperationSchema, OperationSchemas, Options, Override, PluginOas, ReactGeneratorOptions, Ref, Refs, ResolvePathOptions, Resolver, SchemaGenerator, SchemaGeneratorBuildOptions, SchemaGeneratorOptions, SchemaMethodResult, UserPluginWithLifeCycle, createGenerator, createReactGenerator } from "./OperationGenerator-aKcfGbOt.cjs";
2
- import { Schema, SchemaKeyword, SchemaKeywordBase, SchemaKeywordMapper, SchemaMapper, SchemaTree, isKeyword, schemaKeywords } from "./SchemaMapper-BiagBQN4.cjs";
1
+ import { A as UserPluginWithLifeCycle, C as ResolvePathOptions, S as Refs, _ as OperationSchemas, a as ReactGeneratorOptions, b as PluginOas, c as GetSchemaGeneratorOptions, d as SchemaGeneratorOptions, f as SchemaMethodResult, g as OperationSchema, h as Include, i as GeneratorOptions, l as SchemaGenerator, m as Exclude, n as OperationMethodResult, o as createGenerator, p as API, r as Generator, s as createReactGenerator, t as OperationGenerator, u as SchemaGeneratorBuildOptions, v as Options, w as Resolver, x as Ref, y as Override } from "./OperationGenerator-DiPab7wp.cjs";
2
+ import { a as SchemaMapper, c as schemaKeywords, i as SchemaKeywordMapper, n as SchemaKeyword, o as SchemaTree, r as SchemaKeywordBase, s as isKeyword, t as Schema } from "./SchemaMapper-BvE5JflR.cjs";
3
3
 
4
4
  //#region src/plugin.d.ts
5
5
  declare const pluginOasName = "plugin-oas";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { API, Exclude, Generator, GeneratorOptions, GetSchemaGeneratorOptions, Include, OperationGenerator, OperationMethodResult, OperationSchema, OperationSchemas, Options, Override, PluginOas, ReactGeneratorOptions, Ref, Refs, ResolvePathOptions, Resolver, SchemaGenerator, SchemaGeneratorBuildOptions, SchemaGeneratorOptions, SchemaMethodResult, UserPluginWithLifeCycle, createGenerator, createReactGenerator } from "./OperationGenerator-B3oFps4I.js";
2
- import { Schema, SchemaKeyword, SchemaKeywordBase, SchemaKeywordMapper, SchemaMapper, SchemaTree, isKeyword, schemaKeywords } from "./SchemaMapper-C2J2d3o4.js";
1
+ import { A as UserPluginWithLifeCycle, C as ResolvePathOptions, S as Refs, _ as OperationSchemas, a as ReactGeneratorOptions, b as PluginOas, c as GetSchemaGeneratorOptions, d as SchemaGeneratorOptions, f as SchemaMethodResult, g as OperationSchema, h as Include, i as GeneratorOptions, l as SchemaGenerator, m as Exclude, n as OperationMethodResult, o as createGenerator, p as API, r as Generator, s as createReactGenerator, t as OperationGenerator, u as SchemaGeneratorBuildOptions, v as Options, w as Resolver, x as Ref, y as Override } from "./OperationGenerator-D9MJSd3H.js";
2
+ import { a as SchemaMapper, c as schemaKeywords, i as SchemaKeywordMapper, n as SchemaKeyword, o as SchemaTree, r as SchemaKeywordBase, s as isKeyword, t as Schema } from "./SchemaMapper-BWDIvdP9.js";
3
3
 
4
4
  //#region src/plugin.d.ts
5
5
  declare const pluginOasName = "plugin-oas";
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { SchemaGenerator, pLimit } from "./SchemaGenerator-B0NuJl4f.js";
2
- import "./Oas-CuqAnIw-.js";
3
- import { createGenerator, createReactGenerator, jsonGenerator } from "./generators-CW7v1RgJ.js";
4
- import "./getFooter-DM8B8cnC.js";
5
- import { isKeyword, schemaKeywords } from "./SchemaMapper-BaZQKrQB.js";
6
- import "./getSchemas-WoSBIxG8.js";
7
- import { parseFromConfig } from "./parseFromConfig-DoynWlIk.js";
1
+ import { n as pLimit, t as SchemaGenerator } from "./SchemaGenerator-DYOXlswO.js";
2
+ import "./Oas-DoN76W2_.js";
3
+ import { n as createGenerator, r as createReactGenerator, t as jsonGenerator } from "./generators-CC4tK-sV.js";
4
+ import "./getFooter-DrSj240h.js";
5
+ import { n as schemaKeywords, t as isKeyword } from "./SchemaMapper-CqOUibvI.js";
6
+ import "./getSchemas-CvUX0jWa.js";
7
+ import { t as parseFromConfig } from "./parseFromConfig-DSI6Meg0.js";
8
8
  import { BaseGenerator, FileManager, createPlugin } from "@kubb/core";
9
9
  import transformers, { camelCase } from "@kubb/core/transformers";
10
10
  import path from "node:path";
package/dist/mocks.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Schema } from "./SchemaMapper-BiagBQN4.cjs";
1
+ import { t as Schema } from "./SchemaMapper-BvE5JflR.cjs";
2
2
 
3
3
  //#region src/mocks/schemas.d.ts
4
4
  declare const schemas: {
package/dist/mocks.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Schema } from "./SchemaMapper-C2J2d3o4.js";
1
+ import { t as Schema } from "./SchemaMapper-BWDIvdP9.js";
2
2
 
3
3
  //#region src/mocks/schemas.d.ts
4
4
  declare const schemas: {
package/dist/mocks.js CHANGED
@@ -1,4 +1,4 @@
1
- import { schemaKeywords } from "./SchemaMapper-BaZQKrQB.js";
1
+ import { n as schemaKeywords } from "./SchemaMapper-CqOUibvI.js";
2
2
 
3
3
  //#region src/mocks/schemas.ts
4
4
  const basic = [
@@ -18,5 +18,5 @@ function parseFromConfig(config, oasClass = Oas) {
18
18
  }
19
19
 
20
20
  //#endregion
21
- export { parseFromConfig };
22
- //# sourceMappingURL=parseFromConfig-DoynWlIk.js.map
21
+ export { parseFromConfig as t };
22
+ //# sourceMappingURL=parseFromConfig-DSI6Meg0.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parseFromConfig-DoynWlIk.js","names":[],"sources":["../src/utils/parseFromConfig.ts"],"sourcesContent":["import { resolve } from 'node:path'\n\nimport { URLPath } from '@kubb/core/utils'\n\nimport { merge, 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 (Array.isArray(config.input)) {\n return merge(\n config.input.map((input) => input.path),\n { oasClass },\n )\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"],"mappings":";;;;;;AAUA,SAAgB,gBAAgB,QAAgB,WAAuB,KAAmB;AACxF,KAAI,UAAU,OAAO,OAAO;AAC1B,MAAI,OAAO,OAAO,MAAM,SAAS,SAE/B,QAAO,MAD2B,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,KAAK,CAAC,EAC7D,EAAE,UAAU,CAAC;AAGjC,MAAI;AAGF,UAAO,MAFa,KAAK,MAAM,OAAO,MAAM,KAAe,EAEzC,EAAE,UAAU,CAAC;WACxB,IAAI;AAMb,SAAO,MAF2B,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,KAAK,CAAC,EAE7D,EAAE,UAAU,CAAC;;AAGjC,KAAI,MAAM,QAAQ,OAAO,MAAM,CAC7B,QAAO,MACL,OAAO,MAAM,KAAK,UAAU,MAAM,KAAK,EACvC,EAAE,UAAU,CACb;AAGH,KAAI,IAAI,QAAQ,OAAO,MAAM,KAAK,CAAC,MACjC,QAAO,MAAM,OAAO,MAAM,MAAM,EAAE,UAAU,CAAC;AAG/C,QAAO,MAAM,QAAQ,OAAO,MAAM,OAAO,MAAM,KAAK,EAAE,EAAE,UAAU,CAAC"}
1
+ {"version":3,"file":"parseFromConfig-DSI6Meg0.js","names":[],"sources":["../src/utils/parseFromConfig.ts"],"sourcesContent":["import { resolve } from 'node:path'\n\nimport { URLPath } from '@kubb/core/utils'\n\nimport { merge, 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 (Array.isArray(config.input)) {\n return merge(\n config.input.map((input) => input.path),\n { oasClass },\n )\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"],"mappings":";;;;;;AAUA,SAAgB,gBAAgB,QAAgB,WAAuB,KAAmB;AACxF,KAAI,UAAU,OAAO,OAAO;AAC1B,MAAI,OAAO,OAAO,MAAM,SAAS,SAE/B,QAAO,MAD2B,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,KAAK,CAAC,EAC7D,EAAE,UAAU,CAAC;AAGjC,MAAI;AAGF,UAAO,MAFa,KAAK,MAAM,OAAO,MAAM,KAAe,EAEzC,EAAE,UAAU,CAAC;WACxB,IAAI;AAMb,SAAO,MAF2B,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,KAAK,CAAC,EAE7D,EAAE,UAAU,CAAC;;AAGjC,KAAI,MAAM,QAAQ,OAAO,MAAM,CAC7B,QAAO,MACL,OAAO,MAAM,KAAK,UAAU,MAAM,KAAK,EACvC,EAAE,UAAU,CACb;AAGH,KAAI,IAAI,QAAQ,OAAO,MAAM,KAAK,CAAC,MACjC,QAAO,MAAM,OAAO,MAAM,MAAM,EAAE,UAAU,CAAC;AAG/C,QAAO,MAAM,QAAQ,OAAO,MAAM,OAAO,MAAM,KAAK,EAAE,EAAE,UAAU,CAAC"}
package/dist/utils.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { Config, Oas, OasTypes, OpenAPIV3 as OpenAPIV3$1, OpenAPIV3_1, Operation, OperationSchema, Output, Params, SchemaObject as SchemaObject$1, contentType } from "./OperationGenerator-aKcfGbOt.cjs";
2
- import "./SchemaMapper-BiagBQN4.cjs";
1
+ import { D as Output, E as Config, F as OpenAPIV3$1, I as OpenAPIV3_1, L as Operation, M as Oas, P as OasTypes, R as SchemaObject$1, g as OperationSchema, j as types_d_exports, z as contentType } from "./OperationGenerator-DiPab7wp.cjs";
2
+ import "./SchemaMapper-BvE5JflR.cjs";
3
3
  import { OASDocument, SchemaObject } from "oas/types";
4
4
  import { OpenAPIV3 } from "openapi-types";
5
5
 
@@ -47,7 +47,7 @@ declare function getPathParams(operationSchema: OperationSchema | undefined, opt
47
47
  typed?: boolean;
48
48
  casing?: 'camelcase';
49
49
  override?: (data: FunctionParamsAST) => FunctionParamsAST;
50
- }): Params;
50
+ }): types_d_exports.Params;
51
51
  //#endregion
52
52
  //#region src/utils/getSchemaFactory.d.ts
53
53
  /**
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Config, Oas, OasTypes, OpenAPIV3 as OpenAPIV3$1, OpenAPIV3_1, Operation, OperationSchema, Output, Params, SchemaObject as SchemaObject$1, contentType } from "./OperationGenerator-B3oFps4I.js";
2
- import "./SchemaMapper-C2J2d3o4.js";
1
+ import { D as Output, E as Config, F as OpenAPIV3$1, I as OpenAPIV3_1, L as Operation, M as Oas, P as OasTypes, R as SchemaObject$1, g as OperationSchema, j as types_d_exports, z as contentType } from "./OperationGenerator-D9MJSd3H.js";
2
+ import "./SchemaMapper-BWDIvdP9.js";
3
3
  import { OASDocument, SchemaObject } from "oas/types";
4
4
  import { OpenAPIV3 } from "openapi-types";
5
5
 
@@ -47,7 +47,7 @@ declare function getPathParams(operationSchema: OperationSchema | undefined, opt
47
47
  typed?: boolean;
48
48
  casing?: 'camelcase';
49
49
  override?: (data: FunctionParamsAST) => FunctionParamsAST;
50
- }): Params;
50
+ }): types_d_exports.Params;
51
51
  //#endregion
52
52
  //#region src/utils/getSchemaFactory.d.ts
53
53
  /**
package/dist/utils.js CHANGED
@@ -1,6 +1,6 @@
1
- import { getBanner, getFooter } from "./getFooter-DM8B8cnC.js";
2
- import { getSchemaFactory, getSchemas } from "./getSchemas-WoSBIxG8.js";
3
- import { parseFromConfig } from "./parseFromConfig-DoynWlIk.js";
1
+ import { n as getBanner, t as getFooter } from "./getFooter-DrSj240h.js";
2
+ import { n as getSchemaFactory, t as getSchemas } from "./getSchemas-CvUX0jWa.js";
3
+ import { t as parseFromConfig } from "./parseFromConfig-DSI6Meg0.js";
4
4
  import transformers, { camelCase, isValidVarName } from "@kubb/core/transformers";
5
5
  import { URLPath } from "@kubb/core/utils";
6
6
  import { isOptional, isParameterObject } from "@kubb/oas";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-oas",
3
- "version": "4.1.3",
3
+ "version": "4.2.0",
4
4
  "description": "OpenAPI Specification (OAS) plugin for Kubb, providing core functionality for parsing and processing OpenAPI/Swagger schemas for code generation.",
5
5
  "keywords": [
6
6
  "openapi",
@@ -80,16 +80,14 @@
80
80
  ],
81
81
  "dependencies": {
82
82
  "@stoplight/yaml": "^4.3.0",
83
- "p-limit": "^7.1.1",
83
+ "p-limit": "^7.2.0",
84
84
  "remeda": "^2.32.0",
85
- "@kubb/core": "4.1.3",
86
- "@kubb/oas": "4.1.3",
87
- "@kubb/react": "4.1.3"
85
+ "@kubb/core": "4.2.0",
86
+ "@kubb/oas": "4.2.0",
87
+ "@kubb/react": "4.2.0"
88
88
  },
89
89
  "devDependencies": {
90
- "@types/react": "^18.3.26",
91
- "react": "^18.3.1",
92
- "tsdown": "^0.15.7",
90
+ "tsdown": "^0.15.9",
93
91
  "typescript": "^5.9.3"
94
92
  },
95
93
  "peerDependencies": {
package/src/generator.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { PluginFactoryOptions } from '@kubb/core'
2
2
  import type { KubbFile } from '@kubb/core/fs'
3
3
  import type { Operation, SchemaObject } from '@kubb/oas'
4
- import { App, createRoot } from '@kubb/react'
4
+ import { App, createApp } from '@kubb/react'
5
5
  import type { KubbNode } from '@kubb/react/types'
6
6
  import { Oas } from './components/Oas.tsx'
7
7
  import type { OperationGenerator } from './OperationGenerator.ts'
@@ -66,19 +66,21 @@ export function createReactGenerator<TOptions extends PluginFactoryOptions>(pars
66
66
  }
67
67
 
68
68
  const { pluginManager, oas, plugin, mode } = instance.context
69
- const root = createRoot({
70
- logger: pluginManager.logger,
71
- })
72
- const Component = parseOptions.Operations.bind(this)
73
-
74
- root.render(
75
- <App pluginManager={pluginManager} plugin={plugin} mode={mode}>
76
- <Oas oas={oas} operations={operations} generator={instance}>
77
- <Component operations={operations} instance={instance} options={options} />
78
- </Oas>
79
- </App>,
80
- )
81
- return root.files
69
+ const Operations = parseOptions.Operations
70
+
71
+ function Component() {
72
+ return (
73
+ <App meta={{ pluginManager, plugin, mode }}>
74
+ <Oas oas={oas} operations={operations} generator={instance}>
75
+ <Operations operations={operations} instance={instance} options={options} />
76
+ </Oas>
77
+ </App>
78
+ )
79
+ }
80
+ const app = createApp(Component)
81
+
82
+ app.render()
83
+ return app.getFiles()
82
84
  },
83
85
  async operation({ instance, operation, options }) {
84
86
  if (!parseOptions.Operation) {
@@ -86,21 +88,23 @@ export function createReactGenerator<TOptions extends PluginFactoryOptions>(pars
86
88
  }
87
89
 
88
90
  const { pluginManager, oas, plugin, mode } = instance.context
89
- const root = createRoot({
90
- logger: pluginManager.logger,
91
- })
92
- const Component = parseOptions.Operation.bind(this)
93
-
94
- root.render(
95
- <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>
96
- <Oas oas={oas} operations={[operation]} generator={instance}>
97
- <Oas.Operation operation={operation}>
98
- <Component operation={operation} options={options} instance={instance} />
99
- </Oas.Operation>
100
- </Oas>
101
- </App>,
102
- )
103
- return root.files
91
+ const Operation = parseOptions.Operation
92
+
93
+ function Component() {
94
+ return (
95
+ <App meta={{ pluginManager, plugin: { ...plugin, options }, mode }}>
96
+ <Oas oas={oas} operations={[operation]} generator={instance}>
97
+ <Oas.Operation operation={operation}>
98
+ <Operation operation={operation} options={options} instance={instance} />
99
+ </Oas.Operation>
100
+ </Oas>
101
+ </App>
102
+ )
103
+ }
104
+ const app = createApp(Component)
105
+
106
+ app.render()
107
+ return app.getFiles()
104
108
  },
105
109
  async schema({ instance, schema, options }) {
106
110
  if (!parseOptions.Schema) {
@@ -109,20 +113,23 @@ export function createReactGenerator<TOptions extends PluginFactoryOptions>(pars
109
113
 
110
114
  const { pluginManager, oas, plugin, mode } = instance.context
111
115
 
112
- const Component = parseOptions.Schema.bind(this)
113
- const root = createRoot({
114
- logger: pluginManager.logger,
115
- })
116
- root.render(
117
- <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>
118
- <Oas oas={oas}>
119
- <Oas.Schema name={schema.name} schemaObject={schema.value} tree={schema.tree}>
120
- <Component schema={schema} options={options} instance={instance} />
121
- </Oas.Schema>
122
- </Oas>
123
- </App>,
124
- )
125
- return root.files
116
+ const Schema = parseOptions.Schema
117
+
118
+ function Component() {
119
+ return (
120
+ <App meta={{ pluginManager, plugin: { ...plugin, options }, mode }}>
121
+ <Oas oas={oas}>
122
+ <Oas.Schema name={schema.name} schemaObject={schema.value} tree={schema.tree}>
123
+ <Schema schema={schema} options={options} instance={instance} />
124
+ </Oas.Schema>
125
+ </Oas>
126
+ </App>
127
+ )
128
+ }
129
+ const app = createApp(Component)
130
+
131
+ app.render()
132
+ return app.getFiles()
126
133
  },
127
134
  }
128
135
  }
@@ -1,11 +1,9 @@
1
- import { useApp, useContext } from '@kubb/react'
2
-
3
- import { Oas } from '../components/Oas.tsx'
4
-
5
1
  import type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'
6
-
7
2
  import type { KubbFile } from '@kubb/core/fs'
3
+ import { usePlugin, usePluginManager } from '@kubb/core/hooks'
8
4
  import type { Operation, Operation as OperationType } from '@kubb/oas'
5
+ import { useContext } from '@kubb/react'
6
+ import { Oas } from '../components/Oas.tsx'
9
7
  import type { OperationSchemas } from '../types.ts'
10
8
 
11
9
  type FileMeta = FileMetaBase & {
@@ -66,7 +64,8 @@ type UseOperationManagerResult = {
66
64
  * `useOperationManager` will return some helper functions that can be used to get the operation file, get the operation name.
67
65
  */
68
66
  export function useOperationManager(): UseOperationManagerResult {
69
- const { plugin, pluginManager } = useApp()
67
+ const plugin = usePlugin()
68
+ const pluginManager = usePluginManager()
70
69
  const { generator } = useContext(Oas.Context)
71
70
 
72
71
  const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '', pluginKey = plugin.key, type }) => {
@@ -1,7 +1,6 @@
1
- import { useApp } from '@kubb/react'
2
-
3
1
  import type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'
4
2
  import type { KubbFile } from '@kubb/core/fs'
3
+ import { usePlugin, usePluginManager } from '@kubb/core/hooks'
5
4
  import { SchemaGenerator } from '../SchemaGenerator.ts'
6
5
  import { type Schema, schemaKeywords } from '../SchemaMapper'
7
6
 
@@ -35,7 +34,8 @@ type UseSchemaManagerResult = {
35
34
  * `useSchemaManager` will return some helper functions that can be used to get the schema file, get the schema name.
36
35
  */
37
36
  export function useSchemaManager(): UseSchemaManagerResult {
38
- const { plugin, pluginManager } = useApp()
37
+ const plugin = usePlugin()
38
+ const pluginManager = usePluginManager()
39
39
 
40
40
  const getName: UseSchemaManagerResult['getName'] = (name, { pluginKey = plugin.key, type }) => {
41
41
  return pluginManager.resolveName({
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaGenerator-B0NuJl4f.js","names":["#head","#tail","#size","#getOptions","#parseSchemaObject","foundItems: SchemaKeywordMapper[T][]","foundItem: SchemaKeywordMapper[T] | undefined","mergedProperties: Record<string, Schema[]> | null","mergedAdditionalProps: Schema[]","newArgs: Schema[]","validationFunctions: Schema[]","additionalPropertiesSchemas: Schema[]","#getUnknownType","#usedAliasNames","#getRefAlias","#getParsedSchemaObject","#getEmptyType","baseItems: Schema[]","union: SchemaKeywordMapper['union']","#addDiscriminatorToSchema","and: Schema","resolvedSchemas: SchemaObject[]","parsedItems: SchemaObject[]","name","min","max","#parseProperties"],"sources":["../../../node_modules/.pnpm/yocto-queue@1.2.1/node_modules/yocto-queue/index.js","../../../node_modules/.pnpm/p-limit@7.1.1/node_modules/p-limit/index.js","../src/SchemaGenerator.ts"],"sourcesContent":["/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tpeek() {\n\t\tif (!this.#head) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.#head.value;\n\n\t\t// TODO: Node.js 18.\n\t\t// return this.#head?.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n\n\t* drain() {\n\t\twhile (this.#head) {\n\t\t\tyield this.dequeue();\n\t\t}\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tvalidateConcurrency(concurrency);\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst resumeNext = () => {\n\t\t// Process the next queued function if we're under the concurrency limit\n\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\tactiveCount++;\n\t\t\tqueue.dequeue()();\n\t\t}\n\t};\n\n\tconst next = () => {\n\t\tactiveCount--;\n\t\tresumeNext();\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\t// Execute the function and capture the result promise\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\t// Resolve immediately with the promise (don't wait for completion)\n\t\tresolve(result);\n\n\t\t// Wait for the function to complete (success or failure)\n\t\t// We catch errors here to prevent unhandled rejections,\n\t\t// but the original promise rejection is preserved for the caller\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\t// Decrement active count and process next queued function\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, arguments_) => {\n\t\t// Queue the internal resolve function instead of the run function\n\t\t// to preserve the asynchronous execution context.\n\t\tnew Promise(internalResolve => { // eslint-disable-line promise/param-names\n\t\t\tqueue.enqueue(internalResolve);\n\t\t}).then(run.bind(undefined, function_, resolve, arguments_)); // eslint-disable-line promise/prefer-await-to-then\n\n\t\t// Start processing immediately if we haven't reached the concurrency limit\n\t\tif (activeCount < concurrency) {\n\t\t\tresumeNext();\n\t\t}\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise(resolve => {\n\t\tenqueue(function_, resolve, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t\tconcurrency: {\n\t\t\tget: () => concurrency,\n\n\t\t\tset(newConcurrency) {\n\t\t\t\tvalidateConcurrency(newConcurrency);\n\t\t\t\tconcurrency = newConcurrency;\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t// eslint-disable-next-line no-unmodified-loop-condition\n\t\t\t\t\twhile (activeCount < concurrency && queue.size > 0) {\n\t\t\t\t\t\tresumeNext();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t\tmap: {\n\t\t\tasync value(array, function_) {\n\t\t\t\tconst promises = array.map((value, index) => this(function_, value, index));\n\t\t\t\treturn Promise.all(promises);\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nexport function limitFunction(function_, options) {\n\tconst {concurrency} = options;\n\tconst limit = pLimit(concurrency);\n\n\treturn (...arguments_) => limit(() => function_(...arguments_));\n}\n\nfunction validateConcurrency(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n}\n","import type { Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core'\nimport { BaseGenerator, type FileMetaBase } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport transformers, { pascalCase } from '@kubb/core/transformers'\nimport { getUniqueName } from '@kubb/core/utils'\nimport type { contentType, Oas, OpenAPIV3, SchemaObject } from '@kubb/oas'\nimport { isDiscriminator, isNullable, isReference } from '@kubb/oas'\nimport pLimit from 'p-limit'\nimport { isDeepEqual, isNumber, uniqueWith } from 'remeda'\nimport type { Generator } from './generator.tsx'\nimport type { Schema, SchemaKeywordMapper } from './SchemaMapper.ts'\nimport { isKeyword, schemaKeywords } from './SchemaMapper.ts'\nimport type { OperationSchema, Override, Refs } from './types.ts'\nimport { getSchemaFactory } from './utils/getSchemaFactory.ts'\nimport { getSchemas } from './utils/getSchemas.ts'\n\nexport type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never\n\nexport type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>\n\ntype Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {\n oas: Oas\n pluginManager: PluginManager\n /**\n * Current plugin\n */\n plugin: Plugin<TPluginOptions>\n mode: KubbFile.Mode\n include?: Array<'schemas' | 'responses' | 'requestBodies'>\n override: Array<Override<TOptions>> | undefined\n contentType?: contentType\n output?: string\n}\n\nexport type SchemaGeneratorOptions = {\n dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date'\n unknownType: 'any' | 'unknown' | 'void'\n emptySchemaType: 'any' | 'unknown' | 'void'\n enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n enumSuffix?: string\n usedEnumNames?: Record<string, number>\n mapper?: Record<string, string>\n typed?: boolean\n transformers: {\n /**\n * Customize the names based on the type that is provided by the plugin.\n */\n name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string\n /**\n * Receive schema and name(propertName) and return FakerMeta array\n * TODO TODO add docs\n * @beta\n */\n schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined\n }\n}\n\nexport type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>\n\ntype SchemaProps = {\n schemaObject?: SchemaObject\n name?: string\n parentName?: string\n}\n\nexport class SchemaGenerator<\n TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions,\n TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n TFileMeta extends FileMetaBase = FileMetaBase,\n> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {\n // Collect the types of all referenced schemas, so we can export them later\n refs: Refs = {}\n\n // Keep track of already used type aliases\n #usedAliasNames: Record<string, number> = {}\n\n /**\n * Creates a type node from a given schema.\n * Delegates to getBaseTypeFromSchema internally and\n * optionally adds a union with null.\n */\n parse(props: SchemaProps): Schema[] {\n const options = this.#getOptions(props)\n\n const defaultSchemas = this.#parseSchemaObject(props)\n const schemas = options.transformers?.schema?.(props, defaultSchemas) || defaultSchemas || []\n\n return uniqueWith(schemas, isDeepEqual)\n }\n\n deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]> {\n return SchemaGenerator.deepSearch<T>(tree, keyword)\n }\n\n find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n return SchemaGenerator.find<T>(tree, keyword)\n }\n\n static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]> {\n const foundItems: SchemaKeywordMapper[T][] = []\n\n tree?.forEach((schema) => {\n if (schema.keyword === keyword) {\n foundItems.push(schema as SchemaKeywordMapper[T])\n }\n\n if (isKeyword(schema, schemaKeywords.object)) {\n Object.values(schema.args?.properties || {}).forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>(entrySchema, keyword))\n })\n\n Object.values(schema.args?.additionalProperties || {}).forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (isKeyword(schema, schemaKeywords.array)) {\n schema.args.items.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (isKeyword(schema, schemaKeywords.and)) {\n schema.args.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (isKeyword(schema, schemaKeywords.tuple)) {\n schema.args.items.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (isKeyword(schema, schemaKeywords.union)) {\n schema.args.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n })\n\n return foundItems\n }\n\n static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n let foundItem: SchemaKeywordMapper[T] | undefined\n\n tree?.forEach((schema) => {\n if (!foundItem && schema.keyword === keyword) {\n foundItem = schema as SchemaKeywordMapper[T]\n }\n\n if (isKeyword(schema, schemaKeywords.object)) {\n Object.values(schema.args?.properties || {}).forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>(entrySchema, keyword)\n }\n })\n\n Object.values(schema.args?.additionalProperties || {}).forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n })\n\n return foundItem\n }\n\n static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n let foundItem: SchemaKeywordMapper[T] | undefined\n\n tree?.forEach((schema) => {\n if (!foundItem && schema.keyword === keyword) {\n foundItem = schema as SchemaKeywordMapper[T]\n }\n\n if (isKeyword(schema, schemaKeywords.array)) {\n schema.args.items.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (isKeyword(schema, schemaKeywords.and)) {\n schema.args.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (isKeyword(schema, schemaKeywords.tuple)) {\n schema.args.items.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (isKeyword(schema, schemaKeywords.union)) {\n schema.args.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n })\n\n return foundItem\n }\n\n static combineObjects(tree: Schema[] | undefined): Schema[] {\n if (!tree) {\n return []\n }\n\n return tree.map((schema) => {\n if (!isKeyword(schema, schemaKeywords.and)) {\n return schema\n }\n\n let mergedProperties: Record<string, Schema[]> | null = null\n let mergedAdditionalProps: Schema[] = []\n\n const newArgs: Schema[] = []\n\n for (const subSchema of schema.args) {\n if (isKeyword(subSchema, schemaKeywords.object)) {\n const { properties = {}, additionalProperties = [] } = subSchema.args ?? {}\n\n if (!mergedProperties) {\n mergedProperties = {}\n }\n\n for (const [key, value] of Object.entries(properties)) {\n mergedProperties[key] = value\n }\n\n if (additionalProperties.length > 0) {\n mergedAdditionalProps = additionalProperties\n }\n } else {\n newArgs.push(subSchema)\n }\n }\n\n if (mergedProperties) {\n newArgs.push({\n keyword: schemaKeywords.object,\n args: {\n properties: mergedProperties,\n additionalProperties: mergedAdditionalProps,\n },\n })\n }\n\n return {\n keyword: schemaKeywords.and,\n args: newArgs,\n }\n })\n }\n\n #getOptions({ name }: SchemaProps): Partial<TOptions> {\n const { override = [] } = this.context\n\n return {\n ...this.options,\n ...(override.find(({ pattern, type }) => {\n if (name && type === 'schemaName') {\n return !!name.match(pattern)\n }\n\n return false\n })?.options || {}),\n }\n }\n\n #getUnknownType(props: SchemaProps) {\n const options = this.#getOptions(props)\n\n if (options.unknownType === 'any') {\n return schemaKeywords.any\n }\n if (options.unknownType === 'void') {\n return schemaKeywords.void\n }\n\n return schemaKeywords.unknown\n }\n\n #getEmptyType(props: SchemaProps) {\n const options = this.#getOptions(props)\n\n if (options.emptySchemaType === 'any') {\n return schemaKeywords.any\n }\n if (options.emptySchemaType === 'void') {\n return schemaKeywords.void\n }\n\n return schemaKeywords.unknown\n }\n\n /**\n * Recursively creates a type literal with the given props.\n */\n #parseProperties({ schemaObject, name }: SchemaProps): Schema[] {\n const properties = schemaObject?.properties || {}\n const additionalProperties = schemaObject?.additionalProperties\n const required = schemaObject?.required\n\n const propertiesSchemas = Object.keys(properties)\n .map((propertyName) => {\n const validationFunctions: Schema[] = []\n const propertySchema = properties[propertyName] as SchemaObject\n\n const isRequired = Array.isArray(required) ? required?.includes(propertyName) : !!required\n const nullable = propertySchema.nullable ?? propertySchema['x-nullable'] ?? false\n\n validationFunctions.push(...this.parse({ schemaObject: propertySchema, name: propertyName, parentName: name }))\n\n validationFunctions.push({\n keyword: schemaKeywords.name,\n args: propertyName,\n })\n\n if (!isRequired && nullable) {\n validationFunctions.push({ keyword: schemaKeywords.nullish })\n } else if (!isRequired) {\n validationFunctions.push({ keyword: schemaKeywords.optional })\n }\n\n return {\n [propertyName]: validationFunctions,\n }\n })\n .reduce((acc, curr) => ({ ...acc, ...curr }), {})\n let additionalPropertiesSchemas: Schema[] = []\n\n if (additionalProperties) {\n additionalPropertiesSchemas =\n additionalProperties === true || !Object.keys(additionalProperties).length\n ? [{ keyword: this.#getUnknownType({ schemaObject, name }) }]\n : this.parse({ schemaObject: additionalProperties as SchemaObject, parentName: name })\n }\n\n return [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: propertiesSchemas,\n additionalProperties: additionalPropertiesSchemas,\n },\n },\n ]\n }\n\n /**\n * Create a type alias for the schema referenced by the given ReferenceObject\n */\n #getRefAlias(schemaObject: OpenAPIV3.ReferenceObject, name: string | undefined): Schema[] {\n const { $ref } = schemaObject\n const ref = this.refs[$ref]\n\n if (ref) {\n const dereferencedSchema = this.context.oas.dereferenceWithRef(schemaObject)\n // pass name to getRefAlias and use that to find in discriminator.mapping value\n\n if (dereferencedSchema && isDiscriminator(dereferencedSchema)) {\n const [key] = Object.entries(dereferencedSchema.discriminator.mapping || {}).find(([_key, value]) => value.replace(/.+\\//, '') === name) || []\n\n if (key) {\n return [\n {\n keyword: schemaKeywords.and,\n args: [\n {\n keyword: schemaKeywords.ref,\n args: { name: ref.propertyName, $ref, path: ref.path, isImportable: !!this.context.oas.get($ref) },\n },\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n [dereferencedSchema.discriminator.propertyName]: [\n {\n keyword: schemaKeywords.const,\n args: {\n name: key,\n format: 'string',\n value: key,\n },\n },\n ],\n },\n },\n },\n ],\n },\n ] as Schema[]\n }\n }\n\n return [\n {\n keyword: schemaKeywords.ref,\n args: { name: ref.propertyName, $ref, path: ref.path, isImportable: !!this.context.oas.get($ref) },\n },\n ]\n }\n\n const originalName = getUniqueName($ref.replace(/.+\\//, ''), this.#usedAliasNames)\n const propertyName = this.context.pluginManager.resolveName({\n name: originalName,\n pluginKey: this.context.plugin.key,\n type: 'function',\n })\n\n const fileName = this.context.pluginManager.resolveName({\n name: originalName,\n pluginKey: this.context.plugin.key,\n type: 'file',\n })\n const file = this.context.pluginManager.getFile({\n name: fileName,\n pluginKey: this.context.plugin.key,\n extname: '.ts',\n })\n\n this.refs[$ref] = {\n propertyName,\n originalName,\n path: file.path,\n }\n\n return this.#getRefAlias(schemaObject, name)\n }\n\n #getParsedSchemaObject(schema?: SchemaObject) {\n return getSchemaFactory(this.context.oas)(schema)\n }\n\n #addDiscriminatorToSchema<TSchema extends Schema>({\n schema,\n schemaObject,\n discriminator,\n }: {\n schemaObject: SchemaObject\n schema: TSchema\n discriminator: OpenAPIV3.DiscriminatorObject\n }): TSchema {\n if (!isKeyword(schema, schemaKeywords.union)) {\n return schema\n }\n\n const objectPropertySchema = SchemaGenerator.find(this.parse({ schemaObject: schemaObject }), schemaKeywords.object)\n\n return {\n ...schema,\n args: Object.entries(discriminator.mapping || {}).map(([key, value]) => {\n const arg = schema.args.find((item) => isKeyword(item, schemaKeywords.ref) && item.args.$ref === value)\n return {\n keyword: schemaKeywords.and,\n args: [\n arg,\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n ...(objectPropertySchema?.args?.properties || {}),\n [discriminator.propertyName]: [\n {\n keyword: schemaKeywords.const,\n args: {\n name: key,\n format: 'string',\n value: key,\n },\n },\n //enum and literal will conflict\n ...(objectPropertySchema?.args?.properties[discriminator.propertyName] || []),\n ].filter((item) => !isKeyword(item, schemaKeywords.enum)),\n },\n },\n },\n ],\n }\n }),\n }\n }\n\n /**\n * This is the very core of the OpenAPI to TS conversion - it takes a\n * schema and returns the appropriate type.\n */\n #parseSchemaObject({ schemaObject: _schemaObject, name, parentName }: SchemaProps): Schema[] {\n const { schemaObject, version } = this.#getParsedSchemaObject(_schemaObject)\n\n const options = this.#getOptions({ schemaObject, name })\n const emptyType = this.#getEmptyType({ schemaObject, name })\n\n if (!schemaObject) {\n return [{ keyword: emptyType }]\n }\n\n const baseItems: Schema[] = [\n {\n keyword: schemaKeywords.schema,\n args: {\n type: schemaObject.type as any,\n format: schemaObject.format,\n },\n },\n ]\n const min = schemaObject.minimum ?? schemaObject.minLength ?? schemaObject.minItems ?? undefined\n const max = schemaObject.maximum ?? schemaObject.maxLength ?? schemaObject.maxItems ?? undefined\n const nullable = isNullable(schemaObject)\n const defaultNullAndNullable = schemaObject.default === null && nullable\n\n if (schemaObject.default !== undefined && !defaultNullAndNullable && !Array.isArray(schemaObject.default)) {\n if (typeof schemaObject.default === 'string') {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: transformers.stringify(schemaObject.default),\n })\n } else if (typeof schemaObject.default === 'boolean') {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: schemaObject.default ?? false,\n })\n } else {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: schemaObject.default,\n })\n }\n }\n\n if (schemaObject.deprecated) {\n baseItems.push({\n keyword: schemaKeywords.deprecated,\n })\n }\n\n if (schemaObject.description) {\n baseItems.push({\n keyword: schemaKeywords.describe,\n args: schemaObject.description,\n })\n }\n\n if (max !== undefined) {\n baseItems.unshift({ keyword: schemaKeywords.max, args: max })\n }\n\n if (min !== undefined) {\n baseItems.unshift({ keyword: schemaKeywords.min, args: min })\n }\n\n if (nullable) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n\n if (schemaObject.type && Array.isArray(schemaObject.type)) {\n // OPENAPI v3.1.0: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0\n const items = schemaObject.type.filter((value) => value !== 'null') as Array<OpenAPIV3.NonArraySchemaObjectType>\n const hasNull = (schemaObject.type as string[]).includes('null')\n\n if (hasNull && !nullable) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n\n if (items.length > 1) {\n const parsedItems = [\n {\n keyword: schemaKeywords.union,\n args: items\n .map(\n (item) =>\n this.parse({\n schemaObject: { ...schemaObject, type: item },\n name,\n parentName,\n })[0],\n )\n .filter(Boolean)\n .filter((item) => !isKeyword(item, schemaKeywords.unknown))\n .map((item) => (isKeyword(item, schemaKeywords.object) ? { ...item, args: { ...item.args, strict: true } } : item)),\n },\n ]\n\n return [...parsedItems, ...baseItems].filter(Boolean)\n }\n }\n\n if (schemaObject.readOnly) {\n baseItems.push({ keyword: schemaKeywords.readOnly })\n }\n\n if (schemaObject.writeOnly) {\n baseItems.push({ keyword: schemaKeywords.writeOnly })\n }\n\n if (isReference(schemaObject)) {\n return [\n ...this.#getRefAlias(schemaObject, name),\n schemaObject.description && {\n keyword: schemaKeywords.describe,\n args: schemaObject.description,\n },\n schemaObject.pattern &&\n schemaObject.type === 'string' && {\n keyword: schemaKeywords.matches,\n args: schemaObject.pattern,\n },\n nullable && { keyword: schemaKeywords.nullable },\n schemaObject.readOnly && { keyword: schemaKeywords.readOnly },\n schemaObject.writeOnly && { keyword: schemaKeywords.writeOnly },\n {\n keyword: schemaKeywords.schema,\n args: {\n type: schemaObject.type as any,\n format: schemaObject.format,\n },\n },\n ].filter(Boolean)\n }\n\n if (schemaObject.oneOf || schemaObject.anyOf) {\n // union\n const schemaWithoutOneOf = { ...schemaObject, oneOf: undefined, anyOf: undefined }\n const discriminator = this.context.oas.getDiscriminator(schemaObject)\n\n const union: SchemaKeywordMapper['union'] = {\n keyword: schemaKeywords.union,\n args: (schemaObject.oneOf || schemaObject.anyOf)!\n .map((item) => {\n // first item, this will be ref\n return item && this.parse({ schemaObject: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => !isKeyword(item, schemaKeywords.unknown)),\n }\n\n if (discriminator) {\n if (this.context) return [this.#addDiscriminatorToSchema({ schemaObject: schemaWithoutOneOf, schema: union, discriminator }), ...baseItems]\n }\n\n if (schemaWithoutOneOf.properties) {\n const propertySchemas = this.parse({ schemaObject: schemaWithoutOneOf, name, parentName })\n\n union.args = [\n ...union.args.map((arg) => {\n return {\n keyword: schemaKeywords.and,\n args: [arg, ...propertySchemas],\n }\n }),\n ]\n\n return [union, ...baseItems]\n }\n\n return [union, ...baseItems]\n }\n\n if (schemaObject.allOf) {\n // intersection/add\n const schemaWithoutAllOf = { ...schemaObject, allOf: undefined }\n\n const and: Schema = {\n keyword: schemaKeywords.and,\n args: schemaObject.allOf\n .map((item) => {\n return item && this.parse({ schemaObject: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => !isKeyword(item, schemaKeywords.unknown)),\n }\n\n if (schemaWithoutAllOf.required?.length) {\n const allOfItems = schemaObject.allOf\n const resolvedSchemas: SchemaObject[] = []\n\n for (const item of allOfItems) {\n const resolved = isReference(item) ? (this.context.oas.get(item.$ref) as SchemaObject) : item\n\n if (resolved) {\n resolvedSchemas.push(resolved)\n }\n }\n\n const existingKeys = schemaWithoutAllOf.properties ? new Set(Object.keys(schemaWithoutAllOf.properties)) : null\n\n const parsedItems: SchemaObject[] = []\n\n for (const key of schemaWithoutAllOf.required) {\n if (existingKeys?.has(key)) {\n continue\n }\n\n for (const schema of resolvedSchemas) {\n if (schema.properties?.[key]) {\n parsedItems.push({\n properties: {\n [key]: schema.properties[key],\n },\n required: [key],\n } as SchemaObject)\n break\n }\n }\n }\n\n for (const item of parsedItems) {\n const parsed = this.parse({ schemaObject: item, name, parentName })\n\n if (Array.isArray(parsed)) {\n and.args = and.args ? and.args.concat(parsed) : parsed\n }\n }\n }\n\n if (schemaWithoutAllOf.properties) {\n and.args = [...(and.args || []), ...this.parse({ schemaObject: schemaWithoutAllOf, name, parentName })]\n }\n\n return SchemaGenerator.combineObjects([and, ...baseItems])\n }\n\n if (schemaObject.enum) {\n if (options.enumSuffix === '') {\n this.context.pluginManager.logger.emit('info', 'EnumSuffix set to an empty string does not work')\n }\n\n const enumName = getUniqueName(pascalCase([parentName, name, options.enumSuffix].join(' ')), this.context.plugin.context?.usedEnumNames || {})\n const typeName = this.context.pluginManager.resolveName({\n name: enumName,\n pluginKey: this.context.plugin.key,\n type: 'type',\n })\n\n const nullableEnum = schemaObject.enum.includes(null)\n if (nullableEnum) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n const filteredValues = schemaObject.enum.filter((value) => value !== null)\n\n // x-enumNames has priority\n const extensionEnums = ['x-enumNames', 'x-enum-varnames']\n .filter((extensionKey) => extensionKey in schemaObject)\n .map((extensionKey) => {\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name,\n typeName,\n asConst: false,\n items: [...new Set(schemaObject[extensionKey as keyof typeof schemaObject] as string[])].map((name: string | number, index) => ({\n name: transformers.stringify(name),\n value: schemaObject.enum?.[index] as string | number,\n format: isNumber(schemaObject.enum?.[index]) ? 'number' : 'string',\n })),\n },\n },\n ...baseItems.filter(\n (item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches,\n ),\n ]\n })\n\n if (schemaObject.type === 'number' || schemaObject.type === 'integer') {\n // we cannot use z.enum when enum type is number/integer\n const enumNames = extensionEnums[0]?.find((item) => isKeyword(item, schemaKeywords.enum)) as unknown as SchemaKeywordMapper['enum']\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: enumName,\n typeName,\n asConst: true,\n items: enumNames?.args?.items\n ? [...new Set(enumNames.args.items)].map(({ name, value }) => ({\n name,\n value,\n format: 'number',\n }))\n : [...new Set(filteredValues)].map((value: string) => {\n return {\n name: value,\n value,\n format: 'number',\n }\n }),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches),\n ]\n }\n\n if (schemaObject.type === 'boolean') {\n // we cannot use z.enum when enum type is boolean\n const enumNames = extensionEnums[0]?.find((item) => isKeyword(item, schemaKeywords.enum)) as unknown as SchemaKeywordMapper['enum']\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: enumName,\n typeName,\n asConst: true,\n items: enumNames?.args?.items\n ? [...new Set(enumNames.args.items)].map(({ name, value }) => ({\n name,\n value,\n format: 'boolean',\n }))\n : [...new Set(filteredValues)].map((value: string) => {\n return {\n name: value,\n value,\n format: 'boolean',\n }\n }),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.matches),\n ]\n }\n\n if (extensionEnums.length > 0 && extensionEnums[0]) {\n return extensionEnums[0]\n }\n\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: enumName,\n typeName,\n asConst: false,\n items: [...new Set(filteredValues)].map((value: string) => ({\n name: transformers.stringify(value),\n value,\n format: isNumber(value) ? 'number' : 'string',\n })),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches),\n ]\n }\n\n if ('prefixItems' in schemaObject) {\n const prefixItems = schemaObject.prefixItems as SchemaObject[]\n const items = 'items' in schemaObject ? (schemaObject.items as SchemaObject[]) : []\n const min = schemaObject.minimum ?? schemaObject.minLength ?? schemaObject.minItems ?? undefined\n const max = schemaObject.maximum ?? schemaObject.maxLength ?? schemaObject.maxItems ?? undefined\n\n return [\n {\n keyword: schemaKeywords.tuple,\n args: {\n min,\n max,\n items: prefixItems\n .map((item) => {\n return this.parse({ schemaObject: item, name, parentName })[0]\n })\n .filter(Boolean),\n rest: this.parse({\n schemaObject: items,\n name,\n parentName,\n })[0],\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max),\n ]\n }\n\n if (version === '3.1' && 'const' in schemaObject) {\n // const keyword takes precendence over the actual type.\n\n if (schemaObject['const'] === null) {\n return [{ keyword: schemaKeywords.null }]\n }\n if (schemaObject['const'] === undefined) {\n return [{ keyword: schemaKeywords.undefined }]\n }\n\n let format = typeof schemaObject['const']\n if (format !== 'number' && format !== 'boolean') {\n format = 'string'\n }\n\n return [\n {\n keyword: schemaKeywords.const,\n args: {\n name: schemaObject['const'],\n format,\n value: schemaObject['const'],\n },\n },\n ...baseItems,\n ]\n }\n\n /**\n * > Structural validation alone may be insufficient to allow an application to correctly utilize certain values. The \"format\"\n * > annotation keyword is defined to allow schema authors to convey semantic information for a fixed subset of values which are\n * > accurately described by authoritative resources, be they RFCs or other external specifications.\n *\n * In other words: format is more specific than type alone, hence it should override the type value, if possible.\n *\n * see also https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-00#rfc.section.7\n */\n if (schemaObject.format) {\n if (schemaObject.type === 'integer' && (schemaObject.format === 'int32' || schemaObject.format === 'int64')) {\n baseItems.unshift({ keyword: schemaKeywords.integer })\n return baseItems\n }\n\n if (schemaObject.type === 'number' && (schemaObject.format === 'float' || schemaObject.format === 'double')) {\n baseItems.unshift({ keyword: schemaKeywords.number })\n return baseItems\n }\n\n switch (schemaObject.format) {\n case 'binary':\n baseItems.push({ keyword: schemaKeywords.blob })\n return baseItems\n case 'date-time':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'date' } })\n\n return baseItems\n }\n\n if (options.dateType === 'stringOffset') {\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: true } })\n return baseItems\n }\n\n if (options.dateType === 'stringLocal') {\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { local: true } })\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: false } })\n\n return baseItems\n }\n break\n case 'date':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'date' } })\n\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'string' } })\n\n return baseItems\n }\n break\n case 'time':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.time, args: { type: 'date' } })\n\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.time, args: { type: 'string' } })\n\n return baseItems\n }\n break\n case 'uuid':\n baseItems.unshift({ keyword: schemaKeywords.uuid })\n return baseItems\n case 'email':\n case 'idn-email':\n baseItems.unshift({ keyword: schemaKeywords.email })\n return baseItems\n case 'uri':\n case 'ipv4':\n case 'ipv6':\n case 'uri-reference':\n case 'hostname':\n case 'idn-hostname':\n baseItems.unshift({ keyword: schemaKeywords.url })\n return baseItems\n // case 'duration':\n // case 'json-pointer':\n // case 'relative-json-pointer':\n default:\n // formats not yet implemented: ignore.\n break\n }\n }\n\n if (schemaObject.pattern && schemaObject.type === 'string') {\n baseItems.unshift({\n keyword: schemaKeywords.matches,\n args: schemaObject.pattern,\n })\n\n return baseItems\n }\n\n // type based logic\n if ('items' in schemaObject || schemaObject.type === ('array' as 'string')) {\n const min = schemaObject.minimum ?? schemaObject.minLength ?? schemaObject.minItems ?? undefined\n const max = schemaObject.maximum ?? schemaObject.maxLength ?? schemaObject.maxItems ?? undefined\n const items = this.parse({ schemaObject: 'items' in schemaObject ? (schemaObject.items as SchemaObject) : [], name, parentName })\n const unique = !!schemaObject.uniqueItems\n\n return [\n {\n keyword: schemaKeywords.array,\n args: {\n items,\n min,\n max,\n unique,\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max),\n ]\n }\n\n if (schemaObject.properties || schemaObject.additionalProperties) {\n if (isDiscriminator(schemaObject)) {\n // override schema to set type to be based on discriminator mapping, use of enum to convert type string to type 'mapping1' | 'mapping2'\n const schemaObjectOverriden = Object.keys(schemaObject.properties || {}).reduce((acc, propertyName) => {\n if (acc.properties?.[propertyName] && propertyName === schemaObject.discriminator.propertyName) {\n return {\n ...acc,\n properties: {\n ...acc.properties,\n [propertyName]: {\n ...((acc.properties[propertyName] as any) || {}),\n enum: schemaObject.discriminator.mapping ? Object.keys(schemaObject.discriminator.mapping) : undefined,\n },\n },\n }\n }\n\n return acc\n }, schemaObject || {}) as SchemaObject\n\n return [\n ...this.#parseProperties({\n schemaObject: schemaObjectOverriden,\n name,\n }),\n ...baseItems,\n ]\n }\n\n return [...this.#parseProperties({ schemaObject, name }), ...baseItems]\n }\n\n if (schemaObject.type) {\n const type = (\n Array.isArray(schemaObject.type) ? schemaObject.type.filter((item) => item !== 'null')[0] : schemaObject.type\n ) as OpenAPIV3.NonArraySchemaObjectType\n\n if (!['boolean', 'object', 'number', 'string', 'integer', 'null'].includes(type)) {\n this.context.pluginManager.logger.emit('warning', `Schema type '${schemaObject.type}' is not valid for schema ${parentName}.${name}`)\n }\n\n // 'string' | 'number' | 'integer' | 'boolean'\n return [{ keyword: type }, ...baseItems]\n }\n\n return [{ keyword: emptyType }]\n }\n\n async build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas, contentType, include } = this.context\n const schemas = getSchemas({ oas, contentType, includes: include })\n const schemaEntries = Object.entries(schemas)\n\n const generatorLimit = pLimit(1)\n const schemaLimit = pLimit(10)\n\n const writeTasks = generators.map((generator) =>\n generatorLimit(async () => {\n const schemaTasks = schemaEntries.map(([name, schemaObject]) =>\n schemaLimit(async () => {\n const options = this.#getOptions({ name })\n const tree = this.parse({ name, schemaObject })\n\n const result = await generator.schema?.({\n instance: this,\n schema: {\n name,\n value: schemaObject,\n tree,\n },\n options: {\n ...this.options,\n ...options,\n },\n })\n\n return result ?? []\n }),\n )\n\n const schemaResults = await Promise.all(schemaTasks)\n return schemaResults.flat() as unknown as KubbFile.File<TFileMeta>\n }),\n )\n\n const nestedResults = await Promise.all(writeTasks)\n\n return nestedResults.flat()\n }\n}\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;AAKA,IAAM,OAAN,MAAW;CACV;CACA;CAEA,YAAY,OAAO;AAClB,OAAK,QAAQ;;;AAIf,IAAqB,QAArB,MAA2B;CAC1B;CACA;CACA;CAEA,cAAc;AACb,OAAK,OAAO;;CAGb,QAAQ,OAAO;EACd,MAAM,OAAO,IAAI,KAAK,MAAM;AAE5B,MAAI,MAAKA,MAAO;AACf,SAAKC,KAAM,OAAO;AAClB,SAAKA,OAAQ;SACP;AACN,SAAKD,OAAQ;AACb,SAAKC,OAAQ;;AAGd,QAAKC;;CAGN,UAAU;EACT,MAAM,UAAU,MAAKF;AACrB,MAAI,CAAC,QACJ;AAGD,QAAKA,OAAQ,MAAKA,KAAM;AACxB,QAAKE;AACL,SAAO,QAAQ;;CAGhB,OAAO;AACN,MAAI,CAAC,MAAKF,KACT;AAGD,SAAO,MAAKA,KAAM;;CAMnB,QAAQ;AACP,QAAKA,OAAQ;AACb,QAAKC,OAAQ;AACb,QAAKC,OAAQ;;CAGd,IAAI,OAAO;AACV,SAAO,MAAKA;;CAGb,EAAG,OAAO,YAAY;EACrB,IAAI,UAAU,MAAKF;AAEnB,SAAO,SAAS;AACf,S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