ts-openapi-codegen 2.0.0-beta.3 → 2.0.0-beta.5

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 (95) hide show
  1. package/dist/cli/{generate/runGenerateOpenApi.d.ts → generateOpenApiClient/generateOpenApiClient.d.ts} +2 -2
  2. package/dist/cli/generateOpenApiClient/generateOpenApiClient.d.ts.map +1 -0
  3. package/dist/cli/{generate/runGenerateOpenApi.js → generateOpenApiClient/generateOpenApiClient.js} +2 -2
  4. package/dist/cli/index.js +26 -6
  5. package/dist/cli/initOpenApiConfig/Types.d.ts +5 -0
  6. package/dist/cli/initOpenApiConfig/Types.d.ts.map +1 -1
  7. package/dist/cli/initOpenApiConfig/init.d.ts +6 -0
  8. package/dist/cli/initOpenApiConfig/init.d.ts.map +1 -0
  9. package/dist/cli/initOpenApiConfig/init.js +61 -0
  10. package/dist/cli/initOpenApiConfig/initConfig.d.ts +11 -0
  11. package/dist/cli/initOpenApiConfig/initConfig.d.ts.map +1 -0
  12. package/dist/cli/initOpenApiConfig/initConfig.js +102 -0
  13. package/dist/cli/initOpenApiConfig/initCustomRequest.d.ts +3 -0
  14. package/dist/cli/initOpenApiConfig/initCustomRequest.d.ts.map +1 -0
  15. package/dist/cli/initOpenApiConfig/initCustomRequest.js +23 -0
  16. package/dist/cli/initOpenApiConfig/utils/buildConfig.d.ts +21 -0
  17. package/dist/cli/initOpenApiConfig/utils/buildConfig.d.ts.map +1 -0
  18. package/dist/cli/initOpenApiConfig/utils/buildConfig.js +107 -0
  19. package/dist/cli/initOpenApiConfig/utils/findSpecFiles.d.ts +8 -0
  20. package/dist/cli/initOpenApiConfig/utils/findSpecFiles.d.ts.map +1 -0
  21. package/dist/cli/initOpenApiConfig/utils/findSpecFiles.js +40 -0
  22. package/dist/cli/initOpenApiConfig/utils/registerHandlebarTemplates.d.ts +3 -0
  23. package/dist/cli/initOpenApiConfig/utils/registerHandlebarTemplates.d.ts.map +1 -0
  24. package/dist/cli/initOpenApiConfig/utils/registerHandlebarTemplates.js +53 -0
  25. package/dist/cli/initOpenApiConfig/utils/validateSpecFile.d.ts +7 -0
  26. package/dist/cli/initOpenApiConfig/utils/validateSpecFile.d.ts.map +1 -0
  27. package/dist/cli/initOpenApiConfig/utils/validateSpecFile.js +23 -0
  28. package/dist/cli/initOpenApiConfig/utils/validateSpecFiles.d.ts +11 -0
  29. package/dist/cli/initOpenApiConfig/utils/validateSpecFiles.d.ts.map +1 -0
  30. package/dist/cli/initOpenApiConfig/utils/validateSpecFiles.js +24 -0
  31. package/dist/cli/initOpenApiConfig/utils/writeConfigFile.d.ts +11 -0
  32. package/dist/cli/initOpenApiConfig/utils/writeConfigFile.d.ts.map +1 -0
  33. package/dist/cli/initOpenApiConfig/utils/writeConfigFile.js +31 -0
  34. package/dist/cli/previewChanges/previewChanges.d.ts +8 -0
  35. package/dist/cli/previewChanges/previewChanges.d.ts.map +1 -0
  36. package/dist/cli/previewChanges/previewChanges.js +182 -0
  37. package/dist/cli/previewChanges/utils/compareFiles.d.ts +6 -0
  38. package/dist/cli/previewChanges/utils/compareFiles.d.ts.map +1 -0
  39. package/dist/cli/previewChanges/utils/compareFiles.js +50 -0
  40. package/dist/cli/previewChanges/utils/formatDiff.d.ts +6 -0
  41. package/dist/cli/previewChanges/utils/formatDiff.d.ts.map +1 -0
  42. package/dist/cli/previewChanges/utils/formatDiff.js +30 -0
  43. package/dist/cli/previewChanges/utils/isDirectoryEmpty.d.ts +5 -0
  44. package/dist/cli/previewChanges/utils/isDirectoryEmpty.d.ts.map +1 -0
  45. package/dist/cli/previewChanges/utils/isDirectoryEmpty.js +17 -0
  46. package/dist/cli/previewChanges/utils/readDirectoryRecursive.d.ts +5 -0
  47. package/dist/cli/previewChanges/utils/readDirectoryRecursive.d.ts.map +1 -0
  48. package/dist/cli/previewChanges/utils/readDirectoryRecursive.js +28 -0
  49. package/dist/cli/previewChanges/utils/updateOutputPaths.d.ts +10 -0
  50. package/dist/cli/previewChanges/utils/updateOutputPaths.d.ts.map +1 -0
  51. package/dist/cli/previewChanges/utils/updateOutputPaths.js +106 -0
  52. package/dist/cli/schemas/init.d.ts +4 -2
  53. package/dist/cli/schemas/init.d.ts.map +1 -1
  54. package/dist/cli/schemas/init.js +5 -2
  55. package/dist/common/Consts.d.ts +3 -0
  56. package/dist/common/Consts.d.ts.map +1 -1
  57. package/dist/common/Consts.js +4 -1
  58. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts.map +1 -1
  59. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.js +5 -6
  60. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts.map +1 -1
  61. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.js +5 -6
  62. package/dist/common/utils/fileSystemHelpers.d.ts +3 -1
  63. package/dist/common/utils/fileSystemHelpers.d.ts.map +1 -1
  64. package/dist/common/utils/fileSystemHelpers.js +3 -0
  65. package/dist/core/__tests__/WriteClient.test.js +0 -4
  66. package/dist/core/utils/__mocks__/templates.d.ts.map +1 -1
  67. package/dist/core/utils/__mocks__/templates.js +0 -4
  68. package/dist/core/utils/__tests__/registerHandlebarTemplates.test.js +2 -0
  69. package/dist/core/utils/__tests__/resolveRefToImportPath.test.js +9 -0
  70. package/dist/core/utils/registerHandlebarTemplates.d.ts +1 -5
  71. package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
  72. package/dist/core/utils/registerHandlebarTemplates.js +9 -10
  73. package/dist/core/utils/resolveRefToImportPath.d.ts.map +1 -1
  74. package/dist/core/utils/resolveRefToImportPath.js +13 -7
  75. package/dist/core/utils/writeClientSchemas.d.ts.map +1 -1
  76. package/dist/core/utils/writeClientSchemas.js +22 -31
  77. package/dist/templatesCompiled/cli/customRequest.d.ts +11 -0
  78. package/dist/templatesCompiled/cli/customRequest.d.ts.map +1 -0
  79. package/dist/templatesCompiled/cli/customRequest.js +27 -0
  80. package/dist/templatesCompiled/cli/customRequestExecutor.d.ts +11 -0
  81. package/dist/templatesCompiled/cli/customRequestExecutor.d.ts.map +1 -0
  82. package/dist/templatesCompiled/cli/customRequestExecutor.js +27 -0
  83. package/dist/templatesCompiled/cli/openApiConfig.d.ts +2 -1
  84. package/dist/templatesCompiled/cli/openApiConfig.d.ts.map +1 -1
  85. package/dist/templatesCompiled/cli/openApiConfig.js +76 -4
  86. package/dist/templatesCompiled/client/core/request-executor.js +1 -1
  87. package/dist/templatesCompiled/client/partials/parameters.js +1 -1
  88. package/dist/templatesCompiled/client/partials/serviceOption.d.ts +1 -4
  89. package/dist/templatesCompiled/client/partials/serviceOption.d.ts.map +1 -1
  90. package/dist/templatesCompiled/client/partials/serviceOption.js +28 -48
  91. package/package.json +2 -1
  92. package/dist/cli/generate/runGenerateOpenApi.d.ts.map +0 -1
  93. package/dist/cli/initOpenApiConfig/runInitOpenapiConfig.d.ts +0 -3
  94. package/dist/cli/initOpenApiConfig/runInitOpenapiConfig.d.ts.map +0 -1
  95. package/dist/cli/initOpenApiConfig/runInitOpenapiConfig.js +0 -70
