ts-openapi-codegen 2.0.0-beta.8 → 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 (239) hide show
  1. package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts +2 -1
  2. package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts.map +1 -1
  3. package/dist/cli/checkAndUpdateConfig/checkConfig.js +14 -6
  4. package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts +2 -1
  5. package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts.map +1 -1
  6. package/dist/cli/checkAndUpdateConfig/updateConfig.js +13 -5
  7. package/dist/cli/generateOpenApiClient/generateOpenApiClient.d.ts.map +1 -1
  8. package/dist/cli/generateOpenApiClient/generateOpenApiClient.js +4 -5
  9. package/dist/cli/index.js +5 -5
  10. package/dist/cli/initOpenApiConfig/init.d.ts.map +1 -1
  11. package/dist/cli/initOpenApiConfig/init.js +5 -13
  12. package/dist/cli/initOpenApiConfig/initConfig.js +3 -3
  13. package/dist/cli/previewChanges/previewChanges.d.ts.map +1 -1
  14. package/dist/cli/previewChanges/previewChanges.js +12 -5
  15. package/dist/cli/schemas/base.d.ts +6 -1
  16. package/dist/cli/schemas/base.d.ts.map +1 -1
  17. package/dist/cli/schemas/base.js +10 -6
  18. package/dist/cli/schemas/checkConfig.d.ts +1 -1
  19. package/dist/cli/schemas/generate.d.ts +1 -25
  20. package/dist/cli/schemas/generate.d.ts.map +1 -1
  21. package/dist/cli/schemas/generate.js +21 -32
  22. package/dist/cli/schemas/index.d.ts +2 -1
  23. package/dist/cli/schemas/index.d.ts.map +1 -1
  24. package/dist/cli/schemas/index.js +1 -0
  25. package/dist/cli/schemas/init.d.ts +5 -5
  26. package/dist/cli/schemas/init.d.ts.map +1 -1
  27. package/dist/cli/schemas/init.js +4 -5
  28. package/dist/cli/schemas/previewChanges.d.ts +9 -0
  29. package/dist/cli/schemas/previewChanges.d.ts.map +1 -0
  30. package/dist/cli/schemas/previewChanges.js +11 -0
  31. package/dist/cli/schemas/updateConfig.d.ts +1 -1
  32. package/dist/common/Consts.d.ts +2 -0
  33. package/dist/common/Consts.d.ts.map +1 -1
  34. package/dist/common/Consts.js +4 -1
  35. package/dist/common/LoggerMessages.js +1 -1
  36. package/dist/common/TRawOptions.d.ts +1 -1
  37. package/dist/common/TRawOptions.d.ts.map +1 -1
  38. package/dist/common/Validation/formatZodError.d.ts +10 -0
  39. package/dist/common/Validation/formatZodError.d.ts.map +1 -0
  40. package/dist/{cli/validation/errorFormatter.js → common/Validation/formatZodError.js} +14 -13
  41. package/dist/common/Validation/index.d.ts +3 -0
  42. package/dist/common/Validation/index.d.ts.map +1 -0
  43. package/dist/{cli/validation → common/Validation}/index.js +2 -2
  44. package/dist/{cli/validation/validateCLIOptions.d.ts → common/Validation/validateZodOptions.d.ts} +4 -4
  45. package/dist/common/Validation/validateZodOptions.d.ts.map +1 -0
  46. package/dist/{cli/validation/validateCLIOptions.js → common/Validation/validateZodOptions.js} +7 -10
  47. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts +6 -1
  48. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts.map +1 -1
  49. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.js +8 -14
  50. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts +28 -0
  51. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts.map +1 -0
  52. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.js +25 -0
  53. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts +36 -6
  54. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts.map +1 -1
  55. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.js +33 -37
  56. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts +37 -6
  57. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts.map +1 -1
  58. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.js +30 -37
  59. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts +40 -0
  60. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts.map +1 -0
  61. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.js +36 -0
  62. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts +65 -0
  63. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts.map +1 -0
  64. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.js +31 -0
  65. package/dist/common/VersionedSchema/CommonSchemas.d.ts +53 -30
  66. package/dist/common/VersionedSchema/CommonSchemas.d.ts.map +1 -1
  67. package/dist/common/VersionedSchema/CommonSchemas.js +47 -72
  68. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts +25 -5
  69. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts.map +1 -1
  70. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.js +34 -17
  71. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts +25 -5
  72. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts.map +1 -1
  73. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.js +28 -19
  74. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts +25 -1
  75. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts.map +1 -1
  76. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.js +29 -2
  77. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts +25 -5
  78. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts.map +1 -1
  79. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.js +30 -14
  80. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts +23 -5
  81. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts.map +1 -1
  82. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.js +33 -18
  83. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.d.ts +3 -2
  84. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.d.ts.map +1 -1
  85. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.js +18 -11
  86. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts +22 -5
  87. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts.map +1 -1
  88. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.js +30 -12
  89. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts +22 -5
  90. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts.map +1 -1
  91. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.js +27 -13
  92. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts +22 -1
  93. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts.map +1 -1
  94. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.js +28 -2
  95. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts +22 -5
  96. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts.map +1 -1
  97. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.js +31 -12
  98. package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.d.ts +3 -2
  99. package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.d.ts.map +1 -1
  100. package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.js +15 -9
  101. package/dist/common/VersionedSchema/Types.d.ts +5 -5
  102. package/dist/common/VersionedSchema/Types.d.ts.map +1 -1
  103. package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.d.ts +16 -0
  104. package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.d.ts.map +1 -0
  105. package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.js +85 -0
  106. package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.d.ts +2 -0
  107. package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.d.ts.map +1 -0
  108. package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.js +23 -0
  109. package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.d.ts +2 -0
  110. package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.d.ts.map +1 -0
  111. package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.js +75 -0
  112. package/dist/common/VersionedSchema/Utils/buildVersionedSchema.d.ts +12 -0
  113. package/dist/common/VersionedSchema/Utils/buildVersionedSchema.d.ts.map +1 -0
  114. package/dist/common/VersionedSchema/Utils/buildVersionedSchema.js +13 -0
  115. package/dist/common/VersionedSchema/Utils/compareShapes.d.ts +16 -0
  116. package/dist/common/VersionedSchema/Utils/compareShapes.d.ts.map +1 -0
  117. package/dist/common/VersionedSchema/Utils/compareShapes.js +30 -0
  118. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts +2 -1
  119. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts.map +1 -1
  120. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.js +5 -5
  121. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts +2 -2
  122. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts.map +1 -1
  123. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.js +15 -7
  124. package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.d.ts +2 -2
  125. package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.d.ts.map +1 -1
  126. package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.js +16 -3
  127. package/dist/common/VersionedSchema/Utils/getUniqueObjectKeys.d.ts.map +1 -1
  128. package/dist/common/VersionedSchema/Utils/getUniqueObjectKeys.js +19 -2
  129. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts +2 -1
  130. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
  131. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +10 -9
  132. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts +4 -0
  133. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts.map +1 -0
  134. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.js +43 -0
  135. package/dist/common/VersionedSchema/refinements/singleOrMultiRefinement.d.ts +4 -0
  136. package/dist/common/VersionedSchema/refinements/singleOrMultiRefinement.d.ts.map +1 -0
  137. package/dist/common/VersionedSchema/refinements/singleOrMultiRefinement.js +21 -0
  138. package/dist/core/Context.d.ts +6 -5
  139. package/dist/core/Context.d.ts.map +1 -1
  140. package/dist/core/Context.js +69 -26
  141. package/dist/core/OpenApiClient.d.ts.map +1 -1
  142. package/dist/core/OpenApiClient.js +12 -8
  143. package/dist/core/api/v2/Parser.d.ts +1 -1
  144. package/dist/core/api/v2/Parser.d.ts.map +1 -1
  145. package/dist/core/api/v2/Parser.js +2 -2
  146. package/dist/core/api/v2/parser/getModel.d.ts.map +1 -1
  147. package/dist/core/api/v2/parser/getModel.js +2 -5
  148. package/dist/core/api/v2/parser/getModelProperties.d.ts.map +1 -1
  149. package/dist/core/api/v2/parser/getModelProperties.js +1 -3
  150. package/dist/core/api/v2/parser/getModels.d.ts.map +1 -1
  151. package/dist/core/api/v2/parser/getModels.js +1 -2
  152. package/dist/core/api/v2/parser/getOperationParameter.d.ts.map +1 -1
  153. package/dist/core/api/v2/parser/getOperationParameter.js +2 -5
  154. package/dist/core/api/v2/parser/getOperationParameters.js +1 -1
  155. package/dist/core/api/v2/parser/getOperationResponse.d.ts.map +1 -1
  156. package/dist/core/api/v2/parser/getOperationResponse.js +1 -3
  157. package/dist/core/api/v2/parser/getOperationResponses.js +1 -1
  158. package/dist/core/api/v2/parser/getServices.d.ts.map +1 -1
  159. package/dist/core/api/v2/parser/getServices.js +4 -3
  160. package/dist/core/api/v2/parser/getType.d.ts.map +1 -1
  161. package/dist/core/api/v2/parser/getType.js +2 -2
  162. package/dist/core/api/v3/Parser.d.ts +1 -1
  163. package/dist/core/api/v3/Parser.d.ts.map +1 -1
  164. package/dist/core/api/v3/Parser.js +2 -2
  165. package/dist/core/api/v3/parser/getModel.d.ts.map +1 -1
  166. package/dist/core/api/v3/parser/getModel.js +2 -5
  167. package/dist/core/api/v3/parser/getModelProperties.d.ts.map +1 -1
  168. package/dist/core/api/v3/parser/getModelProperties.js +1 -3
  169. package/dist/core/api/v3/parser/getModels.d.ts.map +1 -1
  170. package/dist/core/api/v3/parser/getModels.js +1 -2
  171. package/dist/core/api/v3/parser/getOperation.js +1 -1
  172. package/dist/core/api/v3/parser/getOperationParameter.d.ts.map +1 -1
  173. package/dist/core/api/v3/parser/getOperationParameter.js +2 -5
  174. package/dist/core/api/v3/parser/getOperationParameters.js +1 -1
  175. package/dist/core/api/v3/parser/getOperationRequestBody.d.ts.map +1 -1
  176. package/dist/core/api/v3/parser/getOperationRequestBody.js +1 -3
  177. package/dist/core/api/v3/parser/getOperationResponse.d.ts.map +1 -1
  178. package/dist/core/api/v3/parser/getOperationResponse.js +1 -3
  179. package/dist/core/api/v3/parser/getOperationResponses.js +1 -1
  180. package/dist/core/api/v3/parser/getServices.d.ts.map +1 -1
  181. package/dist/core/api/v3/parser/getServices.js +4 -3
  182. package/dist/core/api/v3/parser/getType.js +2 -2
  183. package/dist/core/index.d.ts.map +1 -1
  184. package/dist/core/index.js +2 -0
  185. package/dist/core/utils/__tests__/isSubdirectory.test.js +2 -2
  186. package/dist/core/utils/serviceHelpers.d.ts.map +1 -1
  187. package/dist/core/utils/serviceHelpers.js +32 -6
  188. package/dist/core/utils/validateRawOptions.d.ts +3 -0
  189. package/dist/core/utils/validateRawOptions.d.ts.map +1 -0
  190. package/dist/core/utils/validateRawOptions.js +15 -0
  191. package/dist/templatesCompiled/client/exportService.js +1 -1
  192. package/dist/templatesCompiled/client/partials/exportComposition.d.ts +2 -0
  193. package/dist/templatesCompiled/client/partials/exportComposition.d.ts.map +1 -1
  194. package/dist/templatesCompiled/client/partials/exportComposition.js +17 -9
  195. package/package.json +1 -1
  196. package/dist/cli/validation/errorFormatter.d.ts +0 -6
  197. package/dist/cli/validation/errorFormatter.d.ts.map +0 -1
  198. package/dist/cli/validation/index.d.ts +0 -3
  199. package/dist/cli/validation/index.d.ts.map +0 -1
  200. package/dist/cli/validation/validateCLIOptions.d.ts.map +0 -1
  201. package/dist/common/VersionedSchema/Utils/getErrorFieldsFromValidation.d.ts +0 -6
  202. package/dist/common/VersionedSchema/Utils/getErrorFieldsFromValidation.d.ts.map +0 -1
  203. package/dist/common/VersionedSchema/Utils/getErrorFieldsFromValidation.js +0 -7
  204. package/dist/common/VersionedSchema/Utils/joiHandlers.d.ts +0 -6
  205. package/dist/common/VersionedSchema/Utils/joiHandlers.d.ts.map +0 -1
  206. package/dist/common/VersionedSchema/Utils/joiHandlers.js +0 -59
  207. package/dist/common/VersionedSchema/Utils/mergeObjectSchemas.d.ts +0 -3
  208. package/dist/common/VersionedSchema/Utils/mergeObjectSchemas.d.ts.map +0 -1
  209. package/dist/common/VersionedSchema/Utils/mergeObjectSchemas.js +0 -12
  210. package/dist/common/VersionedSchema/Utils/traverseObjectStructure.d.ts +0 -3
  211. package/dist/common/VersionedSchema/Utils/traverseObjectStructure.d.ts.map +0 -1
  212. package/dist/common/VersionedSchema/Utils/traverseObjectStructure.js +0 -31
  213. package/dist/common/schemas/configSchemas.d.ts +0 -91
  214. package/dist/common/schemas/configSchemas.d.ts.map +0 -1
  215. package/dist/common/schemas/configSchemas.js +0 -131
  216. package/dist/common/utils/__tests__/__mock__/mockJoiSchema.d.ts +0 -19
  217. package/dist/common/utils/__tests__/__mock__/mockJoiSchema.d.ts.map +0 -1
  218. package/dist/common/utils/__tests__/__mock__/mockJoiSchema.js +0 -14
  219. package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.d.ts +0 -2
  220. package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.d.ts.map +0 -1
  221. package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.js +0 -38
  222. package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.d.ts +0 -2
  223. package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.d.ts.map +0 -1
  224. package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.js +0 -20
  225. package/dist/common/utils/__tests__/mergeObjectSchemas.test.d.ts +0 -2
  226. package/dist/common/utils/__tests__/mergeObjectSchemas.test.d.ts.map +0 -1
  227. package/dist/common/utils/__tests__/mergeObjectSchemas.test.js +0 -35
  228. package/dist/common/utils/__tests__/migrationForMultiOptions.test.d.ts +0 -2
  229. package/dist/common/utils/__tests__/migrationForMultiOptions.test.d.ts.map +0 -1
  230. package/dist/common/utils/__tests__/migrationForMultiOptions.test.js +0 -112
  231. package/dist/common/utils/__tests__/migrationForOptions.test.d.ts +0 -2
  232. package/dist/common/utils/__tests__/migrationForOptions.test.d.ts.map +0 -1
  233. package/dist/common/utils/__tests__/migrationForOptions.test.js +0 -56
  234. package/dist/core/utils/__tests__/getRelativeModelPath.test.d.ts +0 -2
  235. package/dist/core/utils/__tests__/getRelativeModelPath.test.d.ts.map +0 -1
  236. package/dist/core/utils/__tests__/getRelativeModelPath.test.js +0 -21
  237. package/dist/core/utils/getRelativeModelPath.d.ts +0 -9
  238. package/dist/core/utils/getRelativeModelPath.d.ts.map +0 -1
  239. package/dist/core/utils/getRelativeModelPath.js +0 -37
