swagger-typescript-api 10.0.2 → 11.0.0--alpha

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 (55) hide show
  1. package/README.md +263 -41
  2. package/index.d.ts +97 -0
  3. package/index.js +242 -115
  4. package/package.json +121 -116
  5. package/src/code-formatter.js +101 -0
  6. package/src/code-gen-process.js +456 -0
  7. package/src/configuration.js +425 -0
  8. package/src/constants.js +14 -31
  9. package/src/index.js +20 -271
  10. package/src/schema-components-map.js +60 -0
  11. package/src/schema-parser/schema-formatters.js +145 -0
  12. package/src/schema-parser/schema-parser.js +497 -0
  13. package/src/schema-parser/schema-routes.js +902 -0
  14. package/src/swagger-schema-resolver.js +187 -0
  15. package/src/templates.js +174 -155
  16. package/src/translators/JavaScript.js +3 -14
  17. package/src/type-name.js +79 -0
  18. package/src/util/file-system.js +76 -0
  19. package/src/{utils → util}/id.js +9 -9
  20. package/src/util/internal-case.js +5 -0
  21. package/src/util/logger.js +100 -0
  22. package/src/{utils/resolveName.js → util/name-resolver.js} +94 -97
  23. package/src/util/object-assign.js +11 -0
  24. package/src/util/pascal-case.js +5 -0
  25. package/src/{utils → util}/random.js +14 -14
  26. package/templates/base/data-contract-jsdoc.ejs +29 -24
  27. package/templates/base/data-contracts.ejs +3 -3
  28. package/templates/base/interface-data-contract.ejs +1 -0
  29. package/templates/base/route-docs.ejs +3 -4
  30. package/templates/base/route-type.ejs +2 -2
  31. package/templates/default/procedure-call.ejs +2 -2
  32. package/templates/default/route-types.ejs +2 -2
  33. package/templates/modular/api.ejs +2 -2
  34. package/templates/modular/procedure-call.ejs +2 -2
  35. package/templates/modular/route-types.ejs +2 -2
  36. package/src/apiConfig.js +0 -30
  37. package/src/common.js +0 -28
  38. package/src/components.js +0 -91
  39. package/src/config.js +0 -106
  40. package/src/filePrefix.js +0 -14
  41. package/src/files.js +0 -56
  42. package/src/formatFileContent.js +0 -81
  43. package/src/logger.js +0 -59
  44. package/src/modelNames.js +0 -78
  45. package/src/modelTypes.js +0 -31
  46. package/src/output.js +0 -165
  47. package/src/prettierOptions.js +0 -23
  48. package/src/render/utils/fmtToJSDocLine.js +0 -10
  49. package/src/render/utils/index.js +0 -31
  50. package/src/render/utils/templateRequire.js +0 -17
  51. package/src/routeNames.js +0 -46
  52. package/src/routes.js +0 -809
  53. package/src/schema.js +0 -474
  54. package/src/swagger.js +0 -152
  55. package/src/typeFormatters.js +0 -121
