ts-openapi-codegen 2.0.0-beta.0 → 2.0.0-beta.10

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 (595) hide show
  1. package/README.md +175 -55
  2. package/README.rus.md +175 -54
  3. package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts +2 -1
  4. package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts.map +1 -1
  5. package/dist/cli/checkAndUpdateConfig/checkConfig.js +14 -6
  6. package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts +2 -1
  7. package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts.map +1 -1
  8. package/dist/cli/checkAndUpdateConfig/updateConfig.js +13 -5
  9. package/dist/cli/{generate/runGenerateOpenApi.d.ts → generateOpenApiClient/generateOpenApiClient.d.ts} +2 -2
  10. package/dist/cli/generateOpenApiClient/generateOpenApiClient.d.ts.map +1 -0
  11. package/dist/cli/{generate/runGenerateOpenApi.js → generateOpenApiClient/generateOpenApiClient.js} +31 -11
  12. package/dist/cli/index.js +29 -8
  13. package/dist/cli/initOpenApiConfig/Types.d.ts +4 -4
  14. package/dist/cli/initOpenApiConfig/Types.d.ts.map +1 -1
  15. package/dist/cli/initOpenApiConfig/init.d.ts +6 -0
  16. package/dist/cli/initOpenApiConfig/init.d.ts.map +1 -0
  17. package/dist/cli/initOpenApiConfig/init.js +53 -0
  18. package/dist/cli/initOpenApiConfig/initConfig.d.ts +11 -0
  19. package/dist/cli/initOpenApiConfig/initConfig.d.ts.map +1 -0
  20. package/dist/cli/initOpenApiConfig/initConfig.js +102 -0
  21. package/dist/cli/initOpenApiConfig/initCustomRequest.d.ts +3 -0
  22. package/dist/cli/initOpenApiConfig/initCustomRequest.d.ts.map +1 -0
  23. package/dist/cli/initOpenApiConfig/initCustomRequest.js +23 -0
  24. package/dist/cli/initOpenApiConfig/utils/buildConfig.d.ts +21 -0
  25. package/dist/cli/initOpenApiConfig/utils/buildConfig.d.ts.map +1 -0
  26. package/dist/cli/initOpenApiConfig/utils/buildConfig.js +107 -0
  27. package/dist/cli/initOpenApiConfig/utils/findSpecFiles.d.ts +8 -0
  28. package/dist/cli/initOpenApiConfig/utils/findSpecFiles.d.ts.map +1 -0
  29. package/dist/cli/initOpenApiConfig/utils/findSpecFiles.js +40 -0
  30. package/dist/cli/initOpenApiConfig/utils/registerHandlebarTemplates.d.ts +3 -0
  31. package/dist/cli/initOpenApiConfig/utils/registerHandlebarTemplates.d.ts.map +1 -0
  32. package/dist/cli/initOpenApiConfig/utils/registerHandlebarTemplates.js +53 -0
  33. package/dist/cli/initOpenApiConfig/utils/validateSpecFile.d.ts +7 -0
  34. package/dist/cli/initOpenApiConfig/utils/validateSpecFile.d.ts.map +1 -0
  35. package/dist/cli/initOpenApiConfig/utils/validateSpecFile.js +23 -0
  36. package/dist/cli/initOpenApiConfig/utils/validateSpecFiles.d.ts +11 -0
  37. package/dist/cli/initOpenApiConfig/utils/validateSpecFiles.d.ts.map +1 -0
  38. package/dist/cli/initOpenApiConfig/utils/validateSpecFiles.js +24 -0
  39. package/dist/cli/initOpenApiConfig/utils/writeConfigFile.d.ts +11 -0
  40. package/dist/cli/initOpenApiConfig/utils/writeConfigFile.d.ts.map +1 -0
  41. package/dist/cli/initOpenApiConfig/utils/writeConfigFile.js +31 -0
  42. package/dist/cli/previewChanges/previewChanges.d.ts +8 -0
  43. package/dist/cli/previewChanges/previewChanges.d.ts.map +1 -0
  44. package/dist/cli/previewChanges/previewChanges.js +189 -0
  45. package/dist/cli/previewChanges/utils/compareFiles.d.ts +6 -0
  46. package/dist/cli/previewChanges/utils/compareFiles.d.ts.map +1 -0
  47. package/dist/cli/previewChanges/utils/compareFiles.js +50 -0
  48. package/dist/cli/previewChanges/utils/formatDiff.d.ts +6 -0
  49. package/dist/cli/previewChanges/utils/formatDiff.d.ts.map +1 -0
  50. package/dist/cli/previewChanges/utils/formatDiff.js +30 -0
  51. package/dist/cli/previewChanges/utils/isDirectoryEmpty.d.ts +5 -0
  52. package/dist/cli/previewChanges/utils/isDirectoryEmpty.d.ts.map +1 -0
  53. package/dist/cli/previewChanges/utils/isDirectoryEmpty.js +17 -0
  54. package/dist/cli/previewChanges/utils/readDirectoryRecursive.d.ts +5 -0
  55. package/dist/cli/previewChanges/utils/readDirectoryRecursive.d.ts.map +1 -0
  56. package/dist/cli/previewChanges/utils/readDirectoryRecursive.js +28 -0
  57. package/dist/cli/previewChanges/utils/updateOutputPaths.d.ts +10 -0
  58. package/dist/cli/previewChanges/utils/updateOutputPaths.d.ts.map +1 -0
  59. package/dist/cli/previewChanges/utils/updateOutputPaths.js +106 -0
  60. package/dist/cli/schemas/base.d.ts +22 -0
  61. package/dist/cli/schemas/base.d.ts.map +1 -0
  62. package/dist/cli/schemas/base.js +23 -0
  63. package/dist/cli/schemas/checkConfig.d.ts +6 -0
  64. package/dist/cli/schemas/checkConfig.d.ts.map +1 -0
  65. package/dist/cli/schemas/checkConfig.js +5 -0
  66. package/dist/cli/schemas/generate.d.ts +8 -0
  67. package/dist/cli/schemas/generate.d.ts.map +1 -0
  68. package/dist/cli/schemas/generate.js +45 -0
  69. package/dist/cli/schemas/index.d.ts +8 -0
  70. package/dist/cli/schemas/index.d.ts.map +1 -0
  71. package/dist/cli/schemas/index.js +22 -0
  72. package/dist/cli/schemas/init.d.ts +10 -0
  73. package/dist/cli/schemas/init.d.ts.map +1 -0
  74. package/dist/cli/schemas/init.js +11 -0
  75. package/dist/cli/schemas/previewChanges.d.ts +9 -0
  76. package/dist/cli/schemas/previewChanges.d.ts.map +1 -0
  77. package/dist/cli/schemas/previewChanges.js +11 -0
  78. package/dist/cli/schemas/updateConfig.d.ts +6 -0
  79. package/dist/cli/schemas/updateConfig.d.ts.map +1 -0
  80. package/dist/cli/schemas/updateConfig.js +5 -0
  81. package/dist/common/Consts.d.ts +5 -0
  82. package/dist/common/Consts.d.ts.map +1 -1
  83. package/dist/common/Consts.js +9 -2
  84. package/dist/common/LoggerMessages.js +1 -1
  85. package/dist/common/TRawOptions.d.ts +4 -36
  86. package/dist/common/TRawOptions.d.ts.map +1 -1
  87. package/dist/common/Validation/formatZodError.d.ts +10 -0
  88. package/dist/common/Validation/formatZodError.d.ts.map +1 -0
  89. package/dist/common/Validation/formatZodError.js +114 -0
  90. package/dist/common/Validation/index.d.ts +3 -0
  91. package/dist/common/Validation/index.d.ts.map +1 -0
  92. package/dist/common/Validation/index.js +18 -0
  93. package/dist/common/Validation/validateZodOptions.d.ts +27 -0
  94. package/dist/common/Validation/validateZodOptions.d.ts.map +1 -0
  95. package/dist/common/Validation/validateZodOptions.js +35 -0
  96. package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts.map +1 -1
  97. package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.js +10 -4
  98. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts +6 -1
  99. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts.map +1 -1
  100. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.js +8 -8
  101. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts +28 -0
  102. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts.map +1 -0
  103. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.js +25 -0
  104. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts +37 -0
  105. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts.map +1 -0
  106. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.js +37 -0
  107. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts +38 -0
  108. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts.map +1 -0
  109. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.js +34 -0
  110. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts +40 -0
  111. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts.map +1 -0
  112. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.js +36 -0
  113. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts +65 -0
  114. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts.map +1 -0
  115. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.js +31 -0
  116. package/dist/common/VersionedSchema/CommonSchemas.d.ts +53 -29
  117. package/dist/common/VersionedSchema/CommonSchemas.d.ts.map +1 -1
  118. package/dist/common/VersionedSchema/CommonSchemas.js +44 -62
  119. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.d.ts.map +1 -1
  120. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.js +9 -16
  121. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts +25 -5
  122. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts.map +1 -1
  123. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.js +34 -17
  124. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts +25 -5
  125. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts.map +1 -1
  126. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.js +28 -19
  127. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts +25 -1
  128. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts.map +1 -1
  129. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.js +29 -2
  130. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts +25 -5
  131. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts.map +1 -1
  132. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.js +30 -14
  133. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts +23 -5
  134. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts.map +1 -1
  135. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.js +33 -18
  136. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.d.ts +3 -2
  137. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.d.ts.map +1 -1
  138. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.js +18 -11
  139. package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.d.ts.map +1 -1
  140. package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.js +2 -5
  141. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts +22 -5
  142. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts.map +1 -1
  143. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.js +30 -12
  144. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts +22 -5
  145. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts.map +1 -1
  146. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.js +27 -13
  147. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts +22 -1
  148. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts.map +1 -1
  149. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.js +28 -2
  150. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts +22 -5
  151. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts.map +1 -1
  152. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.js +31 -12
  153. package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.d.ts +3 -2
  154. package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.d.ts.map +1 -1
  155. package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.js +15 -9
  156. package/dist/common/VersionedSchema/Types.d.ts +5 -5
  157. package/dist/common/VersionedSchema/Types.d.ts.map +1 -1
  158. package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.d.ts +16 -0
  159. package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.d.ts.map +1 -0
  160. package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.js +85 -0
  161. package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.d.ts +2 -0
  162. package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.d.ts.map +1 -0
  163. package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.js +23 -0
  164. package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.d.ts +2 -0
  165. package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.d.ts.map +1 -0
  166. package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.js +75 -0
  167. package/dist/common/VersionedSchema/Utils/buildVersionedSchema.d.ts +12 -0
  168. package/dist/common/VersionedSchema/Utils/buildVersionedSchema.d.ts.map +1 -0
  169. package/dist/common/VersionedSchema/Utils/buildVersionedSchema.js +13 -0
  170. package/dist/common/VersionedSchema/Utils/compareShapes.d.ts +16 -0
  171. package/dist/common/VersionedSchema/Utils/compareShapes.d.ts.map +1 -0
  172. package/dist/common/VersionedSchema/Utils/compareShapes.js +30 -0
  173. package/dist/common/VersionedSchema/Utils/createFieldTransformationMigration.d.ts +32 -0
  174. package/dist/common/VersionedSchema/Utils/createFieldTransformationMigration.d.ts.map +1 -0
  175. package/dist/common/VersionedSchema/Utils/createFieldTransformationMigration.js +40 -0
  176. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts +2 -1
  177. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts.map +1 -1
  178. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.js +5 -5
  179. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts +2 -2
  180. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts.map +1 -1
  181. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.js +15 -7
  182. package/dist/common/VersionedSchema/Utils/getLatestVersionFromMigrationPlans.d.ts +16 -0
  183. package/dist/common/VersionedSchema/Utils/getLatestVersionFromMigrationPlans.d.ts.map +1 -0
  184. package/dist/common/VersionedSchema/Utils/getLatestVersionFromMigrationPlans.js +23 -0
  185. package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.d.ts +2 -2
  186. package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.d.ts.map +1 -1
  187. package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.js +16 -3
  188. package/dist/common/VersionedSchema/Utils/getUniqueObjectKeys.d.ts.map +1 -1
  189. package/dist/common/VersionedSchema/Utils/getUniqueObjectKeys.js +19 -2
  190. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts +2 -1
  191. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
  192. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +10 -9
  193. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts +4 -0
  194. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts.map +1 -0
  195. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.js +43 -0
  196. package/dist/common/VersionedSchema/refinements/singleOrMultiRefinement.d.ts +4 -0
  197. package/dist/common/VersionedSchema/refinements/singleOrMultiRefinement.d.ts.map +1 -0
  198. package/dist/common/VersionedSchema/refinements/singleOrMultiRefinement.js +21 -0
  199. package/dist/common/defaultOptions.d.ts.map +1 -1
  200. package/dist/common/defaultOptions.js +2 -1
  201. package/dist/common/utils/__tests__/convertArrayToObject.test.js +5 -6
  202. package/dist/common/utils/convertArrayToObject.d.ts.map +1 -1
  203. package/dist/common/utils/convertArrayToObject.js +1 -2
  204. package/dist/common/utils/fileSystemHelpers.d.ts +3 -1
  205. package/dist/common/utils/fileSystemHelpers.d.ts.map +1 -1
  206. package/dist/common/utils/fileSystemHelpers.js +3 -0
  207. package/dist/core/Context.d.ts +25 -2
  208. package/dist/core/Context.d.ts.map +1 -1
  209. package/dist/core/Context.js +144 -4
  210. package/dist/core/OpenApiClient.d.ts.map +1 -1
  211. package/dist/core/OpenApiClient.js +54 -13
  212. package/dist/core/WriteClient.d.ts +6 -13
  213. package/dist/core/WriteClient.d.ts.map +1 -1
  214. package/dist/core/WriteClient.js +32 -22
  215. package/dist/core/__tests__/WriteClient.test.js +8 -1
  216. package/dist/core/api/v2/Parser.d.ts +1 -1
  217. package/dist/core/api/v2/Parser.d.ts.map +1 -1
  218. package/dist/core/api/v2/Parser.js +2 -2
  219. package/dist/core/api/v2/parser/getModel.d.ts.map +1 -1
  220. package/dist/core/api/v2/parser/getModel.js +2 -5
  221. package/dist/core/api/v2/parser/getModelProperties.d.ts.map +1 -1
  222. package/dist/core/api/v2/parser/getModelProperties.js +1 -3
  223. package/dist/core/api/v2/parser/getModels.d.ts.map +1 -1
  224. package/dist/core/api/v2/parser/getModels.js +2 -4
  225. package/dist/core/api/v2/parser/getOperationParameter.d.ts.map +1 -1
  226. package/dist/core/api/v2/parser/getOperationParameter.js +2 -5
  227. package/dist/core/api/v2/parser/getOperationParameters.js +1 -1
  228. package/dist/core/api/v2/parser/getOperationResponse.d.ts.map +1 -1
  229. package/dist/core/api/v2/parser/getOperationResponse.js +1 -3
  230. package/dist/core/api/v2/parser/getOperationResponses.js +1 -1
  231. package/dist/core/api/v2/parser/getServices.d.ts.map +1 -1
  232. package/dist/core/api/v2/parser/getServices.js +4 -3
  233. package/dist/core/api/v2/parser/getType.d.ts.map +1 -1
  234. package/dist/core/api/v2/parser/getType.js +16 -9
  235. package/dist/core/api/v3/Parser.d.ts +1 -1
  236. package/dist/core/api/v3/Parser.d.ts.map +1 -1
  237. package/dist/core/api/v3/Parser.js +2 -2
  238. package/dist/core/api/v3/parser/getModel.d.ts.map +1 -1
  239. package/dist/core/api/v3/parser/getModel.js +2 -5
  240. package/dist/core/api/v3/parser/getModelProperties.d.ts.map +1 -1
  241. package/dist/core/api/v3/parser/getModelProperties.js +1 -3
  242. package/dist/core/api/v3/parser/getModels.d.ts.map +1 -1
  243. package/dist/core/api/v3/parser/getModels.js +2 -4
  244. package/dist/core/api/v3/parser/getOperation.js +1 -1
  245. package/dist/core/api/v3/parser/getOperationParameter.d.ts.map +1 -1
  246. package/dist/core/api/v3/parser/getOperationParameter.js +2 -5
  247. package/dist/core/api/v3/parser/getOperationParameters.js +1 -1
  248. package/dist/core/api/v3/parser/getOperationRequestBody.d.ts.map +1 -1
  249. package/dist/core/api/v3/parser/getOperationRequestBody.js +1 -3
  250. package/dist/core/api/v3/parser/getOperationResponse.d.ts.map +1 -1
  251. package/dist/core/api/v3/parser/getOperationResponse.js +1 -3
  252. package/dist/core/api/v3/parser/getOperationResponses.js +1 -1
  253. package/dist/core/api/v3/parser/getServices.d.ts.map +1 -1
  254. package/dist/core/api/v3/parser/getServices.js +4 -3
  255. package/dist/core/api/v3/parser/getType.d.ts.map +1 -1
  256. package/dist/core/api/v3/parser/getType.js +16 -9
  257. package/dist/core/index.d.ts.map +1 -1
  258. package/dist/core/index.js +2 -0
  259. package/dist/core/types/base/ClientArtifacts.model.d.ts +1 -1
  260. package/dist/core/types/base/ClientArtifacts.model.d.ts.map +1 -1
  261. package/dist/core/types/base/SimpleClientArtifacts.model.d.ts +1 -1
  262. package/dist/core/types/base/SimpleClientArtifacts.model.d.ts.map +1 -1
  263. package/dist/core/types/base/Templates.model.d.ts +32 -0
  264. package/dist/core/types/base/Templates.model.d.ts.map +1 -0
  265. package/dist/core/types/enums/ValidationLibrary.enum.d.ts +8 -0
  266. package/dist/core/types/enums/ValidationLibrary.enum.d.ts.map +1 -0
  267. package/dist/core/types/enums/ValidationLibrary.enum.js +11 -0
  268. package/dist/core/utils/__mocks__/templates.d.ts +3 -0
  269. package/dist/core/utils/__mocks__/templates.d.ts.map +1 -0
  270. package/dist/core/utils/__mocks__/templates.js +33 -0
  271. package/dist/core/utils/__tests__/getRelativeModelPath.test.js +9 -3
  272. package/dist/core/utils/__tests__/isSubdirectory.test.js +2 -2
  273. package/dist/core/utils/__tests__/modelHelpers.test.d.ts +2 -0
  274. package/dist/core/utils/__tests__/modelHelpers.test.d.ts.map +1 -0
  275. package/dist/core/utils/__tests__/modelHelpers.test.js +151 -0
  276. package/dist/core/utils/__tests__/postProcessModelImports.test.d.ts +2 -0
  277. package/dist/core/utils/__tests__/postProcessModelImports.test.d.ts.map +1 -0
  278. package/dist/core/utils/__tests__/postProcessModelImports.test.js +67 -0
  279. package/dist/core/utils/__tests__/postProcessServiceImports.test.d.ts +2 -0
  280. package/dist/core/utils/__tests__/postProcessServiceImports.test.d.ts.map +1 -0
  281. package/dist/core/utils/__tests__/postProcessServiceImports.test.js +26 -0
  282. package/dist/core/utils/__tests__/registerHandlebarTemplates.test.js +2 -0
  283. package/dist/core/utils/__tests__/resolveRefPath.test.d.ts +2 -0
  284. package/dist/core/utils/__tests__/resolveRefPath.test.d.ts.map +1 -0
  285. package/dist/core/utils/__tests__/resolveRefPath.test.js +22 -0
  286. package/dist/core/utils/__tests__/serviceHelpers.test.d.ts +2 -0
  287. package/dist/core/utils/__tests__/serviceHelpers.test.d.ts.map +1 -0
  288. package/dist/core/utils/__tests__/serviceHelpers.test.js +121 -0
  289. package/dist/core/utils/__tests__/writeClientCore.test.js +2 -25
  290. package/dist/core/utils/__tests__/writeClientExecutor.test.d.ts +2 -0
  291. package/dist/core/utils/__tests__/writeClientExecutor.test.d.ts.map +1 -0
  292. package/dist/core/utils/__tests__/writeClientExecutor.test.js +20 -0
  293. package/dist/core/utils/__tests__/writeClientFullIndex.test.js +2 -25
  294. package/dist/core/utils/__tests__/writeClientModels.test.js +2 -25
  295. package/dist/core/utils/__tests__/writeClientSchemas.test.js +4 -25
  296. package/dist/core/utils/__tests__/writeClientServices.test.js +2 -25
  297. package/dist/core/utils/getOpenApiSpec.d.ts +0 -6
  298. package/dist/core/utils/getOpenApiSpec.d.ts.map +1 -1
  299. package/dist/core/utils/getOpenApiSpec.js +26 -23
  300. package/dist/core/utils/modelHelpers.d.ts.map +1 -1
  301. package/dist/core/utils/modelHelpers.js +37 -3
  302. package/dist/core/utils/postProcessModelImports.d.ts.map +1 -1
  303. package/dist/core/utils/postProcessModelImports.js +14 -1
  304. package/dist/core/utils/postProcessServiceImports.d.ts.map +1 -1
  305. package/dist/core/utils/postProcessServiceImports.js +1 -2
  306. package/dist/core/utils/precompileTemplates.js +7 -0
  307. package/dist/core/utils/registerHandlebarHelpers.d.ts.map +1 -1
  308. package/dist/core/utils/registerHandlebarHelpers.js +85 -0
  309. package/dist/core/utils/registerHandlebarTemplates.d.ts +3 -25
  310. package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
  311. package/dist/core/utils/registerHandlebarTemplates.js +97 -2
  312. package/dist/core/utils/resolveRefPath.d.ts.map +1 -1
  313. package/dist/core/utils/resolveRefPath.js +1 -4
  314. package/dist/core/utils/serviceHelpers.d.ts.map +1 -1
  315. package/dist/core/utils/serviceHelpers.js +32 -6
  316. package/dist/core/utils/stripNamespace.js +1 -1
  317. package/dist/core/utils/validateRawOptions.d.ts +3 -0
  318. package/dist/core/utils/validateRawOptions.d.ts.map +1 -0
  319. package/dist/core/utils/validateRawOptions.js +15 -0
  320. package/dist/core/utils/writeClientCore.d.ts +1 -1
  321. package/dist/core/utils/writeClientCore.d.ts.map +1 -1
  322. package/dist/core/utils/writeClientCore.js +7 -1
  323. package/dist/core/utils/writeClientCoreIndex.d.ts +1 -1
  324. package/dist/core/utils/writeClientCoreIndex.d.ts.map +1 -1
  325. package/dist/core/utils/writeClientExecutor.d.ts +13 -0
  326. package/dist/core/utils/writeClientExecutor.d.ts.map +1 -0
  327. package/dist/core/utils/writeClientExecutor.js +30 -0
  328. package/dist/core/utils/writeClientFullIndex.d.ts.map +1 -1
  329. package/dist/core/utils/writeClientFullIndex.js +1 -1
  330. package/dist/core/utils/writeClientModels.d.ts +1 -1
  331. package/dist/core/utils/writeClientModels.d.ts.map +1 -1
  332. package/dist/core/utils/writeClientModelsIndex.d.ts +1 -1
  333. package/dist/core/utils/writeClientModelsIndex.d.ts.map +1 -1
  334. package/dist/core/utils/writeClientSchemas.d.ts +3 -1
  335. package/dist/core/utils/writeClientSchemas.d.ts.map +1 -1
  336. package/dist/core/utils/writeClientSchemas.js +23 -20
  337. package/dist/core/utils/writeClientSchemasIndex.d.ts +1 -1
  338. package/dist/core/utils/writeClientSchemasIndex.d.ts.map +1 -1
  339. package/dist/core/utils/writeClientServices.d.ts +1 -1
  340. package/dist/core/utils/writeClientServices.d.ts.map +1 -1
  341. package/dist/core/utils/writeClientServicesIndex.d.ts +1 -1
  342. package/dist/core/utils/writeClientServicesIndex.d.ts.map +1 -1
  343. package/dist/core/utils/writeClientSimpleIndex.d.ts.map +1 -1
  344. package/dist/core/utils/writeClientSimpleIndex.js +1 -1
  345. package/dist/templatesCompiled/cli/customRequest.d.ts +11 -0
  346. package/dist/templatesCompiled/cli/customRequest.d.ts.map +1 -0
  347. package/dist/templatesCompiled/cli/customRequest.js +27 -0
  348. package/dist/templatesCompiled/cli/customRequestExecutor.d.ts +11 -0
  349. package/dist/templatesCompiled/cli/customRequestExecutor.d.ts.map +1 -0
  350. package/dist/templatesCompiled/cli/customRequestExecutor.js +27 -0
  351. package/dist/templatesCompiled/cli/openApiConfig.d.ts +2 -1
  352. package/dist/templatesCompiled/cli/openApiConfig.d.ts.map +1 -1
  353. package/dist/templatesCompiled/cli/openApiConfig.js +76 -4
  354. package/dist/templatesCompiled/client/core/ApiError.js +1 -1
  355. package/dist/templatesCompiled/client/core/CancelablePromise.d.ts +1 -0
  356. package/dist/templatesCompiled/client/core/CancelablePromise.d.ts.map +1 -1
  357. package/dist/templatesCompiled/client/core/CancelablePromise.js +9 -2
  358. package/dist/templatesCompiled/client/core/HttpStatusCode.d.ts +1 -0
  359. package/dist/templatesCompiled/client/core/HttpStatusCode.d.ts.map +1 -1
  360. package/dist/templatesCompiled/client/core/HttpStatusCode.js +9 -2
  361. package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.d.ts +12 -0
  362. package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.d.ts.map +1 -0
  363. package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.js +32 -0
  364. package/dist/templatesCompiled/client/core/executor/requestExecutor.d.ts +8 -0
  365. package/dist/templatesCompiled/client/core/executor/requestExecutor.d.ts.map +1 -0
  366. package/dist/templatesCompiled/client/core/executor/requestExecutor.js +18 -0
  367. package/dist/templatesCompiled/client/core/functions/catchErrors.js +1 -1
  368. package/dist/templatesCompiled/client/core/interceptors/apiErrorInterceptor.d.ts +8 -0
  369. package/dist/templatesCompiled/client/core/interceptors/apiErrorInterceptor.d.ts.map +1 -0
  370. package/dist/templatesCompiled/client/core/interceptors/apiErrorInterceptor.js +18 -0
  371. package/dist/templatesCompiled/client/core/interceptors/interceptors.d.ts +8 -0
  372. package/dist/templatesCompiled/client/core/interceptors/interceptors.d.ts.map +1 -0
  373. package/dist/templatesCompiled/client/core/interceptors/interceptors.js +18 -0
  374. package/dist/templatesCompiled/client/core/interceptors/withInterceptors.d.ts +8 -0
  375. package/dist/templatesCompiled/client/core/interceptors/withInterceptors.d.ts.map +1 -0
  376. package/dist/templatesCompiled/client/core/interceptors/withInterceptors.js +18 -0
  377. package/dist/templatesCompiled/client/exportClient.d.ts +10 -0
  378. package/dist/templatesCompiled/client/exportClient.d.ts.map +1 -0
  379. package/dist/templatesCompiled/client/exportClient.js +53 -0
  380. package/dist/templatesCompiled/client/exportService.d.ts.map +1 -1
  381. package/dist/templatesCompiled/client/exportService.js +46 -50
  382. package/dist/templatesCompiled/client/indexCore.js +2 -2
  383. package/dist/templatesCompiled/client/indexFull.d.ts +13 -9
  384. package/dist/templatesCompiled/client/indexFull.d.ts.map +1 -1
  385. package/dist/templatesCompiled/client/indexFull.js +72 -46
  386. package/dist/templatesCompiled/client/indexSimple.d.ts +1 -0
  387. package/dist/templatesCompiled/client/indexSimple.d.ts.map +1 -1
  388. package/dist/templatesCompiled/client/indexSimple.js +5 -1
  389. package/dist/templatesCompiled/client/joi/exportSchema.d.ts +11 -0
  390. package/dist/templatesCompiled/client/joi/exportSchema.d.ts.map +1 -0
  391. package/dist/templatesCompiled/client/joi/exportSchema.js +71 -0
  392. package/dist/templatesCompiled/client/joi/partials/joiSchema.d.ts +22 -0
  393. package/dist/templatesCompiled/client/joi/partials/joiSchema.d.ts.map +1 -0
  394. package/dist/templatesCompiled/client/joi/partials/joiSchema.js +129 -0
  395. package/dist/templatesCompiled/client/joi/partials/joiSchemaArray.d.ts +16 -0
  396. package/dist/templatesCompiled/client/joi/partials/joiSchemaArray.d.ts.map +1 -0
  397. package/dist/templatesCompiled/client/joi/partials/joiSchemaArray.js +84 -0
  398. package/dist/templatesCompiled/client/joi/partials/joiSchemaComposition.d.ts +18 -0
  399. package/dist/templatesCompiled/client/joi/partials/joiSchemaComposition.d.ts.map +1 -0
  400. package/dist/templatesCompiled/client/joi/partials/joiSchemaComposition.js +96 -0
  401. package/dist/templatesCompiled/client/joi/partials/joiSchemaDictionary.d.ts +14 -0
  402. package/dist/templatesCompiled/client/joi/partials/joiSchemaDictionary.d.ts.map +1 -0
  403. package/dist/templatesCompiled/client/joi/partials/joiSchemaDictionary.js +72 -0
  404. package/dist/templatesCompiled/client/joi/partials/joiSchemaEnum.d.ts +14 -0
  405. package/dist/templatesCompiled/client/joi/partials/joiSchemaEnum.d.ts.map +1 -0
  406. package/dist/templatesCompiled/client/joi/partials/joiSchemaEnum.js +74 -0
  407. package/dist/templatesCompiled/client/joi/partials/joiSchemaGeneric.d.ts +35 -0
  408. package/dist/templatesCompiled/client/joi/partials/joiSchemaGeneric.d.ts.map +1 -0
  409. package/dist/templatesCompiled/client/joi/partials/joiSchemaGeneric.js +201 -0
  410. package/dist/templatesCompiled/client/joi/partials/joiSchemaInterface.d.ts +14 -0
  411. package/dist/templatesCompiled/client/joi/partials/joiSchemaInterface.d.ts.map +1 -0
  412. package/dist/templatesCompiled/client/joi/partials/joiSchemaInterface.js +50 -0
  413. package/dist/templatesCompiled/client/joi/partials/joiSchemaReference.d.ts +9 -0
  414. package/dist/templatesCompiled/client/joi/partials/joiSchemaReference.d.ts.map +1 -0
  415. package/dist/templatesCompiled/client/joi/partials/joiSchemaReference.js +25 -0
  416. package/dist/templatesCompiled/client/jsonschema/exportSchema.d.ts +11 -0
  417. package/dist/templatesCompiled/client/jsonschema/exportSchema.d.ts.map +1 -0
  418. package/dist/templatesCompiled/client/jsonschema/exportSchema.js +69 -0
  419. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchema.d.ts +22 -0
  420. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchema.d.ts.map +1 -0
  421. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchema.js +129 -0
  422. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaArray.d.ts +16 -0
  423. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaArray.d.ts.map +1 -0
  424. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaArray.js +74 -0
  425. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaComposition.d.ts +16 -0
  426. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaComposition.d.ts.map +1 -0
  427. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaComposition.js +84 -0
  428. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaDictionary.d.ts +13 -0
  429. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaDictionary.d.ts.map +1 -0
  430. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaDictionary.js +56 -0
  431. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaEnum.d.ts +12 -0
  432. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaEnum.d.ts.map +1 -0
  433. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaEnum.js +49 -0
  434. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaGeneric.d.ts +29 -0
  435. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaGeneric.d.ts.map +1 -0
  436. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaGeneric.js +175 -0
  437. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface.d.ts +15 -0
  438. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface.d.ts.map +1 -0
  439. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface.js +63 -0
  440. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaReference.d.ts +9 -0
  441. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaReference.d.ts.map +1 -0
  442. package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaReference.js +25 -0
  443. package/dist/templatesCompiled/client/partials/exportComposition.d.ts +2 -0
  444. package/dist/templatesCompiled/client/partials/exportComposition.d.ts.map +1 -1
  445. package/dist/templatesCompiled/client/partials/exportComposition.js +17 -9
  446. package/dist/templatesCompiled/client/partials/parameters.js +1 -1
  447. package/dist/templatesCompiled/client/partials/serviceOption.d.ts +2 -4
  448. package/dist/templatesCompiled/client/partials/serviceOption.d.ts.map +1 -1
  449. package/dist/templatesCompiled/client/partials/serviceOption.js +32 -46
  450. package/dist/templatesCompiled/client/yup/exportSchema.d.ts +11 -0
  451. package/dist/templatesCompiled/client/yup/exportSchema.d.ts.map +1 -0
  452. package/dist/templatesCompiled/client/yup/exportSchema.js +73 -0
  453. package/dist/templatesCompiled/client/yup/partials/yupSchema.d.ts +22 -0
  454. package/dist/templatesCompiled/client/yup/partials/yupSchema.d.ts.map +1 -0
  455. package/dist/templatesCompiled/client/yup/partials/yupSchema.js +129 -0
  456. package/dist/templatesCompiled/client/yup/partials/yupSchemaArray.d.ts +16 -0
  457. package/dist/templatesCompiled/client/yup/partials/yupSchemaArray.d.ts.map +1 -0
  458. package/dist/templatesCompiled/client/yup/partials/yupSchemaArray.js +84 -0
  459. package/dist/templatesCompiled/client/yup/partials/yupSchemaComposition.d.ts +18 -0
  460. package/dist/templatesCompiled/client/yup/partials/yupSchemaComposition.d.ts.map +1 -0
  461. package/dist/templatesCompiled/client/yup/partials/yupSchemaComposition.js +96 -0
  462. package/dist/templatesCompiled/client/yup/partials/yupSchemaDictionary.d.ts +14 -0
  463. package/dist/templatesCompiled/client/yup/partials/yupSchemaDictionary.d.ts.map +1 -0
  464. package/dist/templatesCompiled/client/yup/partials/yupSchemaDictionary.js +72 -0
  465. package/dist/templatesCompiled/client/yup/partials/yupSchemaEnum.d.ts +14 -0
  466. package/dist/templatesCompiled/client/yup/partials/yupSchemaEnum.d.ts.map +1 -0
  467. package/dist/templatesCompiled/client/yup/partials/yupSchemaEnum.js +74 -0
  468. package/dist/templatesCompiled/client/yup/partials/yupSchemaGeneric.d.ts +34 -0
  469. package/dist/templatesCompiled/client/yup/partials/yupSchemaGeneric.d.ts.map +1 -0
  470. package/dist/templatesCompiled/client/yup/partials/yupSchemaGeneric.js +201 -0
  471. package/dist/templatesCompiled/client/yup/partials/yupSchemaInterface.d.ts +14 -0
  472. package/dist/templatesCompiled/client/yup/partials/yupSchemaInterface.d.ts.map +1 -0
  473. package/dist/templatesCompiled/client/yup/partials/yupSchemaInterface.js +50 -0
  474. package/dist/templatesCompiled/client/yup/partials/yupSchemaReference.d.ts +9 -0
  475. package/dist/templatesCompiled/client/yup/partials/yupSchemaReference.d.ts.map +1 -0
  476. package/dist/templatesCompiled/client/yup/partials/yupSchemaReference.js +25 -0
  477. package/dist/templatesCompiled/client/zod/exportSchema.d.ts +11 -0
  478. package/dist/templatesCompiled/client/zod/exportSchema.d.ts.map +1 -0
  479. package/dist/templatesCompiled/client/zod/exportSchema.js +67 -0
  480. package/dist/templatesCompiled/client/zod/partials/zodSchema.d.ts +22 -0
  481. package/dist/templatesCompiled/client/zod/partials/zodSchema.d.ts.map +1 -0
  482. package/dist/templatesCompiled/client/zod/partials/zodSchema.js +129 -0
  483. package/dist/templatesCompiled/client/zod/partials/zodSchemaArray.d.ts +14 -0
  484. package/dist/templatesCompiled/client/zod/partials/zodSchemaArray.d.ts.map +1 -0
  485. package/dist/templatesCompiled/client/zod/partials/zodSchemaArray.js +65 -0
  486. package/dist/templatesCompiled/client/zod/partials/zodSchemaComposition.d.ts +15 -0
  487. package/dist/templatesCompiled/client/zod/partials/zodSchemaComposition.d.ts.map +1 -0
  488. package/dist/templatesCompiled/client/zod/partials/zodSchemaComposition.js +70 -0
  489. package/dist/templatesCompiled/client/zod/partials/zodSchemaDictionary.d.ts +12 -0
  490. package/dist/templatesCompiled/client/zod/partials/zodSchemaDictionary.d.ts.map +1 -0
  491. package/dist/templatesCompiled/client/zod/partials/zodSchemaDictionary.js +53 -0
  492. package/dist/templatesCompiled/client/zod/partials/zodSchemaEnum.d.ts +15 -0
  493. package/dist/templatesCompiled/client/zod/partials/zodSchemaEnum.d.ts.map +1 -0
  494. package/dist/templatesCompiled/client/zod/partials/zodSchemaEnum.js +86 -0
  495. package/dist/templatesCompiled/client/zod/partials/zodSchemaGeneric.d.ts +34 -0
  496. package/dist/templatesCompiled/client/zod/partials/zodSchemaGeneric.d.ts.map +1 -0
  497. package/dist/templatesCompiled/client/zod/partials/zodSchemaGeneric.js +193 -0
  498. package/dist/templatesCompiled/client/zod/partials/zodSchemaInterface.d.ts +14 -0
  499. package/dist/templatesCompiled/client/zod/partials/zodSchemaInterface.d.ts.map +1 -0
  500. package/dist/templatesCompiled/client/zod/partials/zodSchemaInterface.js +50 -0
  501. package/dist/templatesCompiled/client/zod/partials/zodSchemaReference.d.ts +9 -0
  502. package/dist/templatesCompiled/client/zod/partials/zodSchemaReference.d.ts.map +1 -0
  503. package/dist/templatesCompiled/client/zod/partials/zodSchemaReference.js +25 -0
  504. package/package.json +9 -4
  505. package/dist/cli/generate/runGenerateOpenApi.d.ts.map +0 -1
  506. package/dist/cli/initOpenApiConfig/Enums.d.ts +0 -5
  507. package/dist/cli/initOpenApiConfig/Enums.d.ts.map +0 -1
  508. package/dist/cli/initOpenApiConfig/Enums.js +0 -8
  509. package/dist/cli/initOpenApiConfig/runInitOpenapiConfig.d.ts +0 -3
  510. package/dist/cli/initOpenApiConfig/runInitOpenapiConfig.d.ts.map +0 -1
  511. package/dist/cli/initOpenApiConfig/runInitOpenapiConfig.js +0 -70
  512. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.d.ts +0 -3
  513. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.d.ts.map +0 -1
  514. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.js +0 -28
  515. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.d.ts +0 -7
  516. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.d.ts.map +0 -1
  517. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.js +0 -42
  518. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.d.ts +0 -3
  519. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.d.ts.map +0 -1
  520. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.js +0 -10
  521. package/dist/common/VersionedSchema/Utils/getErrorFieldsFromValidation.d.ts +0 -6
  522. package/dist/common/VersionedSchema/Utils/getErrorFieldsFromValidation.d.ts.map +0 -1
  523. package/dist/common/VersionedSchema/Utils/getErrorFieldsFromValidation.js +0 -7
  524. package/dist/common/VersionedSchema/Utils/joiHandlers.d.ts +0 -6
  525. package/dist/common/VersionedSchema/Utils/joiHandlers.d.ts.map +0 -1
  526. package/dist/common/VersionedSchema/Utils/joiHandlers.js +0 -59
  527. package/dist/common/VersionedSchema/Utils/mergeObjectSchemas.d.ts +0 -3
  528. package/dist/common/VersionedSchema/Utils/mergeObjectSchemas.d.ts.map +0 -1
  529. package/dist/common/VersionedSchema/Utils/mergeObjectSchemas.js +0 -12
  530. package/dist/common/VersionedSchema/Utils/traverseObjectStructure.d.ts +0 -3
  531. package/dist/common/VersionedSchema/Utils/traverseObjectStructure.d.ts.map +0 -1
  532. package/dist/common/VersionedSchema/Utils/traverseObjectStructure.js +0 -31
  533. package/dist/common/utils/__tests__/__mock__/mockJoiSchema.d.ts +0 -19
  534. package/dist/common/utils/__tests__/__mock__/mockJoiSchema.d.ts.map +0 -1
  535. package/dist/common/utils/__tests__/__mock__/mockJoiSchema.js +0 -14
  536. package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.d.ts +0 -2
  537. package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.d.ts.map +0 -1
  538. package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.js +0 -38
  539. package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.d.ts +0 -2
  540. package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.d.ts.map +0 -1
  541. package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.js +0 -20
  542. package/dist/common/utils/__tests__/mergeObjectSchemas.test.d.ts +0 -2
  543. package/dist/common/utils/__tests__/mergeObjectSchemas.test.d.ts.map +0 -1
  544. package/dist/common/utils/__tests__/mergeObjectSchemas.test.js +0 -35
  545. package/dist/common/utils/__tests__/migrationForMultiOptions.test.d.ts +0 -2
  546. package/dist/common/utils/__tests__/migrationForMultiOptions.test.d.ts.map +0 -1
  547. package/dist/common/utils/__tests__/migrationForMultiOptions.test.js +0 -112
  548. package/dist/common/utils/__tests__/migrationForOptions.test.d.ts +0 -2
  549. package/dist/common/utils/__tests__/migrationForOptions.test.d.ts.map +0 -1
  550. package/dist/common/utils/__tests__/migrationForOptions.test.js +0 -56
  551. package/dist/core/types/base/RefWithtype.model.d.ts +0 -11
  552. package/dist/core/types/base/RefWithtype.model.d.ts.map +0 -1
  553. package/dist/core/types/enums/TypeRef.enum.d.ts +0 -8
  554. package/dist/core/types/enums/TypeRef.enum.d.ts.map +0 -1
  555. package/dist/core/types/enums/TypeRef.enum.js +0 -11
  556. package/dist/core/utils/__tests__/getGatheringRefs.test.d.ts +0 -2
  557. package/dist/core/utils/__tests__/getGatheringRefs.test.d.ts.map +0 -1
  558. package/dist/core/utils/__tests__/getGatheringRefs.test.js +0 -26
  559. package/dist/core/utils/__tests__/getRefFromSchema.test.d.ts +0 -2
  560. package/dist/core/utils/__tests__/getRefFromSchema.test.d.ts.map +0 -1
  561. package/dist/core/utils/__tests__/getRefFromSchema.test.js +0 -167
  562. package/dist/core/utils/__tests__/refResolver.test.d.ts +0 -2
  563. package/dist/core/utils/__tests__/refResolver.test.d.ts.map +0 -1
  564. package/dist/core/utils/__tests__/refResolver.test.js +0 -55
  565. package/dist/core/utils/__tests__/resolveRefToImportPath.test.d.ts +0 -2
  566. package/dist/core/utils/__tests__/resolveRefToImportPath.test.d.ts.map +0 -1
  567. package/dist/core/utils/__tests__/resolveRefToImportPath.test.js +0 -376
  568. package/dist/core/utils/advancedDeduplicatePath.d.ts +0 -5
  569. package/dist/core/utils/advancedDeduplicatePath.d.ts.map +0 -1
  570. package/dist/core/utils/advancedDeduplicatePath.js +0 -29
  571. package/dist/core/utils/findCommonParent.d.ts +0 -7
  572. package/dist/core/utils/findCommonParent.d.ts.map +0 -1
  573. package/dist/core/utils/findCommonParent.js +0 -20
  574. package/dist/core/utils/getGatheringRefs.d.ts +0 -4
  575. package/dist/core/utils/getGatheringRefs.d.ts.map +0 -1
  576. package/dist/core/utils/getGatheringRefs.js +0 -68
  577. package/dist/core/utils/getRefFromSchema.d.ts +0 -3
  578. package/dist/core/utils/getRefFromSchema.d.ts.map +0 -1
  579. package/dist/core/utils/getRefFromSchema.js +0 -9
  580. package/dist/core/utils/isBoolean.d.ts +0 -2
  581. package/dist/core/utils/isBoolean.d.ts.map +0 -1
  582. package/dist/core/utils/isBoolean.js +0 -12
  583. package/dist/core/utils/isFileName.d.ts +0 -7
  584. package/dist/core/utils/isFileName.d.ts.map +0 -1
  585. package/dist/core/utils/isFileName.js +0 -30
  586. package/dist/core/utils/mapPathToTargetDirSafe.d.ts +0 -10
  587. package/dist/core/utils/mapPathToTargetDirSafe.d.ts.map +0 -1
  588. package/dist/core/utils/mapPathToTargetDirSafe.js +0 -48
  589. package/dist/core/utils/normalizeAllRefs.d.ts +0 -6
  590. package/dist/core/utils/normalizeAllRefs.d.ts.map +0 -1
  591. package/dist/core/utils/normalizeAllRefs.js +0 -35
  592. package/dist/core/utils/resolveRefToImportPath.d.ts +0 -13
  593. package/dist/core/utils/resolveRefToImportPath.d.ts.map +0 -1
  594. package/dist/core/utils/resolveRefToImportPath.js +0 -105
  595. /package/dist/core/types/base/{RefWithtype.model.js → Templates.model.js} +0 -0