@@ -10,7 +10,7 @@ const CommonSchemas_1 = require("../CommonSchemas");
10
10
  const mergeObjectSchemas_1 = require("../Utils/mergeObjectSchemas");
11
11
  const itemSchema = (0, mergeObjectSchemas_1.mergeObjectSchemas)(joi_1.default.object({
12
12
  input: joi_1.default.string().required().description('Путь, URL или строка OpenAPI спецификации'),
13
- httpClient: joi_1.default.string().valid(...Object.values(HttpClient_enum_1.HttpClient)).optional(),
13
+ request: joi_1.default.string().optional(),
14
14
  }), CommonSchemas_1.outputPathsSchema, CommonSchemas_1.additionalParametersSchemaV2, CommonSchemas_1.experimentalParametersSchemaV2);
15
15
  /**
16
16
  * Unified options schema that supports both single and multi-item configurations.
@@ -18,11 +18,7 @@ const itemSchema = (0, mergeObjectSchemas_1.mergeObjectSchemas)(joi_1.default.ob
18
18
  */
19
19
  exports.unifiedOptionsSchemaV1 = (0, mergeObjectSchemas_1.mergeObjectSchemas)(joi_1.default.object({
20
20
  // Multi-item configuration
21
- items: joi_1.default.array()
22
- .items(itemSchema)
23
- .min(1)
24
- .optional()
25
- .description('Массив спецификаций для генерации'),
21
+ items: joi_1.default.array().items(itemSchema).min(1).optional().description('Массив спецификаций для генерации'),
26
22
  // Single-item configuration (mutually exclusive with items)
27
23
  input: joi_1.default.string()
28
24
  .when('items', {
@@ -38,5 +34,8 @@ exports.unifiedOptionsSchemaV1 = (0, mergeObjectSchemas_1.mergeObjectSchemas)(jo
38
34
  otherwise: joi_1.default.required(),
39
35
  })
40
36
  .description('Выходная директория'),
37
+ httpClient: joi_1.default.string()
38
+ .valid(...Object.values(HttpClient_enum_1.HttpClient))
39
+ .optional(),
41
40
  }), CommonSchemas_1.outputPathsSchema, // outputCore, outputServices, etc. for single-item mode
42
41
  CommonSchemas_1.specialParametersSchemasV2, CommonSchemas_1.additionalParametersSchemaV2, CommonSchemas_1.experimentalParametersSchemaV2).xor('items', 'input');
@@ -1 +1 @@
1
- {"version":3,"file":"UnifiedOptionsSchemaV2.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAqBtB;;;GAGG;AACH,eAAO,MAAM,sBAAsB,uBA6BZ,CAAC"}
1
+ {"version":3,"file":"UnifiedOptionsSchemaV2.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAgBtB;;;GAGG;AACH,eAAO,MAAM,sBAAsB,uBA4BZ,CAAC"}
@@ -10,7 +10,7 @@ const CommonSchemas_1 = require("../CommonSchemas");
10
10
  const mergeObjectSchemas_1 = require("../Utils/mergeObjectSchemas");
11
11
  const itemSchema = (0, mergeObjectSchemas_1.mergeObjectSchemas)(joi_1.default.object({
12
12
  input: joi_1.default.string().required().description('Путь, URL или строка OpenAPI спецификации'),
13
- httpClient: joi_1.default.string().valid(...Object.values(HttpClient_enum_1.HttpClient)).optional(),
13
+ request: joi_1.default.string().optional(),
14
14
  }), CommonSchemas_1.outputPathsSchema, CommonSchemas_1.additionalParametersSchemaV2, CommonSchemas_1.experimentalParametersSchemaV2);
15
15
  /**
16
16
  * Unified options schema that supports both single and multi-item configurations.
@@ -18,11 +18,7 @@ const itemSchema = (0, mergeObjectSchemas_1.mergeObjectSchemas)(joi_1.default.ob
18
18
  */
19
19
  exports.unifiedOptionsSchemaV2 = (0, mergeObjectSchemas_1.mergeObjectSchemas)(joi_1.default.object({
20
20
  // Multi-item configuration
21
- items: joi_1.default.array()
22
- .items(itemSchema)
23
- .min(1)
24
- .optional()
25
- .description('Массив спецификаций для генерации'),
21
+ items: joi_1.default.array().items(itemSchema).min(1).optional().description('Массив спецификаций для генерации'),
26
22
  // Single-item configuration (mutually exclusive with items)
27
23
  input: joi_1.default.string()
28
24
  .when('items', {
@@ -38,5 +34,8 @@ exports.unifiedOptionsSchemaV2 = (0, mergeObjectSchemas_1.mergeObjectSchemas)(jo
38
34
  otherwise: joi_1.default.required(),
39
35
  })
40
36
  .description('Выходная директория'),
37
+ httpClient: joi_1.default.string()
38
+ .valid(...Object.values(HttpClient_enum_1.HttpClient))
39
+ .optional(),
41
40
  }), CommonSchemas_1.outputPathsSchema, // outputCore, outputServices, etc. for single-item mode
42
41
  CommonSchemas_1.specialParametersSchemasV3, CommonSchemas_1.additionalParametersSchemaV2, CommonSchemas_1.experimentalParametersSchemaV2).xor('items', 'input');
@@ -1,4 +1,4 @@
1
- import { copyFile as __copyFile, exists as __exists, readFile as __readFile, writeFile as __writeFile } from 'fs';
1
+ import { copyFile as __copyFile, exists as __exists, readdir as __readdir, readFile as __readFile, writeFile as __writeFile } from 'fs';
2
2
  declare function isDirectory(path: string): boolean;
3
3
  declare function isPathToFile(path: string): boolean;
4
4
  declare const fileSystemHelpers: {
@@ -6,10 +6,12 @@ declare const fileSystemHelpers: {
6
6
  writeFile: typeof __writeFile.__promisify__;
7
7
  copyFile: typeof __copyFile.__promisify__;
8
8
  exists: typeof __exists.__promisify__;
9
+ cp: (arg1: string | import("url").URL, arg2: string | import("url").URL) => Promise<void>;
9
10
  mkdir: (path: string) => Promise<void>;
10
11
  rmdir: (path: string) => Promise<void>;
11
12
  isDirectory: typeof isDirectory;
12
13
  isPathToFile: typeof isPathToFile;
14
+ readdir: typeof __readdir.__promisify__;
13
15
  };
14
16
  export { fileSystemHelpers };
15
17
  //# sourceMappingURL=fileSystemHelpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fileSystemHelpers.d.ts","sourceRoot":"","sources":["../../../src/common/utils/fileSystemHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,IAAI,UAAU,EACtB,MAAM,IAAI,QAAQ,EAGlB,QAAQ,IAAI,UAAU,EAKtB,SAAS,IAAI,WAAW,EAC3B,MAAM,IAAI,CAAC;AAyDZ,iBAAS,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAM1C;AAED,iBAAS,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAM3C;AAED,QAAA,MAAM,iBAAiB;;;;;kBArDI,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;kBAgBtB,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;;;CA8ChD,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"fileSystemHelpers.d.ts","sourceRoot":"","sources":["../../../src/common/utils/fileSystemHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,IAAI,UAAU,EAEtB,MAAM,IAAI,QAAQ,EAElB,OAAO,IAAI,SAAS,EACpB,QAAQ,IAAI,UAAU,EAKtB,SAAS,IAAI,WAAW,EAC3B,MAAM,IAAI,CAAC;AA0DZ,iBAAS,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAM1C;AAED,iBAAS,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAM3C;AAED,QAAA,MAAM,iBAAiB;;;;;;kBArDI,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;kBAgBtB,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;;;;CAgDhD,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -16,6 +16,7 @@ const readFile = (0, util_1.promisify)(fs_1.readFile);
16
16
  const writeFile = (0, util_1.promisify)(fs_1.writeFile);
17
17
  const copyFile = (0, util_1.promisify)(fs_1.copyFile);
18
18
  const exists = (0, util_1.promisify)(fs_1.exists);
19
+ const cp = (0, util_1.promisify)(fs_1.cp);
19
20
  // Рекурсивное создание директорий (замена mkdirp)
20
21
  const mkdir = async (path) => {
21
22
  try {
@@ -77,9 +78,11 @@ const fileSystemHelpers = {
77
78
  writeFile,
78
79
  copyFile,
79
80
  exists,
81
+ cp,
80
82
  mkdir,
81
83
  rmdir,
82
84
  isDirectory,
83
85
  isPathToFile,
86
+ readdir,
84
87
  };
85
88
  exports.fileSystemHelpers = fileSystemHelpers;
@@ -42,10 +42,6 @@ const WriteClient_1 = require("../WriteClient");
42
42
  exports: {
43
43
  model: () => 'model',
44
44
  schema: () => 'schema',
45
- zodSchema: () => 'zodSchema',
46
- yupSchema: () => 'yupSchema',
47
- joiSchema: () => 'joiSchema',
48
- jsonSchemaSchema: () => 'jsonSchemaSchema',
49
45
  service: () => 'service',
50
46
  },
51
47
  core: {
@@ -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,+BAA+B,CAAC;AAE1D,eAAO,MAAM,SAAS,EAAE,SA6BvB,CAAC"}
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/__mocks__/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D,eAAO,MAAM,SAAS,EAAE,SAyBvB,CAAC"}
@@ -13,10 +13,6 @@ exports.templates = {
13
13
  exports: {
14
14
  model: () => 'model',
15
15
  schema: () => 'schema',
16
- zodSchema: () => 'zodSchema',
17
- yupSchema: () => 'yupSchema',
18
- joiSchema: () => 'joiSchema',
19
- jsonSchemaSchema: () => 'jsonSchemaSchema',
20
16
  service: () => 'service',
21
17
  },
22
18
  core: {
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  const node_assert_1 = __importDefault(require("node:assert"));
40
40
  const node_test_1 = __importStar(require("node:test"));
41
41
  const HttpClient_enum_1 = require("../../types/enums/HttpClient.enum");
42
+ const ValidationLibrary_enum_1 = require("../../types/enums/ValidationLibrary.enum");
42
43
  const registerHandlebarTemplates_1 = require("../registerHandlebarTemplates");
43
44
  (0, node_test_1.describe)('@unit: registerHandlebarTemplates', () => {
44
45
  (0, node_test_1.default)('should return correct templates', () => {
@@ -46,6 +47,7 @@ const registerHandlebarTemplates_1 = require("../registerHandlebarTemplates");
46
47
  httpClient: HttpClient_enum_1.HttpClient.FETCH,
47
48
  useOptions: false,
48
49
  useUnionTypes: false,
50
+ validationLibrary: ValidationLibrary_enum_1.ValidationLibrary.ZOD,
49
51
  });
50
52
  node_assert_1.default.notEqual(templates.indexes.full, undefined);
51
53
  node_assert_1.default.notEqual(templates.indexes.models, undefined);
@@ -246,6 +246,15 @@ const normalizePath = (p) => p.replace(Consts_1.REGEX_BACKSLASH, '/');
246
246
  const normalized = normalizePath(result);
247
247
  node_assert_1.strict.ok(normalized.includes('User') || normalized === './User');
248
248
  });
249
+ (0, node_test_1.test)('external file reference with parentFilePath as directory', () => {
250
+ const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
251
+ mainSpecPath: '/Developer/my-app/api/openapi_spec.yaml',
252
+ parentFilePath: '/Developer/my-app/api/ui/components/dir/some.yaml',
253
+ refValuePath: '../components/dir/file_name.yaml',
254
+ outputModelsPath: '/generated/models',
255
+ });
256
+ node_assert_1.strict.equal(normalizePath(result), './ui/components/dir/FileName');
257
+ });
249
258
  });
250
259
  (0, node_test_1.describe)('ABSOLUTE_PATH (default case)', () => {
251
260
  (0, node_test_1.test)('absolute path to file → resolves correctly', () => {
@@ -12,11 +12,7 @@ export interface Templates {
12
12
  };
13
13
  exports: {
14
14
  model: Handlebars.TemplateDelegate;
15
- schema: Handlebars.TemplateDelegate;
16
- zodSchema: Handlebars.TemplateDelegate;
17
- yupSchema: Handlebars.TemplateDelegate;
18
- joiSchema: Handlebars.TemplateDelegate;
19
- jsonSchemaSchema: Handlebars.TemplateDelegate;
15
+ schema: Handlebars.TemplateDelegate | undefined;
20
16
  service: Handlebars.TemplateDelegate;
21
17
  };
22
18
  core: {
@@ -1 +1 @@
1
- {"version":3,"file":"registerHandlebarTemplates.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarTemplates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAyFjD,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AA0C1E,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,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACnC,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,SAAS,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACvC,SAAS,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACvC,SAAS,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACvC,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,CAAA;QAC7C,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,oBAAoB,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACrD,CAAC;CACL;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,OAAO,CAAC;IAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;CAAE,GAAG,SAAS,CAiK1K"}
1
+ {"version":3,"file":"registerHandlebarTemplates.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarTemplates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAwFjD,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AA0C1E,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,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,oBAAoB,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACrD,CAAC;CACL;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,OAAO,CAAC;IAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;CAAE,GAAG,SAAS,CAqK1K"}
@@ -86,7 +86,6 @@ const getResponseHeader_4 = __importDefault(require("../../templatesCompiled/cli
86
86
  const request_5 = __importDefault(require("../../templatesCompiled/client/core/xhr/request"));
87
87
  const sendRequest_4 = __importDefault(require("../../templatesCompiled/client/core/xhr/sendRequest"));
88
88
  const exportModel_1 = __importDefault(require("../../templatesCompiled/client/exportModel"));
89
- const exportSchema_1 = __importDefault(require("../../templatesCompiled/client/exportSchema"));
90
89
  const exportService_1 = __importDefault(require("../../templatesCompiled/client/exportService"));
91
90
  const indexFull_1 = __importDefault(require("../../templatesCompiled/client/indexFull"));
92
91
  const indexSimple_1 = __importDefault(require("../../templatesCompiled/client/indexSimple"));
@@ -127,7 +126,7 @@ const typeReference_1 = __importDefault(require("../../templatesCompiled/client/
127
126
  const typeUnion_1 = __importDefault(require("../../templatesCompiled/client/partials/typeUnion"));
128
127
  const registerHandlebarHelpers_1 = require("./registerHandlebarHelpers");
129
128
  const ValidationLibrary_enum_1 = require("../types/enums/ValidationLibrary.enum");
130
- const exportSchema_2 = __importDefault(require("../../templatesCompiled/client/zod/exportSchema"));
129
+ const exportSchema_1 = __importDefault(require("../../templatesCompiled/client/zod/exportSchema"));
131
130
  const zodSchema_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchema"));
132
131
  const zodSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaInterface"));
133
132
  const zodSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaEnum"));
@@ -136,7 +135,7 @@ const zodSchemaDictionary_1 = __importDefault(require("../../templatesCompiled/c
136
135
  const zodSchemaGeneric_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaGeneric"));
137
136
  const zodSchemaReference_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaReference"));
138
137
  const zodSchemaComposition_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaComposition"));
139
- const exportSchema_3 = __importDefault(require("../../templatesCompiled/client/yup/exportSchema"));
138
+ const exportSchema_2 = __importDefault(require("../../templatesCompiled/client/yup/exportSchema"));
140
139
  const yupSchema_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchema"));
141
140
  const yupSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaInterface"));
142
141
  const yupSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaEnum"));
@@ -145,7 +144,7 @@ const yupSchemaDictionary_1 = __importDefault(require("../../templatesCompiled/c
145
144
  const yupSchemaGeneric_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaGeneric"));
146
145
  const yupSchemaReference_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaReference"));
147
146
  const yupSchemaComposition_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaComposition"));
148
- const exportSchema_4 = __importDefault(require("../../templatesCompiled/client/joi/exportSchema"));
147
+ const exportSchema_3 = __importDefault(require("../../templatesCompiled/client/joi/exportSchema"));
149
148
  const joiSchema_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchema"));
150
149
  const joiSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaInterface"));
151
150
  const joiSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaEnum"));
@@ -154,7 +153,7 @@ const joiSchemaDictionary_1 = __importDefault(require("../../templatesCompiled/c
154
153
  const joiSchemaGeneric_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaGeneric"));
155
154
  const joiSchemaReference_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaReference"));
156
155
  const joiSchemaComposition_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaComposition"));
157
- const exportSchema_5 = __importDefault(require("../../templatesCompiled/client/jsonschema/exportSchema"));
156
+ const exportSchema_4 = __importDefault(require("../../templatesCompiled/client/jsonschema/exportSchema"));
158
157
  const jsonschemaSchema_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchema"));
159
158
  const jsonschemaSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface"));
160
159
  const jsonschemaSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchemaEnum"));
@@ -181,11 +180,7 @@ function registerHandlebarTemplates(root) {
181
180
  },
182
181
  exports: {
183
182
  model: Handlebars.template(exportModel_1.default),
184
- schema: Handlebars.template(exportSchema_1.default),
185
- zodSchema: Handlebars.template(exportSchema_2.default),
186
- yupSchema: Handlebars.template(exportSchema_3.default),
187
- joiSchema: Handlebars.template(exportSchema_4.default),
188
- jsonSchemaSchema: Handlebars.template(exportSchema_5.default),
183
+ schema: undefined,
189
184
  service: Handlebars.template(exportService_1.default),
190
185
  },
191
186
  core: {
@@ -274,6 +269,7 @@ function registerHandlebarTemplates(root) {
274
269
  Handlebars.registerPartial('axios/request', Handlebars.template(request_1.default));
275
270
  // Register Zod partials if validationLibrary is ZOD
276
271
  if (root?.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.ZOD) {
272
+ templates.exports.schema = Handlebars.template(exportSchema_1.default);
277
273
  Handlebars.registerPartial('zodSchema', Handlebars.template(zodSchema_1.default));
278
274
  Handlebars.registerPartial('zodSchemaInterface', Handlebars.template(zodSchemaInterface_1.default));
279
275
  Handlebars.registerPartial('zodSchemaEnum', Handlebars.template(zodSchemaEnum_1.default));
@@ -285,6 +281,7 @@ function registerHandlebarTemplates(root) {
285
281
  }
286
282
  // Register Yup partials if validationLibrary is YUP
287
283
  if (root?.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.YUP) {
284
+ templates.exports.schema = Handlebars.template(exportSchema_2.default);
288
285
  Handlebars.registerPartial('yupSchema', Handlebars.template(yupSchema_1.default));
289
286
  Handlebars.registerPartial('yupSchemaInterface', Handlebars.template(yupSchemaInterface_1.default));
290
287
  Handlebars.registerPartial('yupSchemaEnum', Handlebars.template(yupSchemaEnum_1.default));
@@ -296,6 +293,7 @@ function registerHandlebarTemplates(root) {
296
293
  }
297
294
  // Register Joi partials if validationLibrary is JOI
298
295
  if (root?.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.JOI) {
296
+ templates.exports.schema = Handlebars.template(exportSchema_3.default);
299
297
  Handlebars.registerPartial('joiSchema', Handlebars.template(joiSchema_1.default));
300
298
  Handlebars.registerPartial('joiSchemaInterface', Handlebars.template(joiSchemaInterface_1.default));
301
299
  Handlebars.registerPartial('joiSchemaEnum', Handlebars.template(joiSchemaEnum_1.default));
@@ -306,6 +304,7 @@ function registerHandlebarTemplates(root) {
306
304
  Handlebars.registerPartial('joiSchemaComposition', Handlebars.template(joiSchemaComposition_1.default));
307
305
  }
308
306
  if (root.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.JSONSCHEMA) {
307
+ templates.exports.schema = Handlebars.template(exportSchema_4.default);
309
308
  Handlebars.registerPartial('jsonschemaSchema', Handlebars.template(jsonschemaSchema_1.default));
310
309
  Handlebars.registerPartial('jsonschemaSchemaInterface', Handlebars.template(jsonschemaSchemaInterface_1.default));
311
310
  Handlebars.registerPartial('jsonschemaSchemaEnum', Handlebars.template(jsonschemaSchemaEnum_1.default));
@@ -1 +1 @@
1
- {"version":3,"file":"resolveRefToImportPath.d.ts","sourceRoot":"","sources":["../../../src/core/utils/resolveRefToImportPath.ts"],"names":[],"mappings":"AAQA,UAAU,OAAO;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAyFD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,EAAE,OAAO,UAiE/G"}
1
+ {"version":3,"file":"resolveRefToImportPath.d.ts","sourceRoot":"","sources":["../../../src/core/utils/resolveRefToImportPath.ts"],"names":[],"mappings":"AAQA,UAAU,OAAO;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAoED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,EAAE,OAAO,UAyD/G"}
@@ -60,9 +60,7 @@ function prepareParentDirForResolve(parentFilePath, mainSpecPath, sourceRoot) {
60
60
  function removeParentBasenamePrefix(refValueClean, parentDirForResolveWithSep) {
61
61
  const baseNameParent = (0, path_1.basename)(parentDirForResolveWithSep);
62
62
  const baseNameParentWithSep = baseNameParent.endsWith('/') ? baseNameParent : baseNameParent + '/';
63
- return refValueClean.startsWith(baseNameParentWithSep)
64
- ? refValueClean.replace(baseNameParentWithSep, '')
65
- : refValueClean;
63
+ return refValueClean.startsWith(baseNameParentWithSep) ? refValueClean.replace(baseNameParentWithSep, '') : refValueClean;
66
64
  }
67
65
  /**
68
66
  * Resolves $ref reference to import path for generated code.
@@ -94,12 +92,20 @@ function resolveRefToImportPath({ mainSpecPath, parentFilePath, refValuePath, ou
94
92
  const currentRefValue = removeParentBasenamePrefix(refValueClean, parentDirForResolveWithSep);
95
93
  // EXTERNAL_FILE: reference to external file (e.g., ./file.yaml)
96
94
  if (parsed.type === parseRef_1.RefType.EXTERNAL_FILE) {
97
- const targetFileAbs = (0, pathHelpers_1.joinHelper)(parentDirForResolveWithSep, currentRefValue);
95
+ const adjustedRefSegments = currentRefValue.split('/');
96
+ let adjustedParentDir = parentDirForResolveWithSep;
97
+ while (adjustedRefSegments[0] === '..') {
98
+ adjustedParentDir = (0, pathHelpers_1.dirNameHelper)(adjustedParentDir);
99
+ adjustedRefSegments.shift();
100
+ }
101
+ const parentBase = (0, path_1.basename)(adjustedParentDir);
102
+ if (adjustedRefSegments[0] === parentBase) {
103
+ adjustedRefSegments.shift();
104
+ }
105
+ const targetFileAbs = (0, pathHelpers_1.resolveHelper)(adjustedParentDir, ...adjustedRefSegments);
98
106
  return resolveExternalFileOrAbsolutePath(targetFileAbs, sourceRoot, outputModelsPath, absOutputModelsPath);
99
107
  }
100
108
  // ABSOLUTE_PATH (default case): absolute path reference
101
- const targetFileAbs = fileSystemHelpers_1.fileSystemHelpers.isPathToFile(refValueClean)
102
- ? (0, pathHelpers_1.joinHelper)(parentDirForResolveWithSep, refValueClean)
103
- : (0, pathHelpers_1.resolveHelper)(parentDirForResolveWithSep, refValueClean);
109
+ const targetFileAbs = fileSystemHelpers_1.fileSystemHelpers.isPathToFile(refValueClean) ? (0, pathHelpers_1.joinHelper)(parentDirForResolveWithSep, refValueClean) : (0, pathHelpers_1.resolveHelper)(parentDirForResolveWithSep, refValueClean);
104
110
  return resolveExternalFileOrAbsolutePath(targetFileAbs, sourceRoot, outputModelsPath, absOutputModelsPath);
105
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"writeClientSchemas.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientSchemas.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD;;;;;;GAMG;AACH,UAAU,mBAAmB;IACzB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4CvG"}
1
+ {"version":3,"file":"writeClientSchemas.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientSchemas.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD;;;;;;GAMG;AACH,UAAU,mBAAmB;IACzB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCvG"}
@@ -5,7 +5,6 @@ const fs_1 = require("fs");
5
5
  const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
6
6
  const format_1 = require("../../common/utils/format");
7
7
  const pathHelpers_1 = require("../../common/utils/pathHelpers");
8
- const ValidationLibrary_enum_1 = require("../types/enums/ValidationLibrary.enum");
9
8
  /**
10
9
  * Generate Schemas using the Handlebar template and write to disk.
11
10
  * @param models Array of Models to write
@@ -16,36 +15,28 @@ const ValidationLibrary_enum_1 = require("../types/enums/ValidationLibrary.enum"
16
15
  */
17
16
  async function writeClientSchemas(options) {
18
17
  const { models, templates, outputSchemasPath, httpClient, useUnionTypes, validationLibrary } = options;
19
- this.logger.info('The recording of model validation schema files begins.');
20
- // Choose template based on validation library
21
- const schemaTemplate = validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.ZOD
22
- ? templates.exports.zodSchema
23
- : validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.YUP
24
- ? templates.exports.yupSchema
25
- : validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.JOI
26
- ? templates.exports.joiSchema
27
- : validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.JSONSCHEMA
28
- ? templates.exports.jsonSchemaSchema
29
- : templates.exports.schema;
30
- for (const model of models) {
31
- const modelFolderPath = model?.path;
32
- const dir = (0, pathHelpers_1.dirNameHelper)(modelFolderPath);
33
- if (dir) {
34
- const directory = (0, pathHelpers_1.resolveHelper)(outputSchemasPath, dir);
35
- this.logger.info(`A directory is being created: ${directory}`);
36
- (0, fs_1.mkdirSync)(directory, { recursive: true });
18
+ if (templates.exports.schema) {
19
+ this.logger.info('The recording of model validation schema files begins.');
20
+ for (const model of models) {
21
+ const modelFolderPath = model?.path;
22
+ const dir = (0, pathHelpers_1.dirNameHelper)(modelFolderPath);
23
+ if (dir) {
24
+ const directory = (0, pathHelpers_1.resolveHelper)(outputSchemasPath, dir);
25
+ this.logger.info(`A directory is being created: ${directory}`);
26
+ (0, fs_1.mkdirSync)(directory, { recursive: true });
27
+ }
28
+ const file = (0, pathHelpers_1.resolveHelper)(outputSchemasPath, `${modelFolderPath}Schema.ts`);
29
+ this.logger.info(`The recording of the file data begins: ${file}`);
30
+ const templateResult = templates.exports.schema({
31
+ ...model,
32
+ httpClient,
33
+ useUnionTypes,
34
+ validationLibrary,
35
+ });
36
+ const formattedValue = await (0, format_1.format)(templateResult);
37
+ await fileSystemHelpers_1.fileSystemHelpers.writeFile(file, formattedValue);
38
+ this.logger.info(`File recording completed: ${file}`);
37
39
  }
38
- const file = (0, pathHelpers_1.resolveHelper)(outputSchemasPath, `${modelFolderPath}Schema.ts`);
39
- this.logger.info(`The recording of the file data begins: ${file}`);
40
- const templateResult = schemaTemplate({
41
- ...model,
42
- httpClient,
43
- useUnionTypes,
44
- validationLibrary,
45
- });
46
- const formattedValue = await (0, format_1.format)(templateResult);
47
- await fileSystemHelpers_1.fileSystemHelpers.writeFile(file, formattedValue);
48
- this.logger.info(`File recording completed: ${file}`);
40
+ this.logger.info('The recording of model validation schema files has been completed successfully');
49
41
  }
50
- this.logger.info('The recording of model validation schema files has been completed successfully');
51
42
  }
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ "1": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
3
+ "3": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
4
+ "5": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
5
+ compiler: (string | number)[];
6
+ main: (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
7
+ usePartial: boolean;
8
+ useData: boolean;
9
+ };
10
+ export default _default;
11
+ //# sourceMappingURL=customRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customRequest.d.ts","sourceRoot":"","sources":["../../../src/templatesCompiled/cli/customRequest.ts"],"names":[],"mappings":";;;;;;;;;AAMA,wBAmBmC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // This is an automatically generated file for the hbs template.
4
+ // You don't need to change it, run npm run build:hbs to update it.
5
+ /* istanbul ignore file */
6
+ /* tslint: disable */
7
+ /* eslint: disable */
8
+ // @ts-nocheck
9
+ exports.default = { "1": function (container, depth0, helpers, partials, data) {
10
+ return "import type { CancelablePromise } from './CancelablePromise';\n";
11
+ }, "3": function (container, depth0, helpers, partials, data) {
12
+ return "export function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<T> {\n return new CancelablePromise(async (resolve, reject, onCancel) => {\n try {\n const abortController = new AbortController();\n \n if (options?.timeout) {\n const timeoutId = setTimeout(() => abortController.abort(), options.timeout);\n onCancel(() => clearTimeout(timeoutId));\n }\n \n onCancel(() => abortController.abort());\n \n if (onCancel.isCancelled) {\n return;\n }\n \n // Ваша пользовательская логика запросов здесь\n const response = await fetch(config.url, {\n method: config.method,\n headers: config.headers,\n body: config.body ? JSON.stringify(config.body) : undefined,\n signal: abortController.signal,\n });\n \n if (!response.ok) {\n throw new Error(`Request failed: ${response.statusText}`);\n }\n \n const data = await response.json();\n resolve(data);\n } catch (error) {\n reject(error);\n }\n });\n};\n";
13
+ }, "5": function (container, depth0, helpers, partials, data) {
14
+ return "export async function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<T> {\n return new Promise(async (resolve, reject) => {\n try {\n const url = getUrl(options, config);\n const response = await sendRequest(options, url, config);\n const responseBody = getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n\n const result: ApiResult = {\n url,\n ok: isSuccess(response.status),\n status: response.status,\n statusText: response.statusText,\n body: responseHeader || responseBody,\n };\n\n catchErrors(options, result);\n resolve(result.body);\n } catch (error) {\n reject(error);\n }\n });\n}\n";
15
+ }, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
16
+ var stack1, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function (parent, propertyName) {
17
+ if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
18
+ return parent[propertyName];
19
+ }
20
+ return undefined;
21
+ };
22
+ return ((stack1 = container.invokePartial(lookupProperty(partials, "header"), depth0, { "name": "header", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
23
+ + "\nimport type { RequestExecutor, RequestConfig } from './request-executor';\n"
24
+ + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "useCancelableRequest"), { "name": "if", "hash": {}, "fn": container.program(1, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 6, "column": 7 } } })) != null ? stack1 : "")
25
+ + "\n/**\n * Определите свой тип опций (опционально)\n * Измените этот интерфейс в соответствии с вашими потребностями\n */\ninterface MyCustomOptions {\n timeout?: number;\n retries?: number;\n}\n\n/**\n * Создайте пользовательский executor\n * Реализуйте свою логику запросов здесь\n *\n * @example Пример использования:\n * \n * import { createLegacyExecutor } from './generated/core/legacy-request-adapter';\n * import { SimpleService } from './generated/services/SimpleService';\n *\n * const executorWithOptions = createLegacyExecutor<MyCustomOptions>(OpenAPI, (options) => {\n * // Мапьте ваши пользовательские опции в ApiRequestOptions при необходимости\n * return {\n * // Добавьте любые поля ApiRequestOptions на основе options\n * };\n * });\n * \n * const simpleService = new SimpleService(executorWithOptions);\n * await simpleService.getCallWithoutParametersAndResponse();\n */\n"
26
+ + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "useCancelableRequest"), { "name": "if", "hash": {}, "fn": container.program(3, data, 0), "inverse": container.program(5, data, 0), "data": data, "loc": { "start": { "line": 36, "column": 0 }, "end": { "line": 96, "column": 7 } } })) != null ? stack1 : "");
27
+ }, "usePartial": true, "useData": true };
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ "1": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
3
+ "3": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
4
+ "5": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
5
+ compiler: (string | number)[];
6
+ main: (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
7
+ usePartial: boolean;
8
+ useData: boolean;
9
+ };
10
+ export default _default;
11
+ //# sourceMappingURL=customRequestExecutor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customRequestExecutor.d.ts","sourceRoot":"","sources":["../../../src/templatesCompiled/cli/customRequestExecutor.ts"],"names":[],"mappings":";;;;;;;;;AAMA,wBAmBmC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // This is an automatically generated file for the hbs template.
4
+ // You don't need to change it, run npm run build:hbs to update it.
5
+ /* istanbul ignore file */
6
+ /* tslint: disable */
7
+ /* eslint: disable */
8
+ // @ts-nocheck
9
+ exports.default = { "1": function (container, depth0, helpers, partials, data) {
10
+ return "import type { CancelablePromise } from './CancelablePromise';\n";
11
+ }, "3": function (container, depth0, helpers, partials, data) {
12
+ return "export const customExecutor: RequestExecutor<MyCustomOptions> = {\n async request<TResponse>(config: RequestConfig, options?: MyCustomOptions): CancelablePromise<TResponse> {\n return new CancelablePromise(async (resolve, reject, onCancel) => {\n try {\n const abortController = new AbortController();\n \n if (options?.timeout) {\n const timeoutId = setTimeout(() => abortController.abort(), options.timeout);\n onCancel(() => clearTimeout(timeoutId));\n }\n \n onCancel(() => abortController.abort());\n \n if (onCancel.isCancelled) {\n return;\n }\n \n // Ваша пользовательская логика запросов здесь\n const response = await fetch(config.url, {\n method: config.method,\n headers: config.headers,\n body: config.body ? JSON.stringify(config.body) : undefined,\n signal: abortController.signal,\n });\n \n if (!response.ok) {\n throw new Error(`Request failed: ${response.statusText}`);\n }\n \n const data = await response.json();\n resolve(data);\n } catch (error) {\n reject(error);\n }\n });\n },\n};\n";
13
+ }, "5": function (container, depth0, helpers, partials, data) {
14
+ return "export const customExecutor: RequestExecutor<MyCustomOptions> = {\n async request<TResponse>(config: RequestConfig, options?: MyCustomOptions): Promise<TResponse> {\n // Ваша пользовательская логика запросов здесь\n const response = await fetch(config.url, {\n method: config.method,\n headers: config.headers,\n body: config.body ? JSON.stringify(config.body) : undefined,\n signal: options?.timeout ? AbortSignal.timeout(options.timeout) : undefined,\n });\n \n if (!response.ok) {\n throw new Error(`Request failed: ${response.statusText}`);\n }\n \n return response.json();\n },\n};\n";
15
+ }, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
16
+ var stack1, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function (parent, propertyName) {
17
+ if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
18
+ return parent[propertyName];
19
+ }
20
+ return undefined;
21
+ };
22
+ return ((stack1 = container.invokePartial(lookupProperty(partials, "header"), depth0, { "name": "header", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
23
+ + "\nimport type { RequestExecutor, RequestConfig } from './request-executor';\n"
24
+ + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "useCancelableRequest"), { "name": "if", "hash": {}, "fn": container.program(1, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 6, "column": 7 } } })) != null ? stack1 : "")
25
+ + "\n/**\n * Определите свой тип опций (опционально)\n * Измените этот интерфейс в соответствии с вашими потребностями\n */\ninterface MyCustomOptions {\n timeout?: number;\n retries?: number;\n}\n\n/**\n * Создайте пользовательский executor\n * Реализуйте свою логику запросов здесь\n *\n * @example Пример использования:\n * \n * import { SimpleService } from './generated/services/SimpleService';\n * \n * const simpleService = new SimpleService<MyCustomOptions>(customExecutor);\n * await simpleService.getCallWithoutParametersAndResponse({ timeout: 5000, retries: 3 });\n */\n"
26
+ + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "useCancelableRequest"), { "name": "if", "hash": {}, "fn": container.program(3, data, 0), "inverse": container.program(5, data, 0), "data": data, "loc": { "start": { "line": 28, "column": 0 }, "end": { "line": 84, "column": 7 } } })) != null ? stack1 : "");
27
+ }, "usePartial": true, "useData": true };
@@ -1,6 +1,7 @@
1
1
  declare const _default: {
2
2
  "1": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
3
- "3": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
3
+ "2": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
4
+ "4": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
4
5
  compiler: (string | number)[];
5
6
  main: (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
6
7
  useData: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"openApiConfig.d.ts","sourceRoot":"","sources":["../../../src/templatesCompiled/cli/openApiConfig.ts"],"names":[],"mappings":";;;;;;;AAMA,wBAaiB"}
1
+ {"version":3,"file":"openApiConfig.d.ts","sourceRoot":"","sources":["../../../src/templatesCompiled/cli/openApiConfig.ts"],"names":[],"mappings":";;;;;;;;AAMA,wBAwFiB"}