@@ -0,0 +1,76 @@
1
+ const fs = require("fs");
2
+ const makeDir = require("make-dir");
3
+ const { resolve } = require("path");
4
+ const _ = require("lodash");
5
+
6
+ const FILE_PREFIX = `/* eslint-disable */
7
+ /* tslint:disable */
8
+ /*
9
+ * ---------------------------------------------------------------
10
+ * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
11
+ * ## ##
12
+ * ## AUTHOR: acacode ##
13
+ * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
14
+ * ---------------------------------------------------------------
15
+ */
16
+
17
+ `;
18
+
19
+ class FileSystem {
20
+ constructor() {}
21
+
22
+ getFileContent = (path) => {
23
+ return fs.readFileSync(path, { encoding: "UTF-8" });
24
+ };
25
+
26
+ pathIsDir = (path) => {
27
+ if (!path) return false;
28
+
29
+ try {
30
+ const stat = fs.statSync(path);
31
+ return stat.isDirectory();
32
+ } catch (e) {
33
+ return false;
34
+ }
35
+ };
36
+
37
+ cropExtension = (fileName) => {
38
+ const fileNameParts = _.split(fileName, ".");
39
+
40
+ if (fileNameParts.length > 1) {
41
+ fileNameParts.pop();
42
+ }
43
+
44
+ return fileNameParts.join(".");
45
+ };
46
+
47
+ removeDir = (path) => {
48
+ try {
49
+ if (typeof fs.rmSync === "function") {
50
+ fs.rmSync(path, { recursive: true });
51
+ } else {
52
+ fs.rmdirSync(path, { recursive: true });
53
+ }
54
+ } catch (e) {}
55
+ };
56
+
57
+ createDir = (path) => {
58
+ try {
59
+ makeDir.sync(path);
60
+ } catch (e) {}
61
+ };
62
+
63
+ cleanDir = (path) => {
64
+ removeDir(path);
65
+ createDir(path);
66
+ };
67
+
68
+ pathIsExist = (path) => path && fs.existsSync(path);
69
+
70
+ createFile = ({ path, fileName, content, withPrefix }) =>
71
+ fs.writeFileSync(resolve(__dirname, path, `./${fileName}`), `${withPrefix ? FILE_PREFIX : ""}${content}`, _.noop);
72
+ }
73
+
74
+ module.exports = {
75
+ FileSystem,
76
+ };
@@ -1,9 +1,9 @@
1
- const { customAlphabet } = require("nanoid");
2
-
3
- const ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789";
4
-
5
- const generateId = customAlphabet(ALPHABET, 12);
6
-
7
- module.exports = {
8
- generateId,
9
- };
1
+ const { customAlphabet } = require("nanoid");
2
+
3
+ const ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789";
4
+
5
+ const generateId = customAlphabet(ALPHABET, 12);
6
+
7
+ module.exports = {
8
+ generateId,
9
+ };
@@ -0,0 +1,5 @@
1
+ const _ = require("lodash");
2
+
3
+ module.exports = {
4
+ internalCase: (value) => _.camelCase(_.lowerCase(value)),
5
+ };
@@ -0,0 +1,100 @@
1
+ const { emojify } = require("node-emoji");
2
+ const _ = require("lodash");
3
+
4
+ class Logger {
5
+ firstLog = true;
6
+ /**
7
+ * @type {Configuration}
8
+ */
9
+ config;
10
+
11
+ constructor(config) {
12
+ this.config = config;
13
+ }
14
+
15
+ createLogMessage = ({ type, emojiName, messages }) => {
16
+ if (this.config.silent) return;
17
+
18
+ const emoji = emojify(emojiName);
19
+
20
+ if (this.firstLog) {
21
+ this.firstLog = false;
22
+ this.log(
23
+ `swagger-typescript-api(${this.config.version}),${
24
+ process.env.npm_config_user_agent || `nodejs(${process.version})`
25
+ }`,
26
+ );
27
+ }
28
+
29
+ console[type](
30
+ emoji,
31
+ " ",
32
+ ..._.map(messages, (message) =>
33
+ _.startsWith(message, "\n") ? `\n${emoji} ${message.replace(/\n/, "")}` : message,
34
+ ),
35
+ );
36
+ };
37
+
38
+ /**
39
+ *
40
+ * @param messages {any[]}
41
+ */
42
+ log = (...messages) =>
43
+ this.createLogMessage({
44
+ type: "log",
45
+ emojiName: ":sparkles:",
46
+ messages,
47
+ });
48
+
49
+ /**
50
+ *
51
+ * @param messages {any[]}
52
+ * @return {void}
53
+ */
54
+ event = (...messages) =>
55
+ this.createLogMessage({
56
+ type: "log",
57
+ emojiName: ":comet: ",
58
+ messages,
59
+ });
60
+
61
+ /**
62
+ *
63
+ * @param messages {any[]}
64
+ * @return {void}
65
+ */
66
+ success = (...messages) =>
67
+ this.createLogMessage({
68
+ type: "log",
69
+ emojiName: ":white_check_mark:",
70
+ messages,
71
+ });
72
+
73
+ /**
74
+ *
75
+ * @param messages {any[]}
76
+ * @return {void}
77
+ */
78
+ warn = (...messages) =>
79
+ this.createLogMessage({
80
+ type: "warn",
81
+ emojiName: ":warning: ",
82
+ messages,
83
+ });
84
+
85
+ /**
86
+ *
87
+ * @param messages {any[]}
88
+ * @return {void}
89
+ */
90
+ error = (...messages) =>
91
+ this.createLogMessage({
92
+ type: "error",
93
+ emojiName: ":exclamation:",
94
+ messages,
95
+ });
96
+ }
97
+
98
+ module.exports = {
99
+ Logger,
100
+ };
@@ -1,97 +1,94 @@
1
- const _ = require("lodash");
2
- const { getRandomInt } = require("./random");
3
-
4
- class NameResolver {
5
- reservedNames = [];
6
- getDefaultName = null;
7
-
8
- /**
9
- *
10
- * @param {string[]} reservedNames
11
- */
12
- constructor(reservedNames, getDefaultName) {
13
- this.getDefaultName = getDefaultName;
14
- this.reserve(reservedNames);
15
- }
16
-
17
- /**
18
- *
19
- * @param {string[]} names
20
- */
21
- reserve(names) {
22
- this.reservedNames.push(..._.uniq(_.compact(names)));
23
- }
24
-
25
- unreserve(names) {
26
- this.reservedNames.filter((reservedName) => !names.some((name) => name === reservedName));
27
- }
28
-
29
- isReserved(name) {
30
- return _.some(this.reservedNames, (reservedName) => reservedName === name);
31
- }
32
-
33
- /**
34
- *
35
- * @param {string[]} variants
36
- * @param {((variant: string) => string) | undefined} onSelectMutation
37
- * @returns {string | null}
38
- */
39
- resolve(variants, onSelectMutation) {
40
- let usageName = null;
41
- const uniqVariants = _.uniq(_.compact(variants));
42
-
43
- _.forEach(uniqVariants, (variant) => {
44
- const mutatedVariant = onSelectMutation ? onSelectMutation(variant) : variant;
45
- if (!usageName && !this.isReserved(mutatedVariant)) {
46
- usageName = mutatedVariant;
47
- }
48
- });
49
-
50
- if (usageName) {
51
- this.reserve([usageName]);
52
- return usageName;
53
- }
54
-
55
- const defaultName = this.getDefaultName && this.getDefaultName(variants);
56
-
57
- if (defaultName) {
58
- this.reserve([onSelectMutation ? onSelectMutation(defaultName) : defaultName]);
59
- return defaultName;
60
- }
61
-
62
- return null;
63
- }
64
- }
65
-
66
- class SpecificArgNameResolver extends NameResolver {
67
- /**
68
- *
69
- * @param {string[]} reservedNames
70
- */
71
- constructor(reservedNames) {
72
- super(reservedNames, (variants) => {
73
- return (variants[0] && `${variants[0]}${getRandomInt(1, 10)}`) || `arg${getRandomInt(1, 10)}`;
74
- });
75
- }
76
- }
77
-
78
- class ComponentTypeNameResolver extends NameResolver {
79
- /**
80
- *
81
- * @param {string[]} reservedNames
82
- */
83
- constructor(reservedNames) {
84
- super(reservedNames, (variants) => {
85
- return (
86
- (variants[0] && `${variants[0]}${getRandomInt(1, 10)}`) ||
87
- `ComponentType${getRandomInt(1, 10)}`
88
- );
89
- });
90
- }
91
- }
92
-
93
- module.exports = {
94
- NameResolver,
95
- SpecificArgNameResolver,
96
- ComponentTypeNameResolver,
97
- };
1
+ const _ = require("lodash");
2
+ const { getRandomInt } = require("./random.js");
3
+
4
+ class NameResolver {
5
+ reservedNames = [];
6
+ getDefaultName = null;
7
+
8
+ /**
9
+ *
10
+ * @param {string[]} reservedNames
11
+ */
12
+ constructor(reservedNames, getDefaultName) {
13
+ this.getDefaultName = getDefaultName;
14
+ this.reserve(reservedNames);
15
+ }
16
+
17
+ /**
18
+ *
19
+ * @param {string[]} names
20
+ */
21
+ reserve(names) {
22
+ this.reservedNames.push(..._.uniq(_.compact(names)));
23
+ }
24
+
25
+ unreserve(names) {
26
+ this.reservedNames.filter((reservedName) => !names.some((name) => name === reservedName));
27
+ }
28
+
29
+ isReserved(name) {
30
+ return _.some(this.reservedNames, (reservedName) => reservedName === name);
31
+ }
32
+
33
+ /**
34
+ *
35
+ * @param {string[]} variants
36
+ * @param {((variant: string) => string) | undefined} onSelectMutation
37
+ * @returns {string | null}
38
+ */
39
+ resolve(variants, onSelectMutation) {
40
+ let usageName = null;
41
+ const uniqVariants = _.uniq(_.compact(variants));
42
+
43
+ _.forEach(uniqVariants, (variant) => {
44
+ const mutatedVariant = onSelectMutation ? onSelectMutation(variant) : variant;
45
+ if (!usageName && !this.isReserved(mutatedVariant)) {
46
+ usageName = mutatedVariant;
47
+ }
48
+ });
49
+
50
+ if (usageName) {
51
+ this.reserve([usageName]);
52
+ return usageName;
53
+ }
54
+
55
+ const defaultName = this.getDefaultName && this.getDefaultName(variants);
56
+
57
+ if (defaultName) {
58
+ this.reserve([onSelectMutation ? onSelectMutation(defaultName) : defaultName]);
59
+ return defaultName;
60
+ }
61
+
62
+ return null;
63
+ }
64
+ }
65
+
66
+ class SpecificArgNameResolver extends NameResolver {
67
+ /**
68
+ *
69
+ * @param {string[]} reservedNames
70
+ */
71
+ constructor(reservedNames) {
72
+ super(reservedNames, (variants) => {
73
+ return (variants[0] && `${variants[0]}${getRandomInt(1, 10)}`) || `arg${getRandomInt(1, 10)}`;
74
+ });
75
+ }
76
+ }
77
+
78
+ class ComponentTypeNameResolver extends NameResolver {
79
+ /**
80
+ *
81
+ * @param {string[]} reservedNames
82
+ */
83
+ constructor(reservedNames) {
84
+ super(reservedNames, (variants) => {
85
+ return (variants[0] && `${variants[0]}${getRandomInt(1, 10)}`) || `ComponentType${getRandomInt(1, 10)}`;
86
+ });
87
+ }
88
+ }
89
+
90
+ module.exports = {
91
+ NameResolver,
92
+ SpecificArgNameResolver,
93
+ ComponentTypeNameResolver,
94
+ };
@@ -0,0 +1,11 @@
1
+ const _ = require("lodash");
2
+
3
+ const objectAssign = (target, updaterFn) => {
4
+ if (!updaterFn) return;
5
+ const updated = typeof updaterFn === "function" ? updaterFn(target) : updaterFn;
6
+ Object.assign(target, _.merge(target, updated));
7
+ };
8
+
9
+ module.exports = {
10
+ objectAssign,
11
+ };
@@ -0,0 +1,5 @@
1
+ const _ = require("lodash");
2
+
3
+ module.exports = {
4
+ pascalCase: (value) => _.upperFirst(_.camelCase(value)),
5
+ };
@@ -1,14 +1,14 @@
1
- const getRandomFloat = (min = 0, max = 1) => {
2
- return Math.random() * (max - min) + min;
3
- };
4
-
5
- const getRandomInt = (min = 0, max = 1) => {
6
- if (min === max) return min;
7
-
8
- return Math.round(getRandomFloat(min, max));
9
- };
10
-
11
- module.exports = {
12
- getRandomFloat,
13
- getRandomInt,
14
- };
1
+ const getRandomFloat = (min = 0, max = 1) => {
2
+ return Math.random() * (max - min) + min;
3
+ };
4
+
5
+ const getRandomInt = (min = 0, max = 1) => {
6
+ if (min === max) return min;
7
+
8
+ return Math.round(getRandomFloat(min, max));
9
+ };
10
+
11
+ module.exports = {
12
+ getRandomInt,
13
+ getRandomFloat,
14
+ };
@@ -1,32 +1,37 @@
1
1
  <%