@@ -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
  }
@@ -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);
@@ -1 +1 @@
1
- {"version":3,"file":"serviceHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/serviceHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAK7D;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAOhH;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAWxG;AAED;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI,CAMvF;AAcD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAiChE"}
1
+ {"version":3,"file":"serviceHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/serviceHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAK7D;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAOhH;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAWxG;AAED;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI,CAMvF;AA+CD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAiChE"}
@@ -63,13 +63,39 @@ function mergeOperationImportsIntoService(service, operation) {
63
63
  /**
64
64
  * Internal helper: apply alias value to models that reference the import.
65
65
  */
66
+ function normalizeImportPath(path) {
67
+ return path.startsWith('./') ? path.slice(2) : path;
68
+ }
69
+ function applyAliasToModel(model, value) {
70
+ const modelPath = normalizeImportPath(model.path);
71
+ const importPath = normalizeImportPath(value.path);
72
+ if (modelPath === importPath && model.type === value.name && value.alias) {
73
+ model.alias = value.alias;
74
+ model.base = value.alias;
75
+ }
76
+ if (value.alias && model.imports?.some(imprt => normalizeImportPath(imprt.path) === importPath && imprt.name === value.name)) {
77
+ if (model.base === value.name) {
78
+ model.base = value.alias;
79
+ }
80
+ if (model.type === value.name) {
81
+ model.type = value.alias;
82
+ }
83
+ if (!model.alias) {
84
+ model.alias = value.alias;
85
+ }
86
+ }
87
+ if (model.link) {
88
+ applyAliasToModel(model.link, value);
89
+ }
90
+ if (model.properties?.length) {
91
+ model.properties.forEach(child => applyAliasToModel(child, value));
92
+ }
93
+ if (model.enums?.length) {
94
+ model.enums.forEach(child => applyAliasToModel(child, value));
95
+ }
96
+ }
66
97
  function fillModelsByAlias(items = [], value) {
67
- items
68
- .filter(result => result.path === value.path && result.type === value.name && value.alias)
69
- .forEach(result => {
70
- result.alias = value.alias;
71
- result.base = value.alias;
72
- });
98
+ items.forEach(item => applyAliasToModel(item, value));
73
99
  }
74
100
  /**
75
101
  * Finalize imports for a service:
@@ -0,0 +1,3 @@
1
+ import { TRawOptions } from '../../common/TRawOptions';
2
+ export declare function validateRawOptions(rawOptions: TRawOptions): void;
3
+ //# sourceMappingURL=validateRawOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateRawOptions.d.ts","sourceRoot":"","sources":["../../../src/core/utils/validateRawOptions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAKvD,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,WAAW,QASzD"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateRawOptions = validateRawOptions;
4
+ const Consts_1 = require("../../common/Consts");
5
+ const validateZodOptions_1 = require("../../common/Validation/validateZodOptions");
6
+ const UnifiedVersionedSchemas_1 = require("../../common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas");
7
+ const dependentOptionsRefinement_1 = require("../../common/VersionedSchema/refinements/dependentOptionsRefinement");
8
+ function validateRawOptions(rawOptions) {
9
+ const currentSchema = UnifiedVersionedSchemas_1.rawOptionsSchema.superRefine(dependentOptionsRefinement_1.dependentOptionsRefinement);
10
+ const validationResult = (0, validateZodOptions_1.validateZodOptions)(currentSchema, rawOptions);
11
+ if (!validationResult.success) {
12
+ Consts_1.APP_LOGGER.error(validationResult.errors.join('\n'));
13
+ process.exit(1);
14
+ }
15
+ }
@@ -180,7 +180,7 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
180
180
  + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "imports"), { "name": "if", "hash": {}, "fn": container.program(1, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 7, "column": 7 } } })) != null ? stack1 : "")
181
181
  + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(lookupProperty(data, "root"), "useCancelableRequest"), { "name": "if", "hash": {}, "fn": container.program(5, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 10, "column": 7 } } })) != null ? stack1 : "")
182
182
  + "import type { RequestExecutor, RequestConfig } from '"
183
- + ((stack1 = lookupProperty(helpers, "joinPath").call(alias1, lookupProperty(lookupProperty(data, "root"), "outputCore"), "requestExecutor", { "name": "joinPath", "hash": {}, "data": data, "loc": { "start": { "line": 11, "column": 53 }, "end": { "line": 11, "column": 102 } } })) != null ? stack1 : "")
183
+ + ((stack1 = lookupProperty(helpers, "joinPath").call(alias1, lookupProperty(lookupProperty(data, "root"), "outputCore"), "./executor/requestExecutor", { "name": "joinPath", "hash": {}, "data": data, "loc": { "start": { "line": 11, "column": 53 }, "end": { "line": 11, "column": 113 } } })) != null ? stack1 : "")
184
184
  + "';\n\n"
185
185
  + ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(depth0, "operations"), { "name": "each", "hash": {}, "fn": container.program(7, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 18, "column": 9 } } })) != null ? stack1 : "")
186
186
  + "\nexport type T"
@@ -5,6 +5,8 @@ declare const _default: {
5
5
  "5": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
6
6
  "6": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
7
7
  "8": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
8
+ "10": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
9
+ "12": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
8
10
  compiler: (string | number)[];
9
11
  main: (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
10
12
  usePartial: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"exportComposition.d.ts","sourceRoot":"","sources":["../../../../src/templatesCompiled/client/partials/exportComposition.ts"],"names":[],"mappings":";;;;;;;;;;;;AAMA,wBAuEmC"}
1
+ {"version":3,"file":"exportComposition.d.ts","sourceRoot":"","sources":["../../../../src/templatesCompiled/client/partials/exportComposition.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAMA,wBAiFmC"}
@@ -18,7 +18,7 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
18
18
  }
19
19
  return undefined;
20
20
  };
21
- return ((stack1 = lookupProperty(helpers, "unless").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(lookupProperty(data, "root"), "useUnionTypes"), { "name": "unless", "hash": {}, "fn": container.program(4, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 27, "column": 11 } } })) != null ? stack1 : "");
21
+ return ((stack1 = lookupProperty(helpers, "unless").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(lookupProperty(data, "root"), "useUnionTypes"), { "name": "unless", "hash": {}, "fn": container.program(4, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 31, "column": 11 } } })) != null ? stack1 : "");
22
22
  }, "4": function (container, depth0, helpers, partials, data) {
23
23
  var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
24
24
  if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
@@ -29,7 +29,7 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
29
29
  return "\nexport namespace "
30
30
  + ((stack1 = container.lambda(container.strict(depth0, "name", { "start": { "line": 10, "column": 20 }, "end": { "line": 10, "column": 24 } }), depth0)) != null ? stack1 : "")
31
31
  + " {\n\n"
32
- + ((stack1 = lookupProperty(helpers, "each").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "enums"), { "name": "each", "hash": {}, "fn": container.program(5, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 24, "column": 13 } } })) != null ? stack1 : "")
32
+ + ((stack1 = lookupProperty(helpers, "each").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "enums"), { "name": "each", "hash": {}, "fn": container.program(5, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 28, "column": 13 } } })) != null ? stack1 : "")
33
33
  + "\n}\n";
34
34
  }, "5": function (container, depth0, helpers, partials, data) {
35
35
  var stack1, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function (parent, propertyName) {
@@ -39,10 +39,8 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
39
39
  return undefined;
40
40
  };
41
41
  return ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "description"), { "name": "if", "hash": {}, "fn": container.program(6, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 17, "column": 11 } } })) != null ? stack1 : "")
42
- + " export enum "
43
- + ((stack1 = container.lambda(container.strict(depth0, "name", { "start": { "line": 18, "column": 19 }, "end": { "line": 18, "column": 23 } }), depth0)) != null ? stack1 : "")
44
- + " {\n"
45
- + ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(depth0, "enum"), { "name": "each", "hash": {}, "fn": container.program(8, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 21, "column": 17 } } })) != null ? stack1 : "")
42
+ + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "alias"), { "name": "if", "hash": {}, "fn": container.program(8, data, 0), "inverse": container.program(10, data, 0), "data": data, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 22, "column": 11 } } })) != null ? stack1 : "")
43
+ + ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(depth0, "enum"), { "name": "each", "hash": {}, "fn": container.program(12, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 23, "column": 8 }, "end": { "line": 25, "column": 17 } } })) != null ? stack1 : "")
46
44
  + " }\n\n";
47
45
  }, "6": function (container, depth0, helpers, partials, data) {
48
46
  var stack1;
@@ -50,11 +48,21 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
50
48
  + ((stack1 = container.lambda(container.strict(depth0, "description", { "start": { "line": 15, "column": 10 }, "end": { "line": 15, "column": 21 } }), depth0)) != null ? stack1 : "")
51
49
  + "\n */\n";
52
50
  }, "8": function (container, depth0, helpers, partials, data) {
51
+ var stack1;
52
+ return " export enum "
53
+ + ((stack1 = container.lambda(container.strict(depth0, "alias", { "start": { "line": 19, "column": 19 }, "end": { "line": 19, "column": 24 } }), depth0)) != null ? stack1 : "")
54
+ + " {\n";
55
+ }, "10": function (container, depth0, helpers, partials, data) {
56
+ var stack1;
57
+ return " export enum "
58
+ + ((stack1 = container.lambda(container.strict(depth0, "name", { "start": { "line": 21, "column": 19 }, "end": { "line": 21, "column": 23 } }), depth0)) != null ? stack1 : "")
59
+ + " {\n";
60
+ }, "12": function (container, depth0, helpers, partials, data) {
53
61
  var stack1, alias1 = container.strict, alias2 = container.lambda;
54
62
  return " "
55
- + ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 20, "column": 11 }, "end": { "line": 20, "column": 15 } }), depth0)) != null ? stack1 : "")
63
+ + ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 24, "column": 11 }, "end": { "line": 24, "column": 15 } }), depth0)) != null ? stack1 : "")
56
64
  + " = "
