swagger-typescript-api 13.0.3 → 13.0.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 (58) hide show
  1. package/README.md +310 -369
  2. package/cli/constants.js +3 -3
  3. package/cli/execute.js +12 -12
  4. package/cli/index.js +16 -16
  5. package/cli/operations/display-help.js +25 -25
  6. package/cli/parse-args.js +3 -3
  7. package/cli/process-option.js +11 -11
  8. package/index.d.ts +140 -45
  9. package/index.js +110 -111
  10. package/package.json +93 -108
  11. package/src/code-formatter.js +6 -6
  12. package/src/code-gen-process.js +45 -45
  13. package/src/commands/generate-templates/configuration.js +2 -2
  14. package/src/commands/generate-templates/index.js +1 -1
  15. package/src/commands/generate-templates/templates-gen-process.js +21 -21
  16. package/src/component-type-name-resolver.js +4 -4
  17. package/src/configuration.js +107 -107
  18. package/src/constants.js +26 -26
  19. package/src/index.js +3 -3
  20. package/src/schema-components-map.js +3 -3
  21. package/src/schema-parser/base-schema-parsers/array.js +3 -3
  22. package/src/schema-parser/base-schema-parsers/complex.js +5 -5
  23. package/src/schema-parser/base-schema-parsers/discriminator.js +12 -12
  24. package/src/schema-parser/base-schema-parsers/enum.js +12 -12
  25. package/src/schema-parser/base-schema-parsers/object.js +8 -8
  26. package/src/schema-parser/base-schema-parsers/primitive.js +3 -3
  27. package/src/schema-parser/complex-schema-parsers/all-of.js +2 -2
  28. package/src/schema-parser/complex-schema-parsers/any-of.js +2 -2
  29. package/src/schema-parser/complex-schema-parsers/not.js +1 -1
  30. package/src/schema-parser/complex-schema-parsers/one-of.js +2 -2
  31. package/src/schema-parser/mono-schema-parser.js +1 -1
  32. package/src/schema-parser/schema-formatters.js +14 -14
  33. package/src/schema-parser/schema-parser-fabric.js +5 -5
  34. package/src/schema-parser/schema-parser.js +24 -24
  35. package/src/schema-parser/schema-utils.js +21 -21
  36. package/src/schema-parser/util/enum-key-resolver.js +2 -2
  37. package/src/schema-routes/schema-routes.js +68 -68
  38. package/src/schema-routes/util/specific-arg-name-resolver.js +2 -2
  39. package/src/schema-walker.js +7 -7
  40. package/src/swagger-schema-resolver.js +16 -16
  41. package/src/templates-worker.js +21 -18
  42. package/src/translators/javascript.js +7 -7
  43. package/src/translators/translator.js +1 -1
  44. package/src/type-name-formatter.js +16 -16
  45. package/src/util/file-system.js +13 -14
  46. package/src/util/id.js +2 -2
  47. package/src/util/internal-case.js +1 -1
  48. package/src/util/logger.js +27 -27
  49. package/src/util/name-resolver.js +5 -5
  50. package/src/util/object-assign.js +2 -2
  51. package/src/util/pascal-case.js +1 -1
  52. package/src/util/request.js +15 -10
  53. package/templates/README.md +15 -14
  54. package/templates/base/README.md +4 -5
  55. package/templates/base/http-clients/fetch-http-client.ejs +1 -1
  56. package/templates/base/route-name.ejs +4 -4
  57. package/templates/default/README.md +4 -4
  58. package/templates/modular/README.md +4 -4
@@ -1,4 +1,4 @@
1
- const _ = require('lodash');
1
+ const _ = require("lodash");
2
2
 
3
3
  /**
4
4
  * @typedef {"enum-key" | "type-name"} FormattingSchemaType
@@ -30,27 +30,27 @@ class TypeNameFormatter {
30
30
  /**
31
31
  * @type {FormattingSchemaType}
32
32
  */
33
- const schemaType = options.type || 'type-name';
33
+ const schemaType = options.type || "type-name";
34
34
 
35
35
  const typePrefix =
36
- schemaType === 'enum-key'
36
+ schemaType === "enum-key"
37
37
  ? this.config.enumKeyPrefix
38
38
  : this.config.typePrefix;
39
39
  const typeSuffix =
40
- schemaType === 'enum-key'
40
+ schemaType === "enum-key"
41
41
  ? this.config.enumKeySuffix
42
42
  : this.config.typeSuffix;
43
43
 