@@ -1,7 +0,0 @@
1
- /**
2
- * Finds the common parent directory of two paths
3
- * @param path1 The value of the path
4
- * @param path2 The value of the path
5
- */
6
- export declare function findCommonParent(path1: string, path2: string): string | null;
7
- //# sourceMappingURL=findCommonParent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"findCommonParent.d.ts","sourceRoot":"","sources":["../../../src/core/utils/findCommonParent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAa5E"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findCommonParent = findCommonParent;
4
- /**
5
- * Finds the common parent directory of two paths
6
- * @param path1 The value of the path
7
- * @param path2 The value of the path
8
- */
9
- function findCommonParent(path1, path2) {
10
- const pathSep = '/';
11
- const parts1 = path1.split(pathSep).filter(Boolean);
12
- const parts2 = path2.split(pathSep).filter(Boolean);
13
- let i = 0;
14
- while (i < parts1.length && i < parts2.length && parts1[i] === parts2[i]) {
15
- i++;
16
- }
17
- if (i === 0)
18
- return null;
19
- return pathSep + parts1.slice(0, i).join(pathSep);
20
- }
@@ -1,4 +0,0 @@
1
- import { Context } from '../Context';
2
- import { RefWithType } from '../types/base/RefWithtype.model';
3
- export declare function getGatheringRefs(context: Context, object: Record<string, any>, references?: RefWithType[], root?: string, isSchema?: boolean): RefWithType[];
4
- //# sourceMappingURL=getGatheringRefs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getGatheringRefs.d.ts","sourceRoot":"","sources":["../../../src/core/utils/getGatheringRefs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAe9D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,GAAE,WAAW,EAAO,EAAE,IAAI,GAAE,MAAW,EAAE,QAAQ,GAAE,OAAe,GAAG,WAAW,EAAE,CAqD3K"}
@@ -1,68 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getGatheringRefs = getGatheringRefs;
7
- const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
8
- const TypeRef_enum_1 = require("../types/enums/TypeRef.enum");
9
- const normalizeRef_1 = require("./normalizeRef");
10
- const parseRef_1 = require("./parseRef");
11
- const resolveRefPath_1 = require("./resolveRefPath");
12
- function includes(references, value) {
13
- return references.findIndex(item => (0, fast_deep_equal_1.default)(item.value, value)) !== -1;
14
- }
15
- function extractBasePath(path) {
16
- // Extracting the base path to the last `#`
17
- return path.includes('#') ? path.split('#')[0] : path;
18
- }
19
- function getGatheringRefs(context, object, references = [], root = '', isSchema = false) {
20
- // If the object is not valid, we return the links
21
- if (!object || typeof object !== 'object') {
22
- return references;
23
- }
24
- if (object.$ref) {
25
- // Parse the reference to understand its type
26
- const baseRoot = extractBasePath(root);
27
- const parsedRef = (0, parseRef_1.parseRef)(object.$ref);
28
- // Create normalized reference for context.get
29
- const normalizedRef = (0, normalizeRef_1.normalizeRef)(object.$ref, baseRoot);
30
- if (includes(references, normalizedRef)) {
31
- return references;
32
- }
33
- references.push({ value: normalizedRef, type: isSchema ? TypeRef_enum_1.TypeRef.SCHEMA : TypeRef_enum_1.TypeRef.OTHERS });
34
- const newObject = context.get(normalizedRef);
35
- // For recursive processing, determine the correct root path
36
- let newRoot;
37
- if (parsedRef.type === 'local_fragment') {
38
- // For local fragments, keep the same root
39
- newRoot = baseRoot;
40
- }
41
- else if (parsedRef.type === 'external_file' || parsedRef.type === 'external_file_fragment') {
42
- // For external files, use the resolved file path
43
- const resolvedPath = (0, resolveRefPath_1.resolveRefPath)(parsedRef, baseRoot);
44
- newRoot = resolvedPath;
45
- }
46
- else {
47
- // For other types, use the normalized path without fragment
48
- const [filePath] = normalizedRef.split('#');
49
- newRoot = filePath;
50
- }
51
- return getGatheringRefs(context, newObject, references, newRoot, isSchema);
52
- }
53
- else if (object.schema) {
54
- Object.values(object).forEach(value => {
55
- if (value instanceof Object) {
56
- getGatheringRefs(context, value, references, root, true);
57
- }
58
- });
59
- }
60
- else {
61
- Object.values(object).forEach(value => {
62
- if (value instanceof Object) {
63
- getGatheringRefs(context, value, references, root, isSchema);
64
- }
65
- });
66
- }
67
- return references;
68
- }
@@ -1,3 +0,0 @@
1
- import { Context } from '../Context';
2
- export declare function getRefFromSchema(context: Context, object: Record<string, any>): string[];
3
- //# sourceMappingURL=getRefFromSchema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRefFromSchema.d.ts","sourceRoot":"","sources":["../../../src/core/utils/getRefFromSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,EAAE,CAGxF"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRefFromSchema = getRefFromSchema;
4
- const TypeRef_enum_1 = require("../types/enums/TypeRef.enum");
5
- const getGatheringRefs_1 = require("./getGatheringRefs");
6
- function getRefFromSchema(context, object) {
7
- const references = (0, getGatheringRefs_1.getGatheringRefs)(context, object);
8
- return references.filter(item => item.type === TypeRef_enum_1.TypeRef.SCHEMA).map(value => value.value);
9
- }
@@ -1,2 +0,0 @@
1
- export declare function isBoolean(value: any, defaultValue?: boolean): any;
2
- //# sourceMappingURL=isBoolean.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isBoolean.d.ts","sourceRoot":"","sources":["../../../src/core/utils/isBoolean.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,YAAY,UAAQ,OAUzD"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isBoolean = isBoolean;
4
- function isBoolean(value, defaultValue = false) {
5
- if (value === null || value === undefined) {
6
- return defaultValue;
7
- }
8
- if (value === true || value === false) {
9
- return value;
10
- }
11
- return defaultValue;
12
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Checks if the string is just a file name (with an extension)
3
- * @param str - the line to check
4
- * @returns true, if this is the file name
5
- */
6
- export declare function isFileName(str: string): boolean;
7
- //# sourceMappingURL=isFileName.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isFileName.d.ts","sourceRoot":"","sources":["../../../src/core/utils/isFileName.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAmB/C"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isFileName = isFileName;
4
- /**
5
- * Checks if the string is just a file name (with an extension)
6
- * @param str - the line to check
7
- * @returns true, if this is the file name
8
- */
9
- function isFileName(str) {
10
- if (typeof str !== 'string' || !str)
11
- return false;
12
- // 1. Does not contain path separators
13
- if (str.includes('/') || str.includes('\\'))
14
- return false;
15
- // 2. Does not start with ./, ../, \
16
- if (/^\.\.?[\\/\\]/.test(str))
17
- return false;
18
- if (str.startsWith('/'))
19
- return false;
20
- // 3. Contains at least one dot and does not end with a dot.
21
- const parts = str.split('.');
22
- if (parts.length < 2)
23
- return false;
24
- if (parts[parts.length - 1] === '')
25
- return false; // ends with .
26
- // 4. The file name is not empty
27
- if (parts[0] === '')
28
- return false;
29
- return true;
30
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Safely muppit the path from SourceDir → targetDir
3
- * Works even if the file is outside SourceDir, but in a common parent
4
- * @param filePath
5
- * @param sourceDir
6
- * @param targetDir
7
- * @returns
8
- */
9
- export declare function mapPathToTargetDirSafe(filePath: string, sourceDir: string, targetDir: string): string;
10
- //# sourceMappingURL=mapPathToTargetDirSafe.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapPathToTargetDirSafe.d.ts","sourceRoot":"","sources":["../../../src/core/utils/mapPathToTargetDirSafe.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CA0CrG"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapPathToTargetDirSafe = mapPathToTargetDirSafe;
4
- const pathHelpers_1 = require("../../common/utils/pathHelpers");
5
- const findCommonParent_1 = require("./findCommonParent");
6
- const getRelativeModelPath_1 = require("./getRelativeModelPath");
7
- /**
8
- * Safely muppit the path from SourceDir → targetDir
9
- * Works even if the file is outside SourceDir, but in a common parent
10
- * @param filePath
11
- * @param sourceDir
12
- * @param targetDir
13
- * @returns
14
- */
15
- function mapPathToTargetDirSafe(filePath, sourceDir, targetDir) {
16
- const pathSep = '/';
17
- const absFile = (0, pathHelpers_1.resolveHelper)(filePath);
18
- const absSource = (0, pathHelpers_1.resolveHelper)(sourceDir);
19
- const absTarget = (0, pathHelpers_1.resolveHelper)(targetDir);
20
- const sourceWithSep = absSource.endsWith(pathSep) ? absSource : absSource + pathSep;
21
- // 1. The file inside SourceDir → mapim as usual
22
- if (absFile.startsWith(sourceWithSep)) {
23
- const rel = (0, pathHelpers_1.relativeHelper)(absSource, absFile);
24
- return (0, pathHelpers_1.resolveHelper)(absTarget, rel);
25
- }
26
- // 2. The file is outside SourceDir, but in a common parent
27
- const commonParent = (0, findCommonParent_1.findCommonParent)(absSource, absFile);
28
- if (commonParent) {
29
- // Path from commonParent → file
30
- const fileRelToCommon = (0, pathHelpers_1.relativeHelper)(commonParent, absFile);
31
- // Path from targetDir → commonParent
32
- const targetToCommon = (0, pathHelpers_1.relativeHelper)(absTarget, commonParent);
33
- if (targetToCommon.includes('..')) {
34
- // targetDir is higher than commonParent → we can't map
35
- if (filePath) {
36
- const relativePath = (0, pathHelpers_1.relativeHelper)(absSource, absFile);
37
- return (0, getRelativeModelPath_1.getRelativeModelPath)(targetDir, relativePath);
38
- }
39
- return filePath;
40
- }
41
- // Collecting: targetDir → commonParent → file
42
- const pathFromTargetToCommon = (0, pathHelpers_1.relativeHelper)(absTarget, commonParent);
43
- const pathFromCommonToFile = fileRelToCommon;
44
- return (0, pathHelpers_1.resolveHelper)(absTarget, pathFromTargetToCommon, pathFromCommonToFile);
45
- }
46
- // 3. There is no common parent → return as is
47
- return filePath;
48
- }
@@ -1,6 +0,0 @@
1
- import type { Context } from '../Context';
2
- /**
3
- * Deep traversal and normalization of all $ref in an object
4
- */
5
- export declare function normalizeAllRefs<T extends Record<string, any>>(obj: T, context: Context, parentFilePath: string): T;
6
- //# sourceMappingURL=normalizeAllRefs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeAllRefs.d.ts","sourceRoot":"","sources":["../../../src/core/utils/normalizeAllRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1D,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,MAAM,GACvB,CAAC,CA6BH"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeAllRefs = normalizeAllRefs;
4
- const normalizeRef_1 = require("./normalizeRef");
5
- /**
6
- * Deep traversal and normalization of all $ref in an object
7
- */
8
- function normalizeAllRefs(obj, context, parentFilePath) {
9
- if (!obj || typeof obj !== 'object' || Array.isArray(obj)) {
10
- return obj;
11
- }
12
- // If this object is a $ref holder
13
- if (obj.$ref && typeof obj.$ref === 'string') {
14
- const normalizedRef = (0, normalizeRef_1.normalizeRef)(obj.$ref, parentFilePath);
15
- return {
16
- ...obj,
17
- $ref: normalizedRef
18
- };
19
- }
20
- const result = Array.isArray(obj) ? [] : { ...obj };
21
- for (const [key, value] of Object.entries(obj)) {
22
- if (value && typeof value === 'object') {
23
- // For nested objects, use the same parent file path
24
- // The normalization will handle the $ref resolution correctly
25
- result[key] = normalizeAllRefs(value, context, parentFilePath);
26
- }
27
- else if (Array.isArray(value)) {
28
- result[key] = value.map((item) => (item && typeof item === 'object' ? normalizeAllRefs(item, context, parentFilePath) : item));
29
- }
30
- else {
31
- result[key] = value;
32
- }
33
- }
34
- return result;
35
- }
@@ -1,13 +0,0 @@
1
- interface IParams {
2
- mainSpecPath: string;
3
- parentFilePath: string;
4
- refValuePath: string;
5
- outputModelsPath: string;
6
- }
7
- /**
8
- * Resolves $ref reference to import path for generated code.
9
- * Handles HTTP URLs, local fragments, external file fragments, external files, and absolute paths.
10
- */
11
- export declare function resolveRefToImportPath({ mainSpecPath, parentFilePath, refValuePath, outputModelsPath }: IParams): string;
12
- export {};
13
- //# sourceMappingURL=resolveRefToImportPath.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveRefToImportPath.d.ts","sourceRoot":"","sources":["../../../src/core/utils/resolveRefToImportPath.ts"],"names":[],"mappings":"AAQA,UAAU,OAAO;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAyFD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,EAAE,OAAO,UAiE/G"}
@@ -1,105 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveRefToImportPath = resolveRefToImportPath;
4
- const path_1 = require("path");
5
- const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
6
- const pathHelpers_1 = require("../../common/utils/pathHelpers");
7
- const mapPathToTargetDirSafe_1 = require("./mapPathToTargetDirSafe");
8
- const parseRef_1 = require("./parseRef");
9
- const stripNamespace_1 = require("./stripNamespace");
10
- /**
11
- * Resolves model path and returns relative path or fallback name.
12
- * Returns fallback if the path is outside outputModelsPath, otherwise returns relative path.
13
- */
14
- function resolveModelPath(absModelPath, absOutputModelsPath, fallbackName) {
15
- if (!absModelPath.startsWith(absOutputModelsPath + '/') && absModelPath !== absOutputModelsPath) {
16
- return `./${fallbackName}`;
17
- }
18
- return (0, pathHelpers_1.relativeHelper)(absOutputModelsPath, absModelPath);
19
- }
20
- /**
21
- * Resolves fragment reference (LOCAL_FRAGMENT or EXTERNAL_FILE_FRAGMENT).
22
- * Both types use the same logic: resolve model path based on parent file location.
23
- */
24
- function resolveFragmentRef(modelName, parentFilePath, mainSpecPath, sourceRoot, outputModelsPath, absOutputModelsPath) {
25
- const cleanParentForLocal = (0, stripNamespace_1.stripNamespace)(parentFilePath || mainSpecPath);
26
- const parentDirInSource = (0, pathHelpers_1.dirNameHelper)(cleanParentForLocal);
27
- const parentDirInOutput = (0, mapPathToTargetDirSafe_1.mapPathToTargetDirSafe)(parentDirInSource, sourceRoot, outputModelsPath);
28
- const modelFilePathInOutput = (0, pathHelpers_1.resolveHelper)(parentDirInOutput, modelName);
29
- const absModelPath = (0, pathHelpers_1.resolveHelper)(modelFilePathInOutput);
30
- return resolveModelPath(absModelPath, absOutputModelsPath, modelName);
31
- }
32
- /**
33
- * Resolves external file or absolute path reference.
34
- * Maps the target file path to output directory and returns relative path or fallback.
35
- */
36
- function resolveExternalFileOrAbsolutePath(targetFileAbs, sourceRoot, outputModelsPath, absOutputModelsPath) {
37
- const targetPathInOutput = (0, mapPathToTargetDirSafe_1.mapPathToTargetDirSafe)(targetFileAbs, sourceRoot, outputModelsPath);
38
- const absTargetPath = (0, pathHelpers_1.resolveHelper)(targetPathInOutput);
39
- const fallbackName = (0, stripNamespace_1.stripNamespace)((0, path_1.basename)(targetFileAbs));
40
- return resolveModelPath(absTargetPath, absOutputModelsPath, fallbackName);
41
- }
42
- /**
43
- * Prepares parent directory for resolving relative references.
44
- * Handles both file and directory paths.
45
- */
46
- function prepareParentDirForResolve(parentFilePath, mainSpecPath, sourceRoot) {
47
- const parentParsed = parentFilePath ? (0, parseRef_1.parseRef)(parentFilePath) : null;
48
- const parentRaw = parentParsed?.filePath ? parentParsed.filePath : '';
49
- const parentClean = (0, stripNamespace_1.stripNamespace)(parentRaw);
50
- let parentDirForResolve = fileSystemHelpers_1.fileSystemHelpers.isPathToFile(sourceRoot) ? (0, pathHelpers_1.dirNameHelper)(sourceRoot) : sourceRoot;
51
- if (parentClean) {
52
- parentDirForResolve = fileSystemHelpers_1.fileSystemHelpers.isPathToFile(parentRaw) ? (0, pathHelpers_1.dirNameHelper)(parentClean) : parentClean;
53
- }
54
- return parentDirForResolve.endsWith('/') ? parentDirForResolve : parentDirForResolve + '/';
55
- }
56
- /**
57
- * Removes parent basename prefix from reference value if present.
58
- * This handles cases where refValuePath starts with parent directory name.
59
- */
60
- function removeParentBasenamePrefix(refValueClean, parentDirForResolveWithSep) {
61
- const baseNameParent = (0, path_1.basename)(parentDirForResolveWithSep);
62
- const baseNameParentWithSep = baseNameParent.endsWith('/') ? baseNameParent : baseNameParent + '/';
63
- return refValueClean.startsWith(baseNameParentWithSep)
64
- ? refValueClean.replace(baseNameParentWithSep, '')
65
- : refValueClean;
66
- }
67
- /**
68
- * Resolves $ref reference to import path for generated code.
69
- * Handles HTTP URLs, local fragments, external file fragments, external files, and absolute paths.
70
- */
71
- function resolveRefToImportPath({ mainSpecPath, parentFilePath, refValuePath, outputModelsPath }) {
72
- const absOutputModelsPath = (0, pathHelpers_1.resolveHelper)(outputModelsPath);
73
- const sourceRoot = fileSystemHelpers_1.fileSystemHelpers.isDirectory(mainSpecPath) ? mainSpecPath : (0, pathHelpers_1.dirNameHelper)(mainSpecPath);
74
- const parsed = (0, parseRef_1.parseRef)(refValuePath);
75
- // HTTP URLs are returned as-is
76
- if (parsed.type === parseRef_1.RefType.HTTP_URL) {
77
- return refValuePath;
78
- }
79
- // LOCAL_FRAGMENT: reference to component in the same file (e.g., #/components/schemas/User)
80
- if (parsed.type === parseRef_1.RefType.LOCAL_FRAGMENT) {
81
- const modelName = (0, stripNamespace_1.stripNamespace)(refValuePath);
82
- return resolveFragmentRef(modelName, parentFilePath, mainSpecPath, sourceRoot, outputModelsPath, absOutputModelsPath);
83
- }
84
- // EXTERNAL_FILE_FRAGMENT: reference to component in external file (e.g., ./file.yaml#/components/schemas/User)
85
- if (parsed.type === parseRef_1.RefType.EXTERNAL_FILE_FRAGMENT) {
86
- const refFileRaw = parsed?.fragment ? parsed.fragment : '';
87
- const modelName = (0, stripNamespace_1.stripNamespace)(refFileRaw || '') || '';
88
- return resolveFragmentRef(modelName, parentFilePath, mainSpecPath, sourceRoot, outputModelsPath, absOutputModelsPath);
89
- }
90
- // Prepare parent directory for resolving relative references
91
- // This is used for both EXTERNAL_FILE and ABSOLUTE_PATH (default case)
92
- const parentDirForResolveWithSep = prepareParentDirForResolve(parentFilePath, mainSpecPath, sourceRoot);
93
- const refValueClean = (0, stripNamespace_1.stripNamespace)(refValuePath || '') || refValuePath;
94
- const currentRefValue = removeParentBasenamePrefix(refValueClean, parentDirForResolveWithSep);
95
- // EXTERNAL_FILE: reference to external file (e.g., ./file.yaml)
96
- if (parsed.type === parseRef_1.RefType.EXTERNAL_FILE) {
97
- const targetFileAbs = (0, pathHelpers_1.joinHelper)(parentDirForResolveWithSep, currentRefValue);
98
- return resolveExternalFileOrAbsolutePath(targetFileAbs, sourceRoot, outputModelsPath, absOutputModelsPath);
99
- }
100
- // ABSOLUTE_PATH (default case): absolute path reference
101
- const targetFileAbs = fileSystemHelpers_1.fileSystemHelpers.isPathToFile(refValueClean)
102
- ? (0, pathHelpers_1.joinHelper)(parentDirForResolveWithSep, refValueClean)
103
- : (0, pathHelpers_1.resolveHelper)(parentDirForResolveWithSep, refValueClean);
104
- return resolveExternalFileOrAbsolutePath(targetFileAbs, sourceRoot, outputModelsPath, absOutputModelsPath);
105
- }