2
- const { contract, utils } = it;
2
+ const { data, utils } = it;
3
3
  const { formatDescription, require, _ } = utils;
4
4
 
5
- let jsDocLines = [];
5
+ const stringify = (value) => _.isObject(value) ? JSON.stringify(value) : _.isString(value) ? `"${value}"` : value
6
6
 
7
- jsDocLines.push(
8
- contract.title,
9
- contract.description && formatDescription(contract.description),
10
- )
11
-
12
- if (contract.typeData) {
13
- jsDocLines.push(
14
- contract.typeData.deprecated === true && '@deprecated',
15
- !_.isUndefined(contract.typeData.format) && `@format ${contract.typeData.format}`,
16
- !_.isUndefined(contract.typeData.minimum) && `@min ${contract.typeData.minimum}`,
17
- !_.isUndefined(contract.typeData.maximum) && `@max ${contract.typeData.maximum}`,
18
- !_.isUndefined(contract.typeData.pattern) && `@pattern ${contract.typeData.pattern}`,
19
- !_.isUndefined(contract.typeData.example) && `@example ${
20
- _.isObject(contract.typeData.example) ? JSON.stringify(contract.typeData.example) : contract.typeData.example
21
- }`
22
- )
23
- }
24
-
25
- jsDocLines = _.compact(jsDocLines);
7
+ const jsDocLines = _.compact([
8
+ data.title,
9
+ data.description && formatDescription(data.description),
10
+ data.deprecated === true && '@deprecated',
11
+ !_.isUndefined(data.format) && `@format ${data.format}`,
12
+ !_.isUndefined(data.minimum) && `@min ${data.minimum}`,
13
+ !_.isUndefined(data.multipleOf) && `@multipleOf ${data.multipleOf}`,
14
+ !_.isUndefined(data.exclusiveMinimum) && `@exclusiveMin ${data.exclusiveMinimum}`,
15
+ !_.isUndefined(data.maximum) && `@max ${data.maximum}`,
16
+ !_.isUndefined(data.minLength) && `@minLength ${data.minLength}`,
17
+ !_.isUndefined(data.maxLength) && `@maxLength ${data.maxLength}`,
18
+ !_.isUndefined(data.exclusiveMaximum) && `@exclusiveMax ${data.exclusiveMaximum}`,
19
+ !_.isUndefined(data.maxItems) && `@maxItems ${data.maxItems}`,
20
+ !_.isUndefined(data.minItems) && `@minItems ${data.minItems}`,
21
+ !_.isUndefined(data.uniqueItems) && `@uniqueItems ${data.uniqueItems}`,
22
+ !_.isUndefined(data.default) && `@default ${stringify(data.default)}`,
23
+ !_.isUndefined(data.pattern) && `@pattern ${data.pattern}`,
24
+ !_.isUndefined(data.example) && `@example ${stringify(data.example)}`
25
+ ]).join('\n').split('\n');
26
26
  %>