57
- + ((stack1 = alias2(alias1(depth0, "value", { "start": { "line": 20, "column": 24 }, "end": { "line": 20, "column": 29 } }), depth0)) != null ? stack1 : "")
65
+ + ((stack1 = alias2(alias1(depth0, "value", { "start": { "line": 24, "column": 24 }, "end": { "line": 24, "column": 29 } }), depth0)) != null ? stack1 : "")
58
66
  + ",\n";
59
67
  }, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
60
68
  var stack1, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function (parent, propertyName) {
@@ -69,5 +77,5 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
69
77
  + " = "
70
78
  + ((stack1 = container.invokePartial(lookupProperty(partials, "type"), depth0, { "name": "type", "hash": { "parent": lookupProperty(depth0, "name") }, "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
71
79
  + ";\n"
72
- + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "enums"), { "name": "if", "hash": {}, "fn": container.program(3, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 28, "column": 7 } } })) != null ? stack1 : "");
80
+ + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "enums"), { "name": "if", "hash": {}, "fn": container.program(3, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 32, "column": 7 } } })) != null ? stack1 : "");
73
81
  }, "usePartial": true, "useData": true };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-openapi-codegen",
3
- "version": "2.0.0-beta.8",
3
+ "version": "2.0.0-beta.9",
4
4
  "description": "Library that generates Typescript clients based on the OpenAPI specification. It bases on openapi-typescript-codegen",