44
44
  const hashKey = `${typePrefix}_${name}_${typeSuffix}`;
45
45
 
46
- if (typeof name !== 'string') {
47
- this.logger.warn('wrong name of the model name', name);
46
+ if (typeof name !== "string") {
47
+ this.logger.warn("wrong name of the model name", name);
48
48
  return name;
49
49
  }
50
50
 
51
51
  // constant names like LEFT_ARROW, RIGHT_FORWARD, ETC_KEY, _KEY_NUM_
52
52
  if (/^([A-Z_]{1,})$/g.test(name)) {
53
- return _.compact([typePrefix, name, typeSuffix]).join('_');
53
+ return _.compact([typePrefix, name, typeSuffix]).join("_");
54
54
  }
55
55
 
56
56
  if (this.formattedModelNamesMap.has(hashKey)) {
@@ -62,7 +62,7 @@ class TypeNameFormatter {
62
62
  const formattedName = _.replace(
63
63
  _.startCase(`${typePrefix}_${fixedModelName}_${typeSuffix}`),
64
64
  /\s/g,
65
- '',
65
+ "",
66
66
  );
67
67
  const formattedResultName =
68
68
  this.config.hooks.onFormatTypeName(formattedName, name, schemaType) ||
@@ -86,22 +86,22 @@ class TypeNameFormatter {
86
86
  if (!this.isValidName(name)) {
87
87
  if (!/^[a-zA-Z_$]/g.test(name)) {
88
88
  const fixPrefix =
89
- type === 'enum-key'
89
+ type === "enum-key"
90
90
  ? this.config.fixInvalidEnumKeyPrefix
91
91
  : this.config.fixInvalidTypeNamePrefix;
92
92
  name = `${fixPrefix} ${name}`;
93
93
  }
94
94
 
95
95
  // specific replaces for TSOA 3.x
96
- if (name.includes('.'))
96
+ if (name.includes("."))
97
97
  name = name
98
- .replace(/Exclude_keyof[A-Za-z]+/g, () => 'ExcludeKeys')
99
- .replace(/%22~AND~%22/g, 'And')
100
- .replace(/%22~OR~%22/g, 'Or')
101
- .replace(/(\.?%22)|\./g, '_')
102
- .replace(/__+$/, '');
98
+ .replace(/Exclude_keyof[A-Za-z]+/g, () => "ExcludeKeys")
99
+ .replace(/%22~AND~%22/g, "And")
100
+ .replace(/%22~OR~%22/g, "Or")
101
+ .replace(/(\.?%22)|\./g, "_")
102
+ .replace(/__+$/, "");
103
103
 
104
- if (name.includes('-')) name = _.startCase(name).replace(/ /g, '');
104
+ if (name.includes("-")) name = _.startCase(name).replace(/ /g, "");
105
105
  }
106
106
 
107
107
  return name;
@@ -1,8 +1,7 @@
1
- const fs = require('fs');
2
- const makeDir = require('make-dir');
3
- const { resolve } = require('path');
4
- const _ = require('lodash');
5
- const { Logger } = require('./logger');
1
+ const fs = require("node:fs");
2
+ const { resolve } = require("node:path");
3
+ const _ = require("lodash");
4
+ const { Logger } = require("./logger");
6
5
 
7
6
  const FILE_PREFIX = `/* eslint-disable */
8
7
  /* tslint:disable */
@@ -21,12 +20,12 @@ class FileSystem {
21
20
  /** @type {Logger} */
22
21
  logger;
23
22
 
24
- constructor({ logger = new Logger('file-system') } = {}) {
23
+ constructor({ logger = new Logger("file-system") } = {}) {
25
24
  this.logger = logger;
26
25
  }
27
26
 
28
27
  getFileContent = (path) => {
29
- return fs.readFileSync(path, { encoding: 'UTF-8' });
28
+ return fs.readFileSync(path, { encoding: "UTF-8" });
30
29
  };
31
30
 
32
31
  readDir = (path) => {
@@ -45,32 +44,32 @@ class FileSystem {
45
44
  };
46
45
 
47
46
  cropExtension = (fileName) => {
48
- const fileNameParts = _.split(fileName, '.');
47
+ const fileNameParts = _.split(fileName, ".");
49
48
 
50
49
  if (fileNameParts.length > 1) {
51
50
  fileNameParts.pop();
52
51
  }
53
52
 
54
- return fileNameParts.join('.');
53
+ return fileNameParts.join(".");
55
54
  };
56
55
 
57
56
  removeDir = (path) => {
58
57
  try {
59
- if (typeof fs.rmSync === 'function') {
58
+ if (typeof fs.rmSync === "function") {
60
59
  fs.rmSync(path, { recursive: true });
61
60
  } else {
62
61
  fs.rmdirSync(path, { recursive: true });
63
62
  }
64
63
  } catch (e) {
65
- this.logger.debug('failed to remove dir', e);
64
+ this.logger.debug("failed to remove dir", e);
66
65
  }
67
66
  };
68
67
 
69
68
  createDir = (path) => {
70
69
  try {
71
- makeDir.sync(path);
70
+ fs.mkdirSync(path, { recursive: true });
72
71
  } catch (e) {
73
- this.logger.debug('failed to create dir', e);
72
+ this.logger.debug("failed to create dir", e);
74
73
  }
75
74
  };
76
75
 
@@ -85,7 +84,7 @@ class FileSystem {
85
84
 
86
85
  createFile = ({ path, fileName, content, withPrefix }) => {
87
86
  const absolutePath = resolve(__dirname, path, `./${fileName}`);
88
- const fileContent = `${withPrefix ? FILE_PREFIX : ''}${content}`;
87
+ const fileContent = `${withPrefix ? FILE_PREFIX : ""}${content}`;
89
88
 
90
89
  return fs.writeFileSync(absolutePath, fileContent, _.noop);
91
90
  };
package/src/util/id.js CHANGED
@@ -1,6 +1,6 @@
1
- const { customAlphabet } = require('nanoid');
1
+ const { customAlphabet } = require("nanoid");
2
2
 
3
- const ALPHABET = 'abcdefghijklmnopqrstuvwxyz0123456789';
3
+ const ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789";
4
4
 
5
5
  const generateId = customAlphabet(ALPHABET, 12);
6
6
 
@@ -1,4 +1,4 @@
1
- const _ = require('lodash');
1
+ const _ = require("lodash");
2
2
 
3
3
  module.exports = {
4
4
  internalCase: (value) => _.camelCase(_.lowerCase(value)),
@@ -1,5 +1,5 @@
1
- const { emojify } = require('node-emoji');
2
- const _ = require('lodash');
1
+ const { emojify } = require("node-emoji");
2
+ const _ = require("lodash");
3
3
 
4
4
  class Logger {
5
5
  firstLog = true;
@@ -22,43 +22,43 @@ class Logger {
22
22
  this.log(
23
23
  `swagger-typescript-api(${this.config.version}),${
24
24
  process.env.npm_config_user_agent || `nodejs(${process.version})`
25
- },debug mode ${this.config.debug ? 'ENABLED' : 'DISABLED'}`,
25
+ },debug mode ${this.config.debug ? "ENABLED" : "DISABLED"}`,
26
26
  );
27
27
  }
28
28
 
29
- if (type === 'debug' || this.config.debug) {
29
+ if (type === "debug" || this.config.debug) {
30
30
  const trace = new Error().stack
31
- .split('\n')
31
+ .split("\n")
32
32
  .splice(3)
33
33
  .filter(
34
34
  (line) =>
35
- !line.includes('swagger-typescript-api\\node_modules') &&
36
- !line.includes('swagger-typescript-api/node_modules'),
35
+ !line.includes("swagger-typescript-api\\node_modules") &&
36
+ !line.includes("swagger-typescript-api/node_modules"),
37
37
  )
38
38
  .slice(0, 10);
39
39
  const logFn = console[type] || console.log;
40
40
  logFn(`${emoji} [${type}]`, new Date().toISOString());
41
41
  if (this.config.debugExtras && Array.isArray(this.config.debugExtras)) {
42
- logFn(`[${this.config.debugExtras.join(' ')}]`);
42
+ logFn(`[${this.config.debugExtras.join(" ")}]`);
43
43
  }
44
44
  logFn(
45
- '[message]',
45
+ "[message]",
46
46
  ..._.map(messages, (message) =>
47
- _.startsWith(message, '\n')
48
- ? `\n ${message.replace(/\n/, '')}`
47
+ _.startsWith(message, "\n")
48
+ ? `\n ${message.replace(/\n/, "")}`
49
49
  : message,
50
50
  ),
51
51
  );
52
- logFn(trace.join('\n') + '\n---');
52
+ logFn(trace.join("\n") + "\n---");
53
53
  return;
54
54
  }
55
55
 
56
56
  console[type](
57
57
  emoji,
58
- ' ',
58
+ " ",
59
59
  ..._.map(messages, (message) =>
60
- _.startsWith(message, '\n')
61
- ? `\n${emoji} ${message.replace(/\n/, '')}`
60
+ _.startsWith(message, "\n")
61
+ ? `\n${emoji} ${message.replace(/\n/, "")}`
62
62
  : message,
63
63
  ),
64
64
  );
@@ -70,8 +70,8 @@ class Logger {
70
70
  */
71
71
  log = (...messages) =>
72
72
  this.createLogMessage({
73
- type: 'log',
74
- emojiName: ':sparkles:',
73
+ type: "log",
74
+ emojiName: ":sparkles:",
75
75
  messages,
76
76
  });
77
77
 
@@ -82,8 +82,8 @@ class Logger {
82
82
  */
83
83
  event = (...messages) =>
84
84
  this.createLogMessage({
85
- type: 'log',
86
- emojiName: ':star:',
85
+ type: "log",
86
+ emojiName: ":star:",
87
87
  messages,
88
88
  });
89
89
 
@@ -94,8 +94,8 @@ class Logger {
94
94
  */
95
95
  success = (...messages) =>
96
96
  this.createLogMessage({
97
- type: 'log',
98
- emojiName: ':white_check_mark:',
97
+ type: "log",
98
+ emojiName: ":white_check_mark:",
99
99
  messages,
100
100
  });
101
101
 
@@ -106,8 +106,8 @@ class Logger {
106
106
  */
107
107
  warn = (...messages) =>
108
108
  this.createLogMessage({
109
- type: 'warn',
110
- emojiName: ':exclamation:',
109
+ type: "warn",
110
+ emojiName: ":exclamation:",
111
111
  messages,
112
112
  });
113
113
 
@@ -118,8 +118,8 @@ class Logger {
118
118
  */
119
119
  error = (...messages) =>
120
120
  this.createLogMessage({
121
- type: 'error',
122
- emojiName: ':no_entry:',
121
+ type: "error",
122
+ emojiName: ":no_entry:",
123
123
  messages,
124
124
  });
125
125
 
@@ -132,8 +132,8 @@ class Logger {
132
132
  if (!this.config.debug) return;
133
133
 
134
134
  this.createLogMessage({
135
- type: 'debug',
136
- emojiName: ':black_large_square:',
135
+ type: "debug",
136
+ emojiName: ":black_large_square:",
137
137
  messages,
138
138
  });
139
139
  };
@@ -1,4 +1,4 @@
1
- const _ = require('lodash');
1
+ const _ = require("lodash");
2
2
 
3
3
  class NameResolver {
4
4
  reservedNames = [];
@@ -51,14 +51,14 @@ class NameResolver {
51
51
  * @returns {string | null}
52
52
  */
53
53
  resolve(variants, resolver, extras, shouldReserve = true) {
54
- if (typeof resolver === 'function') {
54
+ if (typeof resolver === "function") {
55
55
  let usageName = null;
56
56
  while (usageName === null) {
57
57
  const variant = resolver(variants, extras);
58
58
 
59
59
  if (variant === undefined) {
60
60
  this.logger.warn(
61
- 'unable to resolve name. current reserved names: ',
61
+ "unable to resolve name. current reserved names: ",
62
62
  this.reservedNames,
63
63
  );
64
64
  return null;
@@ -86,14 +86,14 @@ class NameResolver {
86
86
  }
87
87
 
88
88
  this.logger.debug(
89
- 'trying to resolve name with using fallback name generator using variants',
89
+ "trying to resolve name with using fallback name generator using variants",
90
90
  variants,
91
91
  );
92
92
  return this.resolve(variants, this.getFallbackName, extras);
93
93
  }
94
94
 
95
95
  this.logger.debug(
96
- 'problem with reserving names. current reserved names: ',
96
+ "problem with reserving names. current reserved names: ",
97
97
  this.reservedNames,
98
98
  );
99
99
  return null;
@@ -1,9 +1,9 @@
1
- const _ = require('lodash');
1
+ const _ = require("lodash");
2
2
 
3
3
  const objectAssign = (target, updaterFn) => {
4
4
  if (!updaterFn) return;
5
5
  const update =
6
- typeof updaterFn === 'function' ? updaterFn(target) : updaterFn;
6
+ typeof updaterFn === "function" ? updaterFn(target) : updaterFn;
7
7
  const undefinedKeys = _.map(
8
8
  update,
9
9
  (value, key) => value === undefined && key,
@@ -1,4 +1,4 @@
1
- const _ = require('lodash');
1
+ const _ = require("lodash");
2
2
 
3
3
  module.exports = {
4
4
  pascalCase: (value) => _.upperFirst(_.camelCase(value)),
@@ -1,6 +1,4 @@
1
- const _ = require('lodash');
2
- const https = require('https');
3
- const fetch = require('node-fetch-h2');
1
+ const _ = require("lodash");
4
2
 
5
3
  class Request {
6
4
  /**
@@ -18,23 +16,30 @@ class Request {
18
16
  }
19
17
 
20
18
  /**
21
- *
22
19
  * @param url {string}
23
20
  * @param disableStrictSSL
24
21
  * @param authToken
25
- * @param options {Partial<import("node-fetch").RequestInit>}
22
+ * @param options {Partial<RequestInit>}
26
23
  * @return {Promise<string>}
27
24
  */
28
25
  async download({ url, disableStrictSSL, authToken, ...options }) {
29
26
  /**
30
- * @type {Partial<import("node-fetch").RequestInit>}
27
+ * @type {Partial<RequestInit>}
31
28
  */
32
29
  const requestOptions = {};
33
30
 
34
- if (disableStrictSSL && !_.startsWith(url, 'http://')) {
35
- requestOptions.agent = new https.Agent({
36
- rejectUnauthorized: false,
31
+ if (disableStrictSSL && !_.startsWith(url, "http://")) {
32
+ const undiciGlobalDispatcher =
33
+ global[Symbol.for("undici.globalDispatcher.1")];
34
+ if (!undiciGlobalDispatcher) {
35
+ throw new Error("Could not find the global Undici dispatcher");
36
+ }
37
+ const newDispatcher = new undiciGlobalDispatcher.constructor({
38
+ connect: {
39
+ rejectUnauthorized: false,
40
+ },
37
41
  });
42
+ global[unidiciGlobalDispatcherSymbol] = newDispatcher;
38
43
  }
39
44
  if (authToken) {
40
45
  requestOptions.headers = {
@@ -49,7 +54,7 @@ class Request {
49
54
  return await response.text();
50
55
  } catch (error) {
51
56
  const message = `error while fetching data from URL "${url}"`;
52
- this.logger.error(message, 'response' in error ? error.response : error);
57
+ this.logger.error(message, "response" in error ? error.response : error);
53
58
  return message;
54
59
  }
55
60
  }
@@ -1,17 +1,18 @@
1
- # swagger-typescript-api
1
+ # swagger-typescript-api
2
2
 
3
- # templates
3
+ # templates
4
4
 
5
- Templates:
6
- - `api.ejs` - *(generates file)* Api class module (locations: [default](https://github.com/acacode/swagger-typescript-api/tree/next/templates/default/api.ejs), [modular](https://github.com/acacode/swagger-typescript-api/tree/next/templates/modular/api.ejs))
7
- - `data-contracts.ejs` - *(generates file)* all types (data contracts) from swagger schema (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/data-contracts.ejs))
8
- - `http-client.ejs` - *(generates file)* HttpClient class module (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/http-client.ejs))
9
- - `procedure-call.ejs` - *(subtemplate)* route in Api class (locations: [default](https://github.com/acacode/swagger-typescript-api/tree/next/templates/default/procedure-call.ejs), [modular](https://github.com/acacode/swagger-typescript-api/tree/next/templates/modular/procedure-call.ejs))
10
- - `route-docs.ejs` - *(generates file)* documentation for route in Api class (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/route-docs.ejs))
11
- - `route-name.ejs` - *(subtemplate)* route name for route in Api class (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/route-name.ejs))
12
- - `route-type.ejs` - *(`--route-types` option)* *(subtemplate)* (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/route-type.ejs))
13
- - `route-types.ejs` - *(`--route-types` option)* *(subtemplate)* (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/route-types.ejs)) - `data-contract-jsdoc.ejs` - *(subtemplate)* generates JSDOC for data contract (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/data-contract-jsdoc.ejs))
5
+ Templates:
14
6
 
15
- [//]: # (- `enum-data-contract.ejs` - *&#40;subtemplate&#41;* generates `enum` data contract &#40;locations: [base]&#40;https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/enum-data-contract.ejs&#41;&#41;)
16
- [//]: # (- `interface-data-contract.ejs` - *&#40;subtemplate&#41;* generates `interface` data contract &#40;locations: [base]&#40;https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/interface-data-contract.ejs&#41;&#41;)
17
- [//]: # (- `type-data-contract.ejs` - *&#40;subtemplate&#41;* generates `type` data contract &#40;locations: [base]&#40;https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/type-data-contract.ejs&#41;&#41;)
7
+ - `api.ejs` - _(generates file)_ Api class module (locations: [default](https://github.com/acacode/swagger-typescript-api/tree/main/templates/default/api.ejs), [modular](https://github.com/acacode/swagger-typescript-api/tree/main/templates/modular/api.ejs))
8
+ - `data-contracts.ejs` - _(generates file)_ all types (data contracts) from swagger schema (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/data-contracts.ejs))
9
+ - `http-client.ejs` - _(generates file)_ HttpClient class module (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/http-client.ejs))
10
+ - `procedure-call.ejs` - _(subtemplate)_ route in Api class (locations: [default](https://github.com/acacode/swagger-typescript-api/tree/main/templates/default/procedure-call.ejs), [modular](https://github.com/acacode/swagger-typescript-api/tree/main/templates/modular/procedure-call.ejs))
11
+ - `route-docs.ejs` - _(generates file)_ documentation for route in Api class (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/route-docs.ejs))
12
+ - `route-name.ejs` - _(subtemplate)_ route name for route in Api class (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/route-name.ejs))
13
+ - `route-type.ejs` - _(`--route-types` option)_ _(subtemplate)_ (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/route-type.ejs))
14
+ - `route-types.ejs` - _(`--route-types` option)_ _(subtemplate)_ (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/route-types.ejs)) - `data-contract-jsdoc.ejs` - _(subtemplate)_ generates JSDOC for data contract (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/data-contract-jsdoc.ejs))
15
+
16
+ [//]: # "- `enum-data-contract.ejs` - *(subtemplate)* generates `enum` data contract (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/enum-data-contract.ejs))"
17
+ [//]: # "- `interface-data-contract.ejs` - *(subtemplate)* generates `interface` data contract (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/interface-data-contract.ejs))"
18
+ [//]: # "- `type-data-contract.ejs` - *(subtemplate)* generates `type` data contract (locations: [base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/type-data-contract.ejs))"
@@ -1,8 +1,7 @@
1
- # swagger-typescript-api
1
+ # swagger-typescript-api
2
2
 
3
- # templates/base
3
+ # templates/base
4
4
 
5
- This templates use both for multiple api files and single api file
5
+ This templates use both for multiple api files and single api file
6
6
 
7
-
8
- path prefix `@base`
7
+ path prefix `@base`
@@ -189,7 +189,7 @@ export class HttpClient<SecurityDataType = unknown> {
189
189
  body: typeof body === "undefined" || body === null ? null : payloadFormatter(body),
190
190
  }
191
191
  ).then(async (response) => {
192
- const r = response as HttpResponse<T, E>;
192
+ const r = response.clone() as HttpResponse<T, E>;
193
193
  r.data = (null as unknown) as T;
194
194
  r.error = (null as unknown) as E;
195
195
 
@@ -24,10 +24,10 @@ const methodAliases = {
24
24
 
25
25
  const createCustomOperationId = (method, route, moduleName) => {
26
26
  const hasPathInserts = /\{(\w){1,}\}/g.test(route);
27
- const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/"));
28
- const routeParts = (splitedRouteBySlash.length > 1
29
- ? splitedRouteBySlash.splice(1)
30
- : splitedRouteBySlash
27
+ const splittedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/"));
28
+ const routeParts = (splittedRouteBySlash.length > 1
29
+ ? splittedRouteBySlash.splice(1)
30
+ : splittedRouteBySlash
31
31
  ).join("_");
32
32
  return routeParts.length > 3 && methodAliases[method]
33
33
  ? methodAliases[method](routeParts, hasPathInserts)
@@ -1,7 +1,7 @@
1
- # swagger-typescript-api
1
+ # swagger-typescript-api
2
2
 
3
- # templates/default
3
+ # templates/default
4
4
 
5
- This templates use for single api file (without `--modular` option)
5
+ This templates use for single api file (without `--modular` option)
6
6
 
7
- path prefix `@default`
7
+ path prefix `@default`
@@ -1,7 +1,7 @@
1
- # swagger-typescript-api
1
+ # swagger-typescript-api
2
2
 
3
- # templates/modular
3
+ # templates/modular
4
4
 
5
- This templates use for multiple api files (`--modular` option)
5
+ This templates use for multiple api files (`--modular` option)
6
6
 
7
- path prefix `@modular`
7
+ path prefix `@modular`