27
- <% if (jsDocLines.length) { %>
27
+ <% if (jsDocLines.every(_.isEmpty)) { %>
28
+ <% } else if (jsDocLines.length === 1) { %>
29
+ /** <%~ jsDocLines[0] %> */
30
+ <% } else if (jsDocLines.length) { %>
28
31
  /**
29
- <%~ jsDocLines.map(part => `* ${part}`).join("\n") %>
32
+ <% for (jsDocLine of jsDocLines) { %>
33
+ * <%~ jsDocLine %>
30
34
 
31
- */
32
35
  <% } %>
36
+ */
37
+ <% } %>
@@ -1,6 +1,6 @@
1
1
  <%
2
2
  const { modelTypes, utils, config } = it;
3
- const { formatDescription, require, _ } = utils;
3
+ const { formatDescription, require, _, Ts } = utils;
4
4
 
5
5
 
6
6
  const dataContractTemplates = {
@@ -17,11 +17,11 @@ const dataContractTemplates = {
17
17
  %>
18
18
 
19
19
  <% if (config.internalTemplateOptions.addUtilRequiredKeysType) { %>
20
- type UtilRequiredKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>
20
+ type <%~ config.Ts.CodeGenKeyword.UtilRequiredKeys %><T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>
21
21
  <% } %>
22
22
 
23
23
  <% modelTypes.forEach((contract) => { %>
24
- <%~ includeFile('@base/data-contract-jsdoc.ejs', { ...it, contract }) %>
24
+ <%~ includeFile('@base/data-contract-jsdoc.ejs', { ...it, data: { ...contract, ...contract.typeData } }) %>
25
25
  export <%~ (dataContractTemplates[contract.typeIdentifier] || dataContractTemplates.type)(contract) %>
26
26
 
27
27
 
@@ -1,6 +1,7 @@
1
1
  <%
2
2
  const { contract, utils } = it;
3
3
  const { formatDescription, require, _ } = utils;
4
+ console.info('contract', contract.name, contract)
4
5
  %>
5
6
  export interface <%~ contract.name %> {
6
7
  <% _.forEach(contract.$content, (field) => { %>
@@ -1,6 +1,6 @@
1
1
  <%
2
2
  const { config, route, utils } = it;
3
- const { _, formatDescription, fmtToJSDocLine, classNameCase, require } = utils;
3
+ const { _, formatDescription, fmtToJSDocLine, pascalCase, require } = utils;
4
4
  const { raw, request, routeName } = route;
5
5
 
6
6
  const jsDocDescription = raw.description ?
@@ -8,7 +8,7 @@ const jsDocDescription = raw.description ?
8
8
  fmtToJSDocLine('No description', { eol: false });
9
9
  const jsDocLines = _.compact([
10
10
  _.size(raw.tags) && ` * @tags ${raw.tags.join(", ")}`,
11
- ` * @name ${classNameCase(routeName.usage)}`,
11
+ ` * @name ${pascalCase(routeName.usage)}`,
12
12
  raw.summary && ` * @summary ${raw.summary}`,
13
13
  ` * @request ${_.upperCase(request.method)}:${raw.route}`,
14
14
  raw.deprecated && ` * @deprecated`,
@@ -21,8 +21,7 @@ const jsDocLines = _.compact([
21
21
  ` * @response \`${status}\` \`${_.replace(_.replace(type, /\/\*/g, "\\*"), /\*\//g, "*\\")}\` ${description}`,
22
22
  )
23
23
  : []),
24
- ]).join("\n");
25
-
24
+ ]).map(str => str.trimEnd()).join("\n");
26
25
 
27
26
  return {
28
27
  description: jsDocDescription,
@@ -1,10 +1,10 @@
1
1
  <%
2
2
  const { route, utils, config } = it;
3
- const { _, classNameCase, require } = utils;
3
+ const { _, pascalCase, require } = utils;
4
4
  const { query, payload, pathParams, headers } = route.request;
5
5
 
6
6
  const routeDocs = includeFile("@base/route-docs", { config, route, utils });
7
- const routeNamespace = classNameCase(route.routeName.usage);
7
+ const routeNamespace = pascalCase(route.routeName.usage);
8
8
 
9
9
  %>
10
10
  /**
@@ -81,7 +81,7 @@ const describeReturnType = () => {
81
81
  /**
82
82
  <%~ routeDocs.description %>
83
83
 
84
- * <% /* Here you can add some other JSDoc tags */ %>
84
+ *<% /* Here you can add some other JSDoc tags */ %>
85
85
 
86
86
  <%~ routeDocs.lines %>
87
87
 
@@ -96,4 +96,4 @@ const describeReturnType = () => {
96
96
  <%~ bodyContentKindTmpl ? `type: ${bodyContentKindTmpl},` : '' %>
97
97
  <%~ responseFormatTmpl ? `format: ${responseFormatTmpl},` : '' %>
98
98
  ...<%~ _.get(requestConfigParam, "name") %>,
99
- })<%~ route.namespace ? ',' : '' %>
99
+ })<%~ route.namespace ? ',' : '' %>
@@ -1,6 +1,6 @@
1
1
  <%
2
2
  const { utils, config, routes, modelTypes } = it;
3
- const { _, classNameCase } = utils;
3
+ const { _, pascalCase } = utils;
4
4
  const dataContracts = config.modular ? _.map(modelTypes, "name") : [];
5
5
  %>
6
6
 
@@ -19,7 +19,7 @@ import { <%~ dataContracts.join(", ") %> } from "./<%~ config.fileNames.dataCont
19
19
  <% }) %>
20
20
 
21
21
  <% routes.combined && routes.combined.forEach(({ routes = [], moduleName }) => { %>
22
- export namespace <%~ classNameCase(moduleName) %> {
22
+ export namespace <%~ pascalCase(moduleName) %> {
23
23
  <% routes.forEach((route) => { %>
24
24
  <%~ includeFile('@base/route-type.ejs', { ...it, route }) %>
25
25
  <% }) %>
@@ -1,7 +1,7 @@
1
1
  <%
2
2
  const { utils, route, config, modelTypes } = it;
3
- const { _, classNameCase, require } = utils;
4
- const apiClassName = classNameCase(route.moduleName);
3
+ const { _, pascalCase, require } = utils;
4
+ const apiClassName = pascalCase(route.moduleName);
5
5
  const routes = route.routes;
6
6
  const dataContracts = _.map(modelTypes, "name");
7
7
  %>
@@ -81,7 +81,7 @@ const describeReturnType = () => {
81
81
  /**
82
82
  <%~ routeDocs.description %>
83
83
 
84
- * <% /* Here you can add some other JSDoc tags */ %>
84
+ *<% /* Here you can add some other JSDoc tags */ %>
85
85
 
86
86
  <%~ routeDocs.lines %>
87
87
 
@@ -96,4 +96,4 @@ const describeReturnType = () => {
96
96
  <%~ bodyContentKindTmpl ? `type: ${bodyContentKindTmpl},` : '' %>
97
97
  <%~ responseFormatTmpl ? `format: ${responseFormatTmpl},` : '' %>
98
98
  ...<%~ _.get(requestConfigParam, "name") %>,
99
- })
99
+ })
@@ -1,6 +1,6 @@
1
1
  <%
2
2
  const { utils, config, route, modelTypes } = it;
3
- const { _, classNameCase } = utils;
3
+ const { _, pascalCase } = utils;
4
4
  const { routes, moduleName } = route;
5
5
  const dataContracts = config.modular ? _.map(modelTypes, "name") : [];
6
6
 
@@ -9,7 +9,7 @@ const dataContracts = config.modular ? _.map(modelTypes, "name") : [];
9
9
  import { <%~ dataContracts.join(", ") %> } from "./<%~ config.fileNames.dataContracts %>"
10
10
  <% } %>
11
11
 
12
- export namespace <%~ classNameCase(moduleName) %> {
12
+ export namespace <%~ pascalCase(moduleName) %> {
13
13
  <% _.forEach(routes, (route) => { %>
14
14
 
15
15
  <%~ includeFile('@base/route-type.ejs', { ...it, route }) %>