ts-openapi-codegen 2.0.0-beta.7 → 2.0.0-beta.9

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 (281) hide show
  1. package/README.md +104 -0
  2. package/README.rus.md +104 -0
  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/generateOpenApiClient/generateOpenApiClient.d.ts.map +1 -1
  10. package/dist/cli/generateOpenApiClient/generateOpenApiClient.js +4 -5
  11. package/dist/cli/index.js +5 -5
  12. package/dist/cli/initOpenApiConfig/init.d.ts.map +1 -1
  13. package/dist/cli/initOpenApiConfig/init.js +5 -13
  14. package/dist/cli/initOpenApiConfig/initConfig.js +3 -3
  15. package/dist/cli/previewChanges/previewChanges.d.ts.map +1 -1
  16. package/dist/cli/previewChanges/previewChanges.js +12 -5
  17. package/dist/cli/schemas/base.d.ts +6 -1
  18. package/dist/cli/schemas/base.d.ts.map +1 -1
  19. package/dist/cli/schemas/base.js +10 -6
  20. package/dist/cli/schemas/checkConfig.d.ts +1 -1
  21. package/dist/cli/schemas/generate.d.ts +1 -25
  22. package/dist/cli/schemas/generate.d.ts.map +1 -1
  23. package/dist/cli/schemas/generate.js +21 -32
  24. package/dist/cli/schemas/index.d.ts +2 -1
  25. package/dist/cli/schemas/index.d.ts.map +1 -1
  26. package/dist/cli/schemas/index.js +1 -0
  27. package/dist/cli/schemas/init.d.ts +5 -5
  28. package/dist/cli/schemas/init.d.ts.map +1 -1
  29. package/dist/cli/schemas/init.js +4 -5
  30. package/dist/cli/schemas/previewChanges.d.ts +9 -0
  31. package/dist/cli/schemas/previewChanges.d.ts.map +1 -0
  32. package/dist/cli/schemas/previewChanges.js +11 -0
  33. package/dist/cli/schemas/updateConfig.d.ts +1 -1
  34. package/dist/common/Consts.d.ts +2 -0
  35. package/dist/common/Consts.d.ts.map +1 -1
  36. package/dist/common/Consts.js +4 -1
  37. package/dist/common/LoggerMessages.js +1 -1
  38. package/dist/common/TRawOptions.d.ts +1 -1
  39. package/dist/common/TRawOptions.d.ts.map +1 -1
  40. package/dist/common/Validation/formatZodError.d.ts +10 -0
  41. package/dist/common/Validation/formatZodError.d.ts.map +1 -0
  42. package/dist/{cli/validation/errorFormatter.js → common/Validation/formatZodError.js} +14 -13
  43. package/dist/common/Validation/index.d.ts +3 -0
  44. package/dist/common/Validation/index.d.ts.map +1 -0
  45. package/dist/{cli/validation → common/Validation}/index.js +2 -2
  46. package/dist/{cli/validation/validateCLIOptions.d.ts → common/Validation/validateZodOptions.d.ts} +4 -4
  47. package/dist/common/Validation/validateZodOptions.d.ts.map +1 -0
  48. package/dist/{cli/validation/validateCLIOptions.js → common/Validation/validateZodOptions.js} +7 -10
  49. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts +6 -1
  50. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts.map +1 -1
  51. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.js +8 -14
  52. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts +28 -0
  53. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts.map +1 -0
  54. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.js +25 -0
  55. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts +36 -6
  56. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts.map +1 -1
  57. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.js +33 -37
  58. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts +37 -6
  59. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts.map +1 -1
  60. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.js +30 -37
  61. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts +40 -0
  62. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts.map +1 -0
  63. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.js +36 -0
  64. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts +65 -0
  65. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts.map +1 -0
  66. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.js +31 -0
  67. package/dist/common/VersionedSchema/CommonSchemas.d.ts +53 -30
  68. package/dist/common/VersionedSchema/CommonSchemas.d.ts.map +1 -1
  69. package/dist/common/VersionedSchema/CommonSchemas.js +47 -72
  70. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts +25 -5
  71. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts.map +1 -1
  72. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.js +34 -17
  73. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts +25 -5
  74. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts.map +1 -1
  75. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.js +28 -19
  76. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts +25 -1
  77. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts.map +1 -1
  78. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.js +29 -2
  79. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts +25 -5
  80. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts.map +1 -1
  81. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.js +30 -14
  82. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts +23 -5
  83. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts.map +1 -1
  84. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.js +33 -18
  85. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.d.ts +3 -2
  86. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.d.ts.map +1 -1
  87. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.js +18 -11
  88. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts +22 -5
  89. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts.map +1 -1
  90. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.js +30 -12
  91. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts +22 -5
  92. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts.map +1 -1
  93. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.js +27 -13
  94. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts +22 -1
  95. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts.map +1 -1
  96. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.js +28 -2
  97. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts +22 -5
  98. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts.map +1 -1
  99. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.js +31 -12
  100. package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.d.ts +3 -2
  101. package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.d.ts.map +1 -1
  102. package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.js +15 -9
  103. package/dist/common/VersionedSchema/Types.d.ts +5 -5
  104. package/dist/common/VersionedSchema/Types.d.ts.map +1 -1
  105. package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.d.ts +16 -0
  106. package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.d.ts.map +1 -0
  107. package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.js +85 -0
  108. package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.d.ts +2 -0
  109. package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.d.ts.map +1 -0
  110. package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.js +23 -0
  111. package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.d.ts +2 -0
  112. package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.d.ts.map +1 -0
  113. package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.js +75 -0
  114. package/dist/common/VersionedSchema/Utils/buildVersionedSchema.d.ts +12 -0
  115. package/dist/common/VersionedSchema/Utils/buildVersionedSchema.d.ts.map +1 -0
  116. package/dist/common/VersionedSchema/Utils/buildVersionedSchema.js +13 -0
  117. package/dist/common/VersionedSchema/Utils/compareShapes.d.ts +16 -0
  118. package/dist/common/VersionedSchema/Utils/compareShapes.d.ts.map +1 -0
  119. package/dist/common/VersionedSchema/Utils/compareShapes.js +30 -0
  120. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts +2 -1
  121. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts.map +1 -1
  122. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.js +5 -5
  123. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts +2 -2
  124. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts.map +1 -1
  125. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.js +15 -7
  126. package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.d.ts +2 -2
  127. package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.d.ts.map +1 -1
  128. package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.js +16 -3
  129. package/dist/common/VersionedSchema/Utils/getUniqueObjectKeys.d.ts.map +1 -1
  130. package/dist/common/VersionedSchema/Utils/getUniqueObjectKeys.js +19 -2
  131. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts +2 -1
  132. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
  133. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +10 -9
  134. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts +4 -0
  135. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts.map +1 -0
  136. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.js +43 -0
  137. package/dist/common/VersionedSchema/refinements/singleOrMultiRefinement.d.ts +4 -0
  138. package/dist/common/VersionedSchema/refinements/singleOrMultiRefinement.d.ts.map +1 -0
  139. package/dist/common/VersionedSchema/refinements/singleOrMultiRefinement.js +21 -0
  140. package/dist/core/Context.d.ts +6 -5
  141. package/dist/core/Context.d.ts.map +1 -1
  142. package/dist/core/Context.js +69 -26
  143. package/dist/core/OpenApiClient.d.ts.map +1 -1
  144. package/dist/core/OpenApiClient.js +12 -8
  145. package/dist/core/WriteClient.d.ts.map +1 -1
  146. package/dist/core/WriteClient.js +4 -0
  147. package/dist/core/__tests__/WriteClient.test.js +3 -0
  148. package/dist/core/api/v2/Parser.d.ts +1 -1
  149. package/dist/core/api/v2/Parser.d.ts.map +1 -1
  150. package/dist/core/api/v2/Parser.js +2 -2
  151. package/dist/core/api/v2/parser/getModel.d.ts.map +1 -1
  152. package/dist/core/api/v2/parser/getModel.js +2 -5
  153. package/dist/core/api/v2/parser/getModelProperties.d.ts.map +1 -1
  154. package/dist/core/api/v2/parser/getModelProperties.js +1 -3
  155. package/dist/core/api/v2/parser/getModels.d.ts.map +1 -1
  156. package/dist/core/api/v2/parser/getModels.js +1 -2
  157. package/dist/core/api/v2/parser/getOperationParameter.d.ts.map +1 -1
  158. package/dist/core/api/v2/parser/getOperationParameter.js +2 -5
  159. package/dist/core/api/v2/parser/getOperationParameters.js +1 -1
  160. package/dist/core/api/v2/parser/getOperationResponse.d.ts.map +1 -1
  161. package/dist/core/api/v2/parser/getOperationResponse.js +1 -3
  162. package/dist/core/api/v2/parser/getOperationResponses.js +1 -1
  163. package/dist/core/api/v2/parser/getServices.d.ts.map +1 -1
  164. package/dist/core/api/v2/parser/getServices.js +4 -3
  165. package/dist/core/api/v2/parser/getType.d.ts.map +1 -1
  166. package/dist/core/api/v2/parser/getType.js +2 -2
  167. package/dist/core/api/v3/Parser.d.ts +1 -1
  168. package/dist/core/api/v3/Parser.d.ts.map +1 -1
  169. package/dist/core/api/v3/Parser.js +2 -2
  170. package/dist/core/api/v3/parser/getModel.d.ts.map +1 -1
  171. package/dist/core/api/v3/parser/getModel.js +2 -5
  172. package/dist/core/api/v3/parser/getModelProperties.d.ts.map +1 -1
  173. package/dist/core/api/v3/parser/getModelProperties.js +1 -3
  174. package/dist/core/api/v3/parser/getModels.d.ts.map +1 -1
  175. package/dist/core/api/v3/parser/getModels.js +1 -2
  176. package/dist/core/api/v3/parser/getOperation.js +1 -1
  177. package/dist/core/api/v3/parser/getOperationParameter.d.ts.map +1 -1
  178. package/dist/core/api/v3/parser/getOperationParameter.js +2 -5
  179. package/dist/core/api/v3/parser/getOperationParameters.js +1 -1
  180. package/dist/core/api/v3/parser/getOperationRequestBody.d.ts.map +1 -1
  181. package/dist/core/api/v3/parser/getOperationRequestBody.js +1 -3
  182. package/dist/core/api/v3/parser/getOperationResponse.d.ts.map +1 -1
  183. package/dist/core/api/v3/parser/getOperationResponse.js +1 -3
  184. package/dist/core/api/v3/parser/getOperationResponses.js +1 -1
  185. package/dist/core/api/v3/parser/getServices.d.ts.map +1 -1
  186. package/dist/core/api/v3/parser/getServices.js +4 -3
  187. package/dist/core/api/v3/parser/getType.js +2 -2
  188. package/dist/core/index.d.ts.map +1 -1
  189. package/dist/core/index.js +2 -0
  190. package/dist/core/types/base/Templates.model.d.ts +3 -0
  191. package/dist/core/types/base/Templates.model.d.ts.map +1 -1
  192. package/dist/core/utils/__mocks__/templates.d.ts.map +1 -1
  193. package/dist/core/utils/__mocks__/templates.js +3 -0
  194. package/dist/core/utils/__tests__/isSubdirectory.test.js +2 -2
  195. package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
  196. package/dist/core/utils/registerHandlebarTemplates.js +9 -3
  197. package/dist/core/utils/serviceHelpers.d.ts.map +1 -1
  198. package/dist/core/utils/serviceHelpers.js +32 -6
  199. package/dist/core/utils/validateRawOptions.d.ts +3 -0
  200. package/dist/core/utils/validateRawOptions.d.ts.map +1 -0
  201. package/dist/core/utils/validateRawOptions.js +15 -0
  202. package/dist/core/utils/writeClientCore.d.ts.map +1 -1
  203. package/dist/core/utils/writeClientCore.js +5 -3
  204. package/dist/templatesCompiled/client/core/ApiError.js +1 -1
  205. package/dist/templatesCompiled/client/core/CancelablePromise.d.ts +1 -0
  206. package/dist/templatesCompiled/client/core/CancelablePromise.d.ts.map +1 -1
  207. package/dist/templatesCompiled/client/core/CancelablePromise.js +9 -2
  208. package/dist/templatesCompiled/client/core/HttpStatusCode.d.ts +1 -0
  209. package/dist/templatesCompiled/client/core/HttpStatusCode.d.ts.map +1 -1
  210. package/dist/templatesCompiled/client/core/HttpStatusCode.js +9 -2
  211. package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.d.ts.map +1 -0
  212. package/dist/templatesCompiled/client/core/{createExecutorAdapter.js → executor/createExecutorAdapter.js} +3 -3
  213. package/dist/templatesCompiled/client/core/executor/requestExecutor.d.ts +8 -0
  214. package/dist/templatesCompiled/client/core/executor/requestExecutor.d.ts.map +1 -0
  215. package/dist/templatesCompiled/client/core/executor/requestExecutor.js +18 -0
  216. package/dist/templatesCompiled/client/core/interceptors/apiErrorInterceptor.d.ts +8 -0
  217. package/dist/templatesCompiled/client/core/interceptors/apiErrorInterceptor.d.ts.map +1 -0
  218. package/dist/templatesCompiled/client/core/interceptors/apiErrorInterceptor.js +18 -0
  219. package/dist/templatesCompiled/client/core/{request-executor.d.ts → interceptors/interceptors.d.ts} +2 -1
  220. package/dist/templatesCompiled/client/core/interceptors/interceptors.d.ts.map +1 -0
  221. package/dist/templatesCompiled/client/core/interceptors/interceptors.js +18 -0
  222. package/dist/templatesCompiled/client/core/interceptors/withInterceptors.d.ts +8 -0
  223. package/dist/templatesCompiled/client/core/interceptors/withInterceptors.d.ts.map +1 -0
  224. package/dist/templatesCompiled/client/core/interceptors/withInterceptors.js +18 -0
  225. package/dist/templatesCompiled/client/exportClient.d.ts.map +1 -1
  226. package/dist/templatesCompiled/client/exportClient.js +14 -10
  227. package/dist/templatesCompiled/client/exportService.js +1 -1
  228. package/dist/templatesCompiled/client/indexCore.js +2 -2
  229. package/dist/templatesCompiled/client/indexFull.js +2 -2
  230. package/dist/templatesCompiled/client/partials/exportComposition.d.ts +2 -0
  231. package/dist/templatesCompiled/client/partials/exportComposition.d.ts.map +1 -1
  232. package/dist/templatesCompiled/client/partials/exportComposition.js +17 -9
  233. package/package.json +1 -1
  234. package/dist/cli/validation/errorFormatter.d.ts +0 -6
  235. package/dist/cli/validation/errorFormatter.d.ts.map +0 -1
  236. package/dist/cli/validation/index.d.ts +0 -3
  237. package/dist/cli/validation/index.d.ts.map +0 -1
  238. package/dist/cli/validation/validateCLIOptions.d.ts.map +0 -1
  239. package/dist/common/VersionedSchema/Utils/getErrorFieldsFromValidation.d.ts +0 -6
  240. package/dist/common/VersionedSchema/Utils/getErrorFieldsFromValidation.d.ts.map +0 -1
  241. package/dist/common/VersionedSchema/Utils/getErrorFieldsFromValidation.js +0 -7
  242. package/dist/common/VersionedSchema/Utils/joiHandlers.d.ts +0 -6
  243. package/dist/common/VersionedSchema/Utils/joiHandlers.d.ts.map +0 -1
  244. package/dist/common/VersionedSchema/Utils/joiHandlers.js +0 -59
  245. package/dist/common/VersionedSchema/Utils/mergeObjectSchemas.d.ts +0 -3
  246. package/dist/common/VersionedSchema/Utils/mergeObjectSchemas.d.ts.map +0 -1
  247. package/dist/common/VersionedSchema/Utils/mergeObjectSchemas.js +0 -12
  248. package/dist/common/VersionedSchema/Utils/traverseObjectStructure.d.ts +0 -3
  249. package/dist/common/VersionedSchema/Utils/traverseObjectStructure.d.ts.map +0 -1
  250. package/dist/common/VersionedSchema/Utils/traverseObjectStructure.js +0 -31
  251. package/dist/common/schemas/configSchemas.d.ts +0 -91
  252. package/dist/common/schemas/configSchemas.d.ts.map +0 -1
  253. package/dist/common/schemas/configSchemas.js +0 -131
  254. package/dist/common/utils/__tests__/__mock__/mockJoiSchema.d.ts +0 -19
  255. package/dist/common/utils/__tests__/__mock__/mockJoiSchema.d.ts.map +0 -1
  256. package/dist/common/utils/__tests__/__mock__/mockJoiSchema.js +0 -14
  257. package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.d.ts +0 -2
  258. package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.d.ts.map +0 -1
  259. package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.js +0 -38
  260. package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.d.ts +0 -2
  261. package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.d.ts.map +0 -1
  262. package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.js +0 -20
  263. package/dist/common/utils/__tests__/mergeObjectSchemas.test.d.ts +0 -2
  264. package/dist/common/utils/__tests__/mergeObjectSchemas.test.d.ts.map +0 -1
  265. package/dist/common/utils/__tests__/mergeObjectSchemas.test.js +0 -35
  266. package/dist/common/utils/__tests__/migrationForMultiOptions.test.d.ts +0 -2
  267. package/dist/common/utils/__tests__/migrationForMultiOptions.test.d.ts.map +0 -1
  268. package/dist/common/utils/__tests__/migrationForMultiOptions.test.js +0 -112
  269. package/dist/common/utils/__tests__/migrationForOptions.test.d.ts +0 -2
  270. package/dist/common/utils/__tests__/migrationForOptions.test.d.ts.map +0 -1
  271. package/dist/common/utils/__tests__/migrationForOptions.test.js +0 -56
  272. package/dist/core/utils/__tests__/getRelativeModelPath.test.d.ts +0 -2
  273. package/dist/core/utils/__tests__/getRelativeModelPath.test.d.ts.map +0 -1
  274. package/dist/core/utils/__tests__/getRelativeModelPath.test.js +0 -21
  275. package/dist/core/utils/getRelativeModelPath.d.ts +0 -9
  276. package/dist/core/utils/getRelativeModelPath.d.ts.map +0 -1
  277. package/dist/core/utils/getRelativeModelPath.js +0 -37
  278. package/dist/templatesCompiled/client/core/createExecutorAdapter.d.ts.map +0 -1
  279. package/dist/templatesCompiled/client/core/request-executor.d.ts.map +0 -1
  280. package/dist/templatesCompiled/client/core/request-executor.js +0 -11
  281. /package/dist/templatesCompiled/client/core/{createExecutorAdapter.d.ts → executor/createExecutorAdapter.d.ts} +0 -0