5
5
  "author": "Alexey Zverev",
6
6
  "homepage": "https://github.com/ozonophore/openapi-codegen.git",
@@ -1,6 +0,0 @@
1
- import { ZodError } from 'zod';
2
- /**
3
- * Форматирует Zod ошибку в читаемое сообщение для CLI
4
- */
5
- export declare function formatZodErrorForCLI(error: ZodError): string;
6
- //# sourceMappingURL=errorFormatter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errorFormatter.d.ts","sourceRoot":"","sources":["../../../src/cli/validation/errorFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAE/B;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAY5D"}
@@ -1,3 +0,0 @@
1
- export * from './errorFormatter';
2
- export * from './validateCLIOptions';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/validation/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateCLIOptions.d.ts","sourceRoot":"","sources":["../../../src/cli/validation/validateCLIOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAI1C;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjG;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAiB9F;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,CAQ9I"}
@@ -1,6 +0,0 @@
1
- import Joi from 'joi';
2
- export declare function getErrorFieldsFromValidation(error: Joi.ValidationError | undefined): {
3
- path: string;
4
- type: string;
5
- }[];
6
- //# sourceMappingURL=getErrorFieldsFromValidation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getErrorFieldsFromValidation.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/Utils/getErrorFieldsFromValidation.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,GAAG,CAAC,eAAe,GAAG,SAAS;;;IAElF"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getErrorFieldsFromValidation = getErrorFieldsFromValidation;
4
- // Auxiliary function for getting error fields from the Joi validation result
5
- function getErrorFieldsFromValidation(error) {
6
- return error?.details.map(detail => ({ path: Array.isArray(detail.path) ? detail.path.join('.') : detail.path, type: detail.type })) ?? [];
7
- }
@@ -1,6 +0,0 @@
1
- import { TraverseHandler } from '../Types';
2
- /** Handler for Joi.Schema: only the launch remains .describe() */
3
- export declare const handleJoiSchema: TraverseHandler<Set<string>>;
4
- /** Handler for the result of describe(): pulls out only the real keys of the field */
5
- export declare const handleJoiDescription: TraverseHandler<Set<string>>;
6
- //# sourceMappingURL=joiHandlers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"joiHandlers.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/Utils/joiHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,kEAAkE;AAClE,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAOxD,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,oBAAoB,EAAE,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAgD7D,CAAC"}