@@ -55,6 +55,9 @@ const WriteClient_1 = require("../WriteClient");
55
55
  httpStatusCode: () => 'httpStatusCode',
56
56
  createExecutorAdapter: () => 'createExecutorAdapter',
57
57
  requestExecutor: () => 'requestExecutor',
58
+ apiErrorInterceptor: () => 'apiErrorInterceptor',
59
+ interceptors: () => 'interceptors',
60
+ withInterceptors: () => 'withInterceptors'
58
61
  },
59
62
  };
60
63
  const outputPaths = (0, getOutputPaths_1.getOutputPaths)({ output: './dist' });
@@ -15,7 +15,7 @@ export declare class Parser {
15
15
  _context: Context;
16
16
  constructor(context: Context);
17
17
  get context(): Context;
18
- getTypeNameByRef(value: string, ref?: string): string;
18
+ getTypeNameByRef(value: string, ref: string, parentSourceFile?: string): string;
19
19
  parse: typeof parse;
20
20
  getModels: typeof getModels;
21
21
  getType: typeof getType;
@@ -1 +1 @@
1
- {"version":3,"file":"Parser.d.ts","sourceRoot":"","sources":["../../../../src/core/api/v2/Parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,qBAAa,MAAM;IACR,QAAQ,EAAE,OAAO,CAAC;gBAEb,OAAO,EAAE,OAAO;IAI5B,IAAI,OAAO,IAAI,OAAO,CAErB;IAEM,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM;IASrD,KAAK,eAAS;IACd,SAAS,mBAAa;IACtB,OAAO,iBAAW;IAClB,QAAQ,kBAAY;IACpB,mBAAmB,6BAAuB;IAC1C,kBAAkB,4BAAsB;IACxC,WAAW,qBAAe;IAC1B,sBAAsB,gCAA0B;IAChD,qBAAqB,+BAAyB;IAC9C,YAAY,sBAAgB;IAC5B,qBAAqB,+BAAyB;IAC9C,oBAAoB,8BAAwB;CACtD"}
1
+ {"version":3,"file":"Parser.d.ts","sourceRoot":"","sources":["../../../../src/core/api/v2/Parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,qBAAa,MAAM;IACR,QAAQ,EAAE,OAAO,CAAC;gBAEb,OAAO,EAAE,OAAO;IAI5B,IAAI,OAAO,IAAI,OAAO,CAErB;IAEM,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;IAS/E,KAAK,eAAS;IACd,SAAS,mBAAa;IACtB,OAAO,iBAAW;IAClB,QAAQ,kBAAY;IACpB,mBAAmB,6BAAuB;IAC1C,kBAAkB,4BAAsB;IACxC,WAAW,qBAAe;IAC1B,sBAAsB,gCAA0B;IAChD,qBAAqB,+BAAyB;IAC9C,YAAY,sBAAgB;IAC5B,qBAAqB,+BAAyB;IAC9C,oBAAoB,8BAAwB;CACtD"}
@@ -22,9 +22,9 @@ class Parser {
22
22
  get context() {
23
23
  return this._context;
24
24
  }
25
- getTypeNameByRef(value, ref) {
25
+ getTypeNameByRef(value, ref, parentSourceFile) {
26
26
  if (ref) {
27
- const definition = this.context.get(ref);
27
+ const definition = this.context.get(ref, parentSourceFile);
28
28
  return (0, getModelNameWithPrefix_1.getModelNameWithPrefix)(value, definition, this._context.prefix);
29
29
  }
30
30
  return value;
@@ -1 +1 @@
1
- {"version":3,"file":"getModel.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAO/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,KAAK,CA2JjE"}
1
+ {"version":3,"file":"getModel.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAM/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,KAAK,CAyJjE"}
@@ -6,7 +6,6 @@ const getComment_1 = require("../../../utils/getComment");
6
6
  const getEnum_1 = require("../../../utils/getEnum");
7
7
  const getEnumFromDescription_1 = require("../../../utils/getEnumFromDescription");
8
8
  const getPattern_1 = require("../../../utils/getPattern");
9
- const normalizeRef_1 = require("../../../utils/normalizeRef");
10
9
  function getModel(config) {
11
10
  const { openApi, definition, isDefinition = false, name = '', path = '', parentRef } = config;
12
11
  const model = {
@@ -45,8 +44,7 @@ function getModel(config) {
45
44
  properties: [],
46
45
  };
47
46
  if (definition.$ref) {
48
- const normalizedRef = (0, normalizeRef_1.normalizeRef)(definition.$ref, parentRef);
49
- const definitionRef = this.getType(definition.$ref, normalizedRef);
47
+ const definitionRef = this.getType(definition.$ref, parentRef);
50
48
  model.export = 'reference';
51
49
  model.type = definitionRef.type;
52
50
  model.base = definitionRef.base;
@@ -77,8 +75,7 @@ function getModel(config) {
77
75
  }
78
76
  if (definition.type === 'array' && definition.items) {
79
77
  if (definition.items.$ref) {
80
- const normalizedRef = (0, normalizeRef_1.normalizeRef)(definition.items.$ref, parentRef);
81
- const arrayItems = this.getType(definition.items.$ref, normalizedRef);
78
+ const arrayItems = this.getType(definition.items.$ref, parentRef);
82
79
  model.export = 'array';
83
80
  model.type = arrayItems.type;
84
81
  model.base = arrayItems.base;
@@ -1 +1 @@
1
- {"version":3,"file":"getModelProperties.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getModelProperties.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAK/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,KAAK,EAAE,CAiFxH"}
1
+ {"version":3,"file":"getModelProperties.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getModelProperties.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAI/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,KAAK,EAAE,CAgFxH"}
@@ -5,7 +5,6 @@ const safeHasOwn_1 = require("../../../../common/utils/safeHasOwn");
5
5
  const escapeName_1 = require("../../../utils/escapeName");
6
6
  const getComment_1 = require("../../../utils/getComment");
7
7
  const getPattern_1 = require("../../../utils/getPattern");
8
- const normalizeRef_1 = require("../../../utils/normalizeRef");
9
8
  function getModelProperties(openApi, definition, parentRef) {
10
9
  const models = [];
11
10
  for (const propertyName in definition.properties) {
@@ -13,8 +12,7 @@ function getModelProperties(openApi, definition, parentRef) {
13
12
  const property = definition.properties[propertyName];
14
13
  const propertyRequired = definition.required?.includes(propertyName) || property.default !== undefined;
15
14
  if (property.$ref) {
16
- const normalizedRef = (0, normalizeRef_1.normalizeRef)(property.$ref, parentRef);
17
- const model = this.getType(property.$ref, normalizedRef);
15
+ const model = this.getType(property.$ref, parentRef);
18
16
  models.push({
19
17
  name: (0, escapeName_1.escapeName)(propertyName),
20
18
  alias: '',
@@ -1 +1 @@
1
- {"version":3,"file":"getModels.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getModels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAK/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,CAsBjE"}
1
+ {"version":3,"file":"getModels.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getModels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAI/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,CAsBjE"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getModels = getModels;
4
- const getModelNameWithPrefix_1 = require("../../../utils/getModelNameWithPrefix");
5
4
  const modelHelpers_1 = require("../../../utils/modelHelpers");
6
5
  const sortModelsByName_1 = require("../../../utils/sortModelsByName");
7
6
  const unique_1 = require("../../../utils/unique");
@@ -16,7 +15,7 @@ function getModels(openApi) {
16
15
  openApi: openApi,
17
16
  definition: definition,
18
17
  isDefinition: true,
19
- name: (0, getModelNameWithPrefix_1.getModelNameWithPrefix)(definitionType.base, definition, this.context.prefix),
18
+ name: definitionType.base,
20
19
  path: definitionType.path,
21
20
  parentRef: modelRef,
22
21
  });
@@ -1 +1 @@
1
- {"version":3,"file":"getOperationParameter.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getOperationParameter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAQzF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGxE,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,GAAG,kBAAkB,CAwIxI"}
1
+ {"version":3,"file":"getOperationParameter.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getOperationParameter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAOzF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGxE,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,GAAG,kBAAkB,CAsIxI"}
@@ -7,7 +7,6 @@ const getEnum_1 = require("../../../utils/getEnum");
7
7
  const getEnumFromDescription_1 = require("../../../utils/getEnumFromDescription");
8
8
  const getOperationParameterName_1 = require("../../../utils/getOperationParameterName");
9
9
  const getPattern_1 = require("../../../utils/getPattern");
10
- const normalizeRef_1 = require("../../../utils/normalizeRef");
11
10
  const getOperationParameterDefault_1 = require("./getOperationParameterDefault");
12
11
  function getOperationParameter(openApi, parameter, parentRef) {
13
12
  const operationParameter = {
@@ -45,8 +44,7 @@ function getOperationParameter(openApi, parameter, parentRef) {
45
44
  mediaType: null,
46
45
  };
47
46
  if (parameter.$ref) {
48
- const normalizedRef = (0, normalizeRef_1.normalizeRef)(parameter.$ref, parentRef);
49
- const definitionRef = this.getType(parameter.$ref, normalizedRef);
47
+ const definitionRef = this.getType(parameter.$ref, parentRef);
50
48
  operationParameter.export = 'reference';
51
49
  operationParameter.type = definitionRef.type;
52
50
  operationParameter.base = definitionRef.base;
@@ -101,8 +99,7 @@ function getOperationParameter(openApi, parameter, parentRef) {
101
99
  }
102
100
  if (parameter.schema) {
103
101
  if (parameter.schema.$ref) {
104
- const normalizedRef = (0, normalizeRef_1.normalizeRef)(parameter.schema.$ref, parentRef);
105
- const model = this.getType(parameter.schema.$ref, normalizedRef);
102
+ const model = this.getType(parameter.schema.$ref, parentRef);
106
103
  operationParameter.export = 'reference';
107
104
  operationParameter.type = model.type;
108
105
  operationParameter.base = model.base;
@@ -16,7 +16,7 @@ function getOperationParameters(openApi, parameters, parentRef) {
16
16
  };
17
17
  // Iterate over the parameters
18
18
  parameters.forEach(parameterOrReference => {
19
- const parameterDef = (parameterOrReference.$ref ? this.context.get(parameterOrReference.$ref) : parameterOrReference);
19
+ const parameterDef = (parameterOrReference.$ref ? this.context.get(parameterOrReference.$ref, parentRef) : parameterOrReference);
20
20
  const parameter = this.getOperationParameter(openApi, parameterDef, parentRef);
21
21
  // We ignore the "api-version" param, since we do not want to add this
22
22
  // as the first / default parameter for each of the service calls.
@@ -1 +1 @@
1
- {"version":3,"file":"getOperationResponse.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getOperationResponse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAIvF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB,CAoF1J"}
1
+ {"version":3,"file":"getOperationResponse.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getOperationResponse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAGvF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB,CAmF1J"}
@@ -4,7 +4,6 @@ exports.getOperationResponse = getOperationResponse;
4
4
  const safeHasOwn_1 = require("../../../../common/utils/safeHasOwn");
5
5
  const getComment_1 = require("../../../utils/getComment");
6
6
  const getPattern_1 = require("../../../utils/getPattern");
7
- const normalizeRef_1 = require("../../../utils/normalizeRef");
8
7
  function getOperationResponse(openApi, response, responseCode, parentRef) {
9
8
  const operationResponse = {
10
9
  in: 'response',
@@ -33,8 +32,7 @@ function getOperationResponse(openApi, response, responseCode, parentRef) {
33
32
  // then we need to parse the schema!
34
33
  if (response.schema) {
35
34
  if (response.schema.$ref) {
36
- const normalizedRef = (0, normalizeRef_1.normalizeRef)(response.schema.$ref, parentRef);
37
- const model = this.getType(response.schema.$ref, normalizedRef);
35
+ const model = this.getType(response.schema.$ref, parentRef);
38
36
  operationResponse.export = 'reference';
39
37
  operationResponse.type = model.type;
40
38
  operationResponse.base = model.base;
@@ -10,7 +10,7 @@ function getOperationResponses(openApi, responses, parentRef) {
10
10
  for (const code in responses) {
11
11
  if ((0, safeHasOwn_1.safeHasOwn)(responses, code)) {
12
12
  const responseOrReference = responses[code];
13
- const response = (responseOrReference.$ref ? this.context.get(responseOrReference.$ref) : responseOrReference);
13
+ const response = (responseOrReference.$ref ? this.context.get(responseOrReference.$ref, parentRef) : responseOrReference);
14
14
  const responseCode = (0, getOperationResponseCode_1.getOperationResponseCode)(code);
15
15
  if (responseCode) {
16
16
  const operationResponse = this.getOperationResponse(openApi, response, responseCode, parentRef);
@@ -1 +1 @@
1
- {"version":3,"file":"getServices.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getServices.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAKtD;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,EAAE,CAgCrE"}
1
+ {"version":3,"file":"getServices.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getServices.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAKtD;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,EAAE,CAiCrE"}
@@ -14,9 +14,10 @@ function getServices(openApi) {
14
14
  if ((0, safeHasOwn_1.safeHasOwn)(openApi.paths, url)) {
15
15
  // Grab path and parse any global path parameters
16
16
  const pathByUrl = openApi.paths[url];
17
- const path = (pathByUrl.$ref ? this.context.get(pathByUrl.$ref) : pathByUrl);
18
- const pathParams = this.getOperationParameters(openApi, path.parameters || [], '');
19
- const parentFileRef = pathByUrl.$ref || this.context.root?.path || '';
17
+ const rootPath = this.context.root?.path || '';
18
+ const path = (pathByUrl.$ref ? this.context.get(pathByUrl.$ref, rootPath) : pathByUrl);
19
+ const parentFileRef = pathByUrl.$ref || rootPath;
20
+ const pathParams = this.getOperationParameters(openApi, path.parameters || [], parentFileRef);
20
21
  // Parse all the methods for this path
21
22
  (0, serviceHelpers_1.forEachOperationInPath)(path, (method, op) => {
22
23
  // Each method contains an OpenAPI operation, we parse the operation
@@ -1 +1 @@
1
- {"version":3,"file":"getType.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getType.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAK7D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CA4C5E"}
1
+ {"version":3,"file":"getType.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getType.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAK7D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CA6C5E"}
@@ -35,7 +35,7 @@ function getType(value, parentRef) {
35
35
  * В этом случае надо брать непосредственно normalizedValue - это относительный путь или фрагмент.
36
36
  * Предполагаем, что в таком случае расчитывать нет нужды. Это путь от папки outputModels
37
37
  */
38
- const canonicalValue = this.context.resolveCanonicalRef(normalizedValue);
38
+ const canonicalValue = this.context.resolveCanonicalRef(normalizedValue, parentRef);
39
39
  let valuePath = valueClean;
40
40
  if (canonicalValue) {
41
41
  const refValuePath = canonicalValue?.fragment ? `${canonicalValue.outputFile}${canonicalValue.fragment}` : canonicalValue?.outputFile || '';
@@ -43,7 +43,7 @@ function getType(value, parentRef) {
43
43
  valuePath = (0, pathHelpers_1.relativeHelper)(this.context.output?.outputModels, cleanedRefValuePath);
44
44
  }
45
45
  valuePath = !valuePath.startsWith('./') && !valuePath.startsWith('../') ? `./${valuePath}` : valuePath;
46
- const type = this.getTypeNameByRef((0, getTypeName_1.getTypeName)(valueClean), parentRef);
46
+ const type = this.getTypeNameByRef((0, getTypeName_1.getTypeName)(valueClean), normalizedValue, parentRef);
47
47
  const valueImportPath = !valuePath.startsWith('./') ? `./${valuePath}` : valuePath;
48
48
  result.path = valuePath;
49
49
  result.type = type;
@@ -16,7 +16,7 @@ export declare class Parser {
16
16
  private _context;
17
17
  constructor(context: Context);
18
18
  get context(): Context;
19
- getTypeNameByRef(value: string, ref?: string): string;
19
+ getTypeNameByRef(value: string, ref: string, parentSourceFile?: string): string;
20
20
  parse: typeof parse;
21
21
  getModels: typeof getModels;
22
22
  getType: typeof getType;
@@ -1 +1 @@
1
- {"version":3,"file":"Parser.d.ts","sourceRoot":"","sources":["../../../../src/core/api/v3/Parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,qBAAa,MAAM;IACf,OAAO,CAAC,QAAQ,CAAU;gBAEd,OAAO,EAAE,OAAO;IAI5B,IAAI,OAAO,IAAI,OAAO,CAErB;IAEM,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM;IASrD,KAAK,eAAS;IACd,SAAS,mBAAa;IACtB,OAAO,iBAAW;IAClB,QAAQ,kBAAY;IACpB,mBAAmB,6BAAuB;IAC1C,kBAAkB,4BAAsB;IACxC,WAAW,qBAAe;IAC1B,sBAAsB,gCAA0B;IAChD,qBAAqB,+BAAyB;IAC9C,YAAY,sBAAgB;IAC5B,qBAAqB,+BAAyB;IAC9C,oBAAoB,8BAAwB;IAC5C,uBAAuB,iCAA2B;CAC5D"}
1
+ {"version":3,"file":"Parser.d.ts","sourceRoot":"","sources":["../../../../src/core/api/v3/Parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,qBAAa,MAAM;IACf,OAAO,CAAC,QAAQ,CAAU;gBAEd,OAAO,EAAE,OAAO;IAI5B,IAAI,OAAO,IAAI,OAAO,CAErB;IAEM,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;IAS/E,KAAK,eAAS;IACd,SAAS,mBAAa;IACtB,OAAO,iBAAW;IAClB,QAAQ,kBAAY;IACpB,mBAAmB,6BAAuB;IAC1C,kBAAkB,4BAAsB;IACxC,WAAW,qBAAe;IAC1B,sBAAsB,gCAA0B;IAChD,qBAAqB,+BAAyB;IAC9C,YAAY,sBAAgB;IAC5B,qBAAqB,+BAAyB;IAC9C,oBAAoB,8BAAwB;IAC5C,uBAAuB,iCAA2B;CAC5D"}
@@ -23,9 +23,9 @@ class Parser {
23
23
  get context() {
24
24
  return this._context;
25
25
  }
26
- getTypeNameByRef(value, ref) {
26
+ getTypeNameByRef(value, ref, parentSourceFile) {
27
27
  if (ref) {
28
- const definition = this.context.get(ref);
28
+ const definition = this.context.get(ref, parentSourceFile);
29
29
  return (0, getModelNameWithPrefix_1.getModelNameWithPrefix)(value, definition, this._context.prefix);
30
30
  }
31
31
  return value;
@@ -1 +1 @@
1
- {"version":3,"file":"getModel.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v3/parser/getModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAO/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGzD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,KAAK,CAkLjE"}
1
+ {"version":3,"file":"getModel.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v3/parser/getModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAM/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGzD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,KAAK,CAgLjE"}
@@ -6,7 +6,6 @@ const getComment_1 = require("../../../utils/getComment");
6
6
  const getEnum_1 = require("../../../utils/getEnum");
7
7
  const getEnumFromDescription_1 = require("../../../utils/getEnumFromDescription");
8
8
  const getPattern_1 = require("../../../utils/getPattern");
9
- const normalizeRef_1 = require("../../../utils/normalizeRef");
10
9
  const getModelDefault_1 = require("./getModelDefault");
11
10
  function getModel(config) {
12
11
  const { openApi, definition, isDefinition = false, name = '', path = '', parentRef } = config;
@@ -44,8 +43,7 @@ function getModel(config) {
44
43
  properties: [],
45
44
  };
46
45
  if (definition.$ref) {
47
- const normalizedRef = (0, normalizeRef_1.normalizeRef)(definition.$ref, parentRef);
48
- const definitionRef = this.getType(definition.$ref, normalizedRef);
46
+ const definitionRef = this.getType(definition.$ref, parentRef);
49
47
  model.export = 'reference';
50
48
  model.type = definitionRef.type;
51
49
  model.base = definitionRef.base;
@@ -78,8 +76,7 @@ function getModel(config) {
78
76
  }
79
77
  if (definition.type === 'array' && definition.items) {
80
78
  if (definition.items.$ref) {
81
- const normalizedRef = (0, normalizeRef_1.normalizeRef)(definition.items.$ref, parentRef);
82
- const arrayItems = this.getType(definition.items.$ref, normalizedRef);
79
+ const arrayItems = this.getType(definition.items.$ref, parentRef);
83
80
  model.export = 'array';
84
81
  model.type = arrayItems.type;
85
82
  model.base = arrayItems.base;
@@ -1 +1 @@
1
- {"version":3,"file":"getModelProperties.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v3/parser/getModelProperties.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAM/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,KAAK,EAAE,CAkFxH"}
1
+ {"version":3,"file":"getModelProperties.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v3/parser/getModelProperties.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAK/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,KAAK,EAAE,CAiFxH"}
@@ -6,7 +6,6 @@ const escapeName_1 = require("../../../utils/escapeName");
6
6
  const getClassName_1 = require("../../../utils/getClassName");
7
7
  const getComment_1 = require("../../../utils/getComment");
8
8
  const getPattern_1 = require("../../../utils/getPattern");
9
- const normalizeRef_1 = require("../../../utils/normalizeRef");
10
9
  function getModelProperties(openApi, definition, parentRef) {
11
10
  const models = [];
12
11
  for (const propertyName in definition.properties) {
@@ -14,8 +13,7 @@ function getModelProperties(openApi, definition, parentRef) {
14
13
  const property = definition.properties[propertyName];
15
14
  const propertyRequired = definition.required?.includes(propertyName) || property.default !== undefined;
16
15
  if (property.$ref) {
17
- const normalizedRef = (0, normalizeRef_1.normalizeRef)(property.$ref, parentRef);
18
- const model = this.getType(property.$ref, normalizedRef);
16
+ const model = this.getType(property.$ref, parentRef);
19
17
  models.push({
20
18
  name: (0, escapeName_1.escapeName)(propertyName),
21
19
  alias: '',
@@ -1 +1 @@
1
- {"version":3,"file":"getModels.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v3/parser/getModels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAK/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,CAsBjE"}
1
+ {"version":3,"file":"getModels.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v3/parser/getModels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAI/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,CAsBjE"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getModels = getModels;
4
- const getModelNameWithPrefix_1 = require("../../../utils/getModelNameWithPrefix");
5
4
  const modelHelpers_1 = require("../../../utils/modelHelpers");
6
5
  const sortModelsByName_1 = require("../../../utils/sortModelsByName");
7
6
  const unique_1 = require("../../../utils/unique");
@@ -16,7 +15,7 @@ function getModels(openApi) {
16
15
  openApi: openApi,
17
16
  definition: definition,
18
17
  isDefinition: true,
19
- name: (0, getModelNameWithPrefix_1.getModelNameWithPrefix)(definitionType.base, definition, this.context.prefix),
18
+ name: definitionType.base,
20
19
  path: definitionType.path,
21
20
  parentRef: modelRef,
22
21
  });
@@ -48,7 +48,7 @@ function getOperation(openApi, url, method, op, pathParams, serviceClassName, pa
48
48
  }
49
49
  if (op.requestBody) {
50
50
  const sortByRequired = this.context.sortByRequired ? sortByRequiredExtended_1.sortByRequiredExtended : sortByRequiredSimple_1.sortByRequiredSimple;
51
- const requestBodyDef = (op.requestBody.$ref ? this.context.get(op.requestBody.$ref) : op.requestBody);
51
+ const requestBodyDef = (op.requestBody.$ref ? this.context.get(op.requestBody.$ref, parentFileRef) : op.requestBody);
52
52
  const requestBody = this.getOperationRequestBody(openApi, requestBodyDef, parentFileRef);
53
53
  operation.imports.push(...requestBody.imports);
54
54
  operation.parameters.push(requestBody);
@@ -1 +1 @@
1
- {"version":3,"file":"getOperationParameter.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v3/parser/getOperationParameter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAKzF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGxE,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,GAAG,kBAAkB,CAgFxI"}
1
+ {"version":3,"file":"getOperationParameter.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v3/parser/getOperationParameter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAIzF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGxE,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,GAAG,kBAAkB,CA8ExI"}
@@ -4,7 +4,6 @@ exports.getOperationParameter = getOperationParameter;
4
4
  const getComment_1 = require("../../../utils/getComment");
5
5
  const getOperationParameterName_1 = require("../../../utils/getOperationParameterName");
6
6
  const getPattern_1 = require("../../../utils/getPattern");
7
- const normalizeRef_1 = require("../../../utils/normalizeRef");
8
7
  const getModelDefault_1 = require("./getModelDefault");
9
8
  function getOperationParameter(openApi, parameter, parentRef) {
10
9
  const operationParameter = {
@@ -30,8 +29,7 @@ function getOperationParameter(openApi, parameter, parentRef) {
30
29
  mediaType: null,
31
30
  };
32
31
  if (parameter.$ref) {
33
- const normalizedRef = (0, normalizeRef_1.normalizeRef)(parameter.$ref, parentRef);
34
- const definitionRef = this.getType(parameter.$ref, normalizedRef);
32
+ const definitionRef = this.getType(parameter.$ref, parentRef);
35
33
  operationParameter.export = 'reference';
36
34
  operationParameter.type = definitionRef.type;
37
35
  operationParameter.base = definitionRef.base;
@@ -41,8 +39,7 @@ function getOperationParameter(openApi, parameter, parentRef) {
41
39
  }
42
40
  if (parameter.schema) {
43
41
  if (parameter.schema.$ref) {
44
- const normalizedRef = (0, normalizeRef_1.normalizeRef)(parameter.schema.$ref, parentRef);
45
- const model = this.getType(parameter.schema.$ref, normalizedRef);
42
+ const model = this.getType(parameter.schema.$ref, parentRef);
46
43
  operationParameter.export = 'reference';
47
44
  operationParameter.type = model.type;
48
45
  operationParameter.base = model.base;
@@ -16,7 +16,7 @@ function getOperationParameters(openApi, parameters, parentRef) {
16
16
  };
17
17
  // Iterate over the parameters
18
18
  parameters.forEach(parameterOrReference => {
19
- const parameterDef = (parameterOrReference.$ref ? this.context.get(parameterOrReference.$ref) : parameterOrReference);
19
+ const parameterDef = (parameterOrReference.$ref ? this.context.get(parameterOrReference.$ref, parentRef) : parameterOrReference);
20
20
  const parameter = this.getOperationParameter(openApi, parameterDef, parentRef);
21
21
  // We ignore the "api-version" param, since we do not want to add this
22
22
  // as the first / default parameter for each of the service calls.
@@ -1 +1 @@
1
- {"version":3,"file":"getOperationRequestBody.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v3/parser/getOperationRequestBody.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAIzF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAG5E,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,GAAG,kBAAkB,CA8E5I"}
1
+ {"version":3,"file":"getOperationRequestBody.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v3/parser/getOperationRequestBody.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAGzF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAG5E,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,GAAG,kBAAkB,CA6E5I"}
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getOperationRequestBody = getOperationRequestBody;
4
4
  const getComment_1 = require("../../../utils/getComment");
5
5
  const getPattern_1 = require("../../../utils/getPattern");
6
- const normalizeRef_1 = require("../../../utils/normalizeRef");
7
6
  const getContent_1 = require("./getContent");
8
7
  function getOperationRequestBody(openApi, parameter, parentRef) {
9
8
  const requestBody = {
@@ -38,8 +37,7 @@ function getOperationRequestBody(openApi, parameter, parentRef) {
38
37
  (requestBody.in = 'formData'), (requestBody.name = 'formData'), (requestBody.prop = 'formData');
39
38
  }
40
39
  if (content?.schema?.$ref) {
41
- const normalizedRef = (0, normalizeRef_1.normalizeRef)(content.schema.$ref, parentRef);
42
- const model = this.getType(content.schema.$ref, normalizedRef);
40
+ const model = this.getType(content.schema.$ref, parentRef);
43
41
  requestBody.export = 'reference';
44
42
  requestBody.type = model.type;
45
43
  requestBody.base = model.base;
@@ -1 +1 @@
1
- {"version":3,"file":"getOperationResponse.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v3/parser/getOperationResponse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAIvF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGtE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB,CAqF1J"}
1
+ {"version":3,"file":"getOperationResponse.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v3/parser/getOperationResponse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAGvF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGtE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB,CAoF1J"}
@@ -4,7 +4,6 @@ exports.getOperationResponse = getOperationResponse;
4
4
  const safeHasOwn_1 = require("../../../../common/utils/safeHasOwn");
5
5
  const getComment_1 = require("../../../utils/getComment");
6
6
  const getPattern_1 = require("../../../utils/getPattern");
7
- const normalizeRef_1 = require("../../../utils/normalizeRef");
8
7
  const getContent_1 = require("./getContent");
9
8
  function getOperationResponse(openApi, response, responseCode, parentRef) {
10
9
  const operationResponse = {
@@ -32,8 +31,7 @@ function getOperationResponse(openApi, response, responseCode, parentRef) {
32
31
  const content = (0, getContent_1.getContent)(response.content);
33
32
  if (content) {
34
33
  if (content?.schema?.$ref) {
35
- const normalizedRef = (0, normalizeRef_1.normalizeRef)(content.schema.$ref, parentRef);
36
- const model = this.getType(content.schema.$ref, normalizedRef);
34
+ const model = this.getType(content.schema.$ref, parentRef);
37
35
  operationResponse.export = 'reference';
38
36
  operationResponse.type = model.type;
39
37
  operationResponse.base = model.base;
@@ -10,7 +10,7 @@ function getOperationResponses(openApi, responses, parentRef) {
10
10
  for (const code in responses) {
11
11
  if ((0, safeHasOwn_1.safeHasOwn)(responses, code)) {
12
12
  const responseOrReference = responses[code];
13
- const response = (responseOrReference.$ref ? this.context.get(responseOrReference.$ref) : responseOrReference);
13
+ const response = (responseOrReference.$ref ? this.context.get(responseOrReference.$ref, parentRef) : responseOrReference);
14
14
  const responseCode = (0, getOperationResponseCode_1.getOperationResponseCode)(code);
15
15
  if (responseCode) {
16
16
  const operationResponse = this.getOperationResponse(openApi, response, responseCode, parentRef);
@@ -1 +1 @@
1
- {"version":3,"file":"getServices.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v3/parser/getServices.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAKtD;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,EAAE,CAgCrE"}
1
+ {"version":3,"file":"getServices.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v3/parser/getServices.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAKtD;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,EAAE,CAiCrE"}
@@ -14,9 +14,10 @@ function getServices(openApi) {
14
14
  if ((0, safeHasOwn_1.safeHasOwn)(openApi.paths, url)) {
15
15
  // Grab path and parse any global path parameters
16
16
  const pathByUrl = openApi.paths[url];
17
- const path = (pathByUrl.$ref ? this.context.get(pathByUrl.$ref) : pathByUrl);
18
- const pathParams = this.getOperationParameters(openApi, path.parameters || [], '');
19
- const parentFileRef = pathByUrl.$ref || this.context.root?.path || '';
17
+ const rootPath = this.context.root?.path || '';
18
+ const path = (pathByUrl.$ref ? this.context.get(pathByUrl.$ref, rootPath) : pathByUrl);
19
+ const parentFileRef = pathByUrl.$ref || rootPath;
20
+ const pathParams = this.getOperationParameters(openApi, path.parameters || [], parentFileRef);
20
21
  // Parse all the methods for this path
21
22
  (0, serviceHelpers_1.forEachOperationInPath)(path, (method, op) => {
22
23
  // Each method contains an OpenAPI operation, we parse the operation
@@ -35,7 +35,7 @@ function getType(value, parentRef) {
35
35
  * В этом случае надо брать непосредственно normalizedValue - это относительный путь или фрагмент.
36
36
  * Предполагаем, что в таком случае расчитывать нет нужды. Это путь от папки outputModels
37
37
  */
38
- const canonicalValue = this.context.resolveCanonicalRef(normalizedValue);
38
+ const canonicalValue = this.context.resolveCanonicalRef(normalizedValue, parentRef);
39
39
  let valuePath = valueClean;
40
40
  if (canonicalValue) {
41
41
  const refValuePath = canonicalValue?.fragment ? `${canonicalValue.outputFile}${canonicalValue.fragment}` : canonicalValue?.outputFile || '';
@@ -43,7 +43,7 @@ function getType(value, parentRef) {
43
43
  valuePath = (0, pathHelpers_1.relativeHelper)(this.context.output?.outputModels, cleanedRefValuePath);
44
44
  }
45
45
  valuePath = !valuePath.startsWith('./') && !valuePath.startsWith('../') ? `./${valuePath}` : valuePath;
46
- const type = this.getTypeNameByRef((0, getTypeName_1.getTypeName)(valueClean), parentRef);
46
+ const type = this.getTypeNameByRef((0, getTypeName_1.getTypeName)(valueClean), normalizedValue, parentRef);
47
47
  const valueImportPath = !valuePath.startsWith('./') ? `./${valuePath}` : valuePath;
48
48
  result.path = valuePath;
49
49
  result.type = type;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,wBAAsB,QAAQ,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAGrE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,wBAAsB,QAAQ,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAKrE"}
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HttpClient = void 0;
4
4
  exports.generate = generate;
5
5
  const OpenApiClient_1 = require("./OpenApiClient");
6
+ const validateRawOptions_1 = require("./utils/validateRawOptions");
6
7
  var HttpClient_enum_1 = require("./types/enums/HttpClient.enum");
7
8
  Object.defineProperty(exports, "HttpClient", { enumerable: true, get: function () { return HttpClient_enum_1.HttpClient; } });
8
9
  async function generate(rawOptions) {
10
+ (0, validateRawOptions_1.validateRawOptions)(rawOptions);
9
11
  const openApiClient = new OpenApiClient_1.OpenApiClient();
10
12
  await openApiClient.generate(rawOptions);
11
13
  }
@@ -24,6 +24,9 @@ export interface Templates {
24
24
  httpStatusCode: Handlebars.TemplateDelegate;
25
25
  requestExecutor: Handlebars.TemplateDelegate;
26
26
  createExecutorAdapter: Handlebars.TemplateDelegate;
27
+ interceptors: Handlebars.TemplateDelegate;
28
+ apiErrorInterceptor: Handlebars.TemplateDelegate;
29
+ withInterceptors: Handlebars.TemplateDelegate;
27
30
  };
28
31
  }
29
32
  //# sourceMappingURL=Templates.model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Templates.model.d.ts","sourceRoot":"","sources":["../../../../src/core/types/base/Templates.model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,SAAS;IACtB,OAAO,EAAE;QACL,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAClC,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAClC,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACrC,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACzC,CAAC;IACF,OAAO,EAAE;QACL,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACnC,MAAM,EAAE,UAAU,CAAC,gBAAgB,GAAG,SAAS,CAAC;QAChD,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACxC,CAAC;IACF,IAAI,EAAE;QACF,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACtC,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACtC,iBAAiB,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC/C,SAAS,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACvC,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACrC,iBAAiB,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC/C,cAAc,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC5C,eAAe,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC7C,qBAAqB,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACtD,CAAC;CACL"}
1
+ {"version":3,"file":"Templates.model.d.ts","sourceRoot":"","sources":["../../../../src/core/types/base/Templates.model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,SAAS;IACtB,OAAO,EAAE;QACL,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAClC,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAClC,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACrC,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACzC,CAAC;IACF,OAAO,EAAE;QACL,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACnC,MAAM,EAAE,UAAU,CAAC,gBAAgB,GAAG,SAAS,CAAC;QAChD,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACxC,CAAC;IACF,IAAI,EAAE;QACF,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACtC,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACtC,iBAAiB,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC/C,SAAS,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACvC,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACrC,iBAAiB,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC/C,cAAc,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC5C,eAAe,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC7C,qBAAqB,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACnD,YAAY,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC1C,mBAAmB,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACjD,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACjD,CAAC;CACL"}
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/__mocks__/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,eAAO,MAAM,SAAS,EAAE,SA0BvB,CAAC"}
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/__mocks__/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,eAAO,MAAM,SAAS,EAAE,SA6BvB,CAAC"}
@@ -26,5 +26,8 @@ exports.templates = {
26
26
  httpStatusCode: () => 'httpStatusCode',
27
27
  createExecutorAdapter: () => 'createExecutorAdapter',
28
28
  requestExecutor: () => 'requestExecutor',
29
+ apiErrorInterceptor: () => 'apiErrorInterceptor',
30
+ interceptors: () => 'interceptors',
31
+ withInterceptors: () => 'withInterceptors',
29
32
  },
30
33
  };
@@ -7,8 +7,8 @@ const node_assert_1 = __importDefault(require("node:assert"));
7
7
  const node_test_1 = require("node:test");
8
8
  const pathHelpers_1 = require("../../../common/utils/pathHelpers");
9
9
  const isSubdirectory_1 = require("../isSubdirectory");
10
- (0, node_test_1.describe)('@unit: isSubDirectory', () => {
11
- node_test_1.test.skip('should return correct result', () => {
10
+ node_test_1.describe.skip('@unit: isSubDirectory', () => {
11
+ (0, node_test_1.test)('should return correct result', () => {
12
12
  node_assert_1.default.strictEqual((0, isSubdirectory_1.isSubDirectory)((0, pathHelpers_1.resolveHelper)('/'), (0, pathHelpers_1.resolveHelper)('/')), false);
13
13
  node_assert_1.default.strictEqual((0, isSubdirectory_1.isSubDirectory)((0, pathHelpers_1.resolveHelper)('.'), (0, pathHelpers_1.resolveHelper)('.')), false);
14
14
  node_assert_1.default.strictEqual((0, isSubdirectory_1.isSubDirectory)((0, pathHelpers_1.resolveHelper)('./project'), (0, pathHelpers_1.resolveHelper)('./project')), false);