openapi-ts-generator 10.50.3 → 10.50.4
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.
- package/enums/enum-helpers.d.ts +1 -0
- package/enums/enum-helpers.d.ts.map +1 -0
- package/enums/enum-helpers.js +9 -3
- package/enums/enum-helpers.js.map +1 -0
- package/enums/enum-properties.d.ts +1 -0
- package/enums/enum-properties.d.ts.map +1 -0
- package/enums/enum-properties.js +6 -2
- package/enums/enum-properties.js.map +1 -0
- package/enums/enum-value.d.ts +1 -0
- package/enums/enum-value.d.ts.map +1 -0
- package/enums/enum-value.js +3 -1
- package/enums/enum-value.js.map +1 -0
- package/enums/index.d.ts +1 -0
- package/enums/index.d.ts.map +1 -0
- package/enums/index.js +10 -2
- package/enums/index.js.map +1 -0
- package/generators/barrel.generator.d.ts +1 -0
- package/generators/barrel.generator.d.ts.map +1 -0
- package/generators/barrel.generator.js +11 -6
- package/generators/barrel.generator.js.map +1 -0
- package/generators/base.generator.d.ts +1 -0
- package/generators/base.generator.d.ts.map +1 -0
- package/generators/base.generator.js +18 -7
- package/generators/base.generator.js.map +1 -0
- package/generators/endpoints.generator.d.ts +1 -0
- package/generators/endpoints.generator.d.ts.map +1 -0
- package/generators/endpoints.generator.js +15 -7
- package/generators/endpoints.generator.js.map +1 -0
- package/generators/enum.generator.d.ts +1 -0
- package/generators/enum.generator.d.ts.map +1 -0
- package/generators/enum.generator.js +13 -5
- package/generators/enum.generator.js.map +1 -0
- package/generators/form-group-factory.generator.d.ts +1 -0
- package/generators/form-group-factory.generator.d.ts.map +1 -0
- package/generators/form-group-factory.generator.js +15 -7
- package/generators/form-group-factory.generator.js.map +1 -0
- package/generators/form.generator.d.ts +1 -0
- package/generators/form.generator.d.ts.map +1 -0
- package/generators/form.generator.js +13 -5
- package/generators/form.generator.js.map +1 -0
- package/generators/index.d.ts +1 -0
- package/generators/index.d.ts.map +1 -0
- package/generators/index.js +20 -8
- package/generators/index.js.map +1 -0
- package/generators/model-properties.generator.d.ts +1 -0
- package/generators/model-properties.generator.d.ts.map +1 -0
- package/generators/model-properties.generator.js +13 -5
- package/generators/model-properties.generator.js.map +1 -0
- package/generators/model.generator.d.ts +1 -0
- package/generators/model.generator.d.ts.map +1 -0
- package/generators/model.generator.js +14 -5
- package/generators/model.generator.js.map +1 -0
- package/generators/test-object-factory.generator.d.ts +1 -0
- package/generators/test-object-factory.generator.d.ts.map +1 -0
- package/generators/test-object-factory.generator.js +14 -5
- package/generators/test-object-factory.generator.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -0
- package/index.js +61 -18
- package/index.js.map +1 -0
- package/models/entity.d.ts +1 -0
- package/models/entity.d.ts.map +1 -0
- package/models/entity.js +3 -1
- package/models/entity.js.map +1 -0
- package/models/enum-value.d.ts +1 -0
- package/models/enum-value.d.ts.map +1 -0
- package/models/enum-value.js +3 -1
- package/models/enum-value.js.map +1 -0
- package/models/generator-options.d.ts +1 -0
- package/models/generator-options.d.ts.map +1 -0
- package/models/generator-options.js +9 -6
- package/models/generator-options.js.map +1 -0
- package/models/helper-context.d.ts +1 -0
- package/models/helper-context.d.ts.map +1 -0
- package/models/helper-context.js +3 -1
- package/models/helper-context.js.map +1 -0
- package/models/logger.d.ts +1 -0
- package/models/logger.d.ts.map +1 -0
- package/models/logger.js +9 -6
- package/models/logger.js.map +1 -0
- package/models/nrsrx-filters.d.ts +1 -0
- package/models/nrsrx-filters.d.ts.map +1 -0
- package/models/nrsrx-filters.js +7 -2
- package/models/nrsrx-filters.js.map +1 -0
- package/models/reference-property.d.ts +1 -0
- package/models/reference-property.d.ts.map +1 -0
- package/models/reference-property.js +3 -1
- package/models/reference-property.js.map +1 -0
- package/models/schema-info.d.ts +1 -0
- package/models/schema-info.d.ts.map +1 -0
- package/models/schema-info.js +17 -6
- package/models/schema-info.js.map +1 -0
- package/models/template-data.d.ts +1 -0
- package/models/template-data.d.ts.map +1 -0
- package/models/template-data.js +3 -1
- package/models/template-data.js.map +1 -0
- package/models/value-property.d.ts +1 -0
- package/models/value-property.d.ts.map +1 -0
- package/models/value-property.js +3 -1
- package/models/value-property.js.map +1 -0
- package/openapidoc-converter.d.ts +1 -0
- package/openapidoc-converter.d.ts.map +1 -0
- package/openapidoc-converter.js +32 -22
- package/openapidoc-converter.js.map +1 -0
- package/package.json +1 -2
- package/jest.setup.d.ts +0 -1
- package/jest.setup.js +0 -4
- package/models/utils.d.ts +0 -1
- package/models/utils.js +0 -6
package/openapidoc-converter.js
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.OpenApiDocConverter = void 0;
|
|
1
7
|
/* eslint-disable @typescript-eslint/no-unnecessary-type-conversion */
|
|
2
8
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
3
9
|
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
const pluralize_1 = __importDefault(require("pluralize"));
|
|
11
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
12
|
+
const generator_options_ts_1 = require("./models/generator-options.js");
|
|
13
|
+
const schema_info_ts_1 = require("./models/schema-info.js");
|
|
14
|
+
class OpenApiDocConverter {
|
|
15
|
+
options;
|
|
16
|
+
apiDocument;
|
|
17
|
+
endAlphaNumRegex = /[A-z0-9]*$/s;
|
|
18
|
+
startNumberregex = /^\d*/;
|
|
9
19
|
constructor(options, apiDocument) {
|
|
10
20
|
this.options = options;
|
|
11
21
|
this.apiDocument = apiDocument;
|
|
12
|
-
this.endAlphaNumRegex = /[A-z0-9]*$/s;
|
|
13
|
-
this.startNumberregex = /^\d*/;
|
|
14
22
|
}
|
|
15
23
|
convertDocument() {
|
|
16
24
|
const entities = this.convertEntities();
|
|
@@ -25,7 +33,7 @@ export class OpenApiDocConverter {
|
|
|
25
33
|
tagLookup = tagLookup || path.delete || path.patch;
|
|
26
34
|
const tag = (tagLookup?.tags || ['unknown_endpoint'])[0];
|
|
27
35
|
paths.push({
|
|
28
|
-
tag:
|
|
36
|
+
tag: lodash_1.default.snakeCase(tag),
|
|
29
37
|
endpoint: this.options.pathUrlFormattingCallBack ? this.options.pathUrlFormattingCallBack(key) : key,
|
|
30
38
|
});
|
|
31
39
|
}
|
|
@@ -35,7 +43,7 @@ export class OpenApiDocConverter {
|
|
|
35
43
|
const entities = [];
|
|
36
44
|
for (const schemaName in this.apiDocument.components?.schemas) {
|
|
37
45
|
if (this.apiDocument.components.schemas[schemaName]) {
|
|
38
|
-
const schemaWrapperInfo = new SchemaWrapperInfo(this.apiDocument.components?.schemas[schemaName]);
|
|
46
|
+
const schemaWrapperInfo = new schema_info_ts_1.SchemaWrapperInfo(this.apiDocument.components?.schemas[schemaName]);
|
|
39
47
|
if (schemaWrapperInfo.componentSchemaObject.enum) {
|
|
40
48
|
this.buildSchemaWrapperInfoForEnum(schemaWrapperInfo);
|
|
41
49
|
}
|
|
@@ -53,18 +61,18 @@ export class OpenApiDocConverter {
|
|
|
53
61
|
key: schemaWrapperInfo.isCharEnum ? t.key : +t.key,
|
|
54
62
|
}),
|
|
55
63
|
name: schemaName,
|
|
56
|
-
kebabCasedName:
|
|
57
|
-
singularName:
|
|
58
|
-
camelSingularName:
|
|
64
|
+
kebabCasedName: lodash_1.default.kebabCase(schemaName),
|
|
65
|
+
singularName: pluralize_1.default.singular(schemaName),
|
|
66
|
+
camelSingularName: lodash_1.default.camelCase(pluralize_1.default.singular(schemaName)),
|
|
59
67
|
description: schemaWrapperInfo.description,
|
|
60
68
|
referenceProperties: schemaWrapperInfo.referenceProperties,
|
|
61
|
-
valueProperties: schemaWrapperInfo.valueProperties.filter(this.options.valuePropertyTypeFilterCallBack || defaultFilter),
|
|
69
|
+
valueProperties: schemaWrapperInfo.valueProperties.filter(this.options.valuePropertyTypeFilterCallBack || generator_options_ts_1.defaultFilter),
|
|
62
70
|
importTypes: this.getImportTypes(schemaName, schemaWrapperInfo),
|
|
63
71
|
};
|
|
64
72
|
entities.push(entity);
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
|
-
return entities.filter(this.options.typeFilterCallBack || defaultFilter);
|
|
75
|
+
return entities.filter(this.options.typeFilterCallBack || generator_options_ts_1.defaultFilter);
|
|
68
76
|
}
|
|
69
77
|
buildSchemaWrapperInfoForEnum(schemaWrapperInfo) {
|
|
70
78
|
schemaWrapperInfo.isEnum = true;
|
|
@@ -75,8 +83,8 @@ export class OpenApiDocConverter {
|
|
|
75
83
|
return {
|
|
76
84
|
key: key ? +key : 0,
|
|
77
85
|
name,
|
|
78
|
-
titleName:
|
|
79
|
-
snakeCaseName:
|
|
86
|
+
titleName: lodash_1.default.startCase(name),
|
|
87
|
+
snakeCaseName: lodash_1.default.snakeCase(name).toUpperCase(),
|
|
80
88
|
};
|
|
81
89
|
}),
|
|
82
90
|
];
|
|
@@ -134,7 +142,7 @@ export class OpenApiDocConverter {
|
|
|
134
142
|
initialValue,
|
|
135
143
|
initialTestValue,
|
|
136
144
|
isArray: false,
|
|
137
|
-
snakeCaseName:
|
|
145
|
+
snakeCaseName: lodash_1.default.snakeCase(propertyName).toUpperCase(),
|
|
138
146
|
typeScriptType: this.getPropertyTypeScriptType(schemaWrapperInfo),
|
|
139
147
|
maxLength: schemaWrapperInfo.propertySchemaObject.maxLength,
|
|
140
148
|
minLength: schemaWrapperInfo.propertySchemaObject.minLength,
|
|
@@ -170,7 +178,7 @@ export class OpenApiDocConverter {
|
|
|
170
178
|
email: false,
|
|
171
179
|
uri: false,
|
|
172
180
|
isArray: true,
|
|
173
|
-
snakeCaseName:
|
|
181
|
+
snakeCaseName: lodash_1.default.snakeCase(propertyName).toUpperCase(),
|
|
174
182
|
hasMultipleValidators: false,
|
|
175
183
|
hasValidators: validatorCount > 0,
|
|
176
184
|
};
|
|
@@ -226,7 +234,7 @@ export class OpenApiDocConverter {
|
|
|
226
234
|
return `'${defaultValue.split(' ').pop()}'`;
|
|
227
235
|
}
|
|
228
236
|
else if (email) {
|
|
229
|
-
return `'${
|
|
237
|
+
return `'${lodash_1.default.kebabCase(parentTypeName)}@email.org'`;
|
|
230
238
|
}
|
|
231
239
|
else if (typescriptType === 'Date') {
|
|
232
240
|
return 'new Date()';
|
|
@@ -244,7 +252,7 @@ export class OpenApiDocConverter {
|
|
|
244
252
|
return minValue ? `${minValue}` : '0';
|
|
245
253
|
}
|
|
246
254
|
else {
|
|
247
|
-
let retValue =
|
|
255
|
+
let retValue = lodash_1.default.snakeCase(propertyName).toUpperCase();
|
|
248
256
|
while (minLength && retValue.length < minLength) {
|
|
249
257
|
retValue = `${retValue}_${retValue}`;
|
|
250
258
|
}
|
|
@@ -275,7 +283,7 @@ export class OpenApiDocConverter {
|
|
|
275
283
|
isSameAsParentTypescriptType: parentTypeName.toLowerCase() === typeName.toLowerCase(),
|
|
276
284
|
initialValue,
|
|
277
285
|
initialTestValue,
|
|
278
|
-
snakeCaseName:
|
|
286
|
+
snakeCaseName: lodash_1.default.snakeCase(propertyName).toUpperCase(),
|
|
279
287
|
referenceTypeName: typeName,
|
|
280
288
|
typeScriptType: typeName,
|
|
281
289
|
isArray: false,
|
|
@@ -351,7 +359,7 @@ export class OpenApiDocConverter {
|
|
|
351
359
|
const props = properties.filter((t) => t.items.$ref === value || t.$ref === value);
|
|
352
360
|
return {
|
|
353
361
|
name: value,
|
|
354
|
-
kebabCasedTypeName:
|
|
362
|
+
kebabCasedTypeName: lodash_1.default.kebabCase(value),
|
|
355
363
|
isEnum: (refSchema?.enum ?? []).length > 0,
|
|
356
364
|
areAllArrays: props.every((val) => val.type === 'array'),
|
|
357
365
|
hasArrays: props.some((val) => val.type === 'array'),
|
|
@@ -367,3 +375,5 @@ export class OpenApiDocConverter {
|
|
|
367
375
|
propertyName !== 'id');
|
|
368
376
|
}
|
|
369
377
|
}
|
|
378
|
+
exports.OpenApiDocConverter = OpenApiDocConverter;
|
|
379
|
+
//# sourceMappingURL=openapidoc-converter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapidoc-converter.js","sourceRoot":"","sources":["../src/openapidoc-converter.ts"],"names":[],"mappings":";;;;;;AAAA,sEAAsE;AACtE,qEAAqE;AACrE,gEAAgE;AAChE,0DAAkC;AAClC,oDAA4B;AAG5B,wEAAiF;AACjF,4DAA4D;AAO5D,MAAa,mBAAmB;IAIX;IACA;IAJH,gBAAgB,GAAG,aAAa,CAAC;IACjC,gBAAgB,GAAG,MAAM,CAAC;IAC1C,YACmB,OAA0B,EAC1B,WAA0B;QAD1B,YAAO,GAAP,OAAO,CAAmB;QAC1B,gBAAW,GAAX,WAAW,CAAe;IACzC,CAAC;IAEE,eAAe;QACpB,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAClC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;IACM,YAAY;QACjB,MAAM,KAAK,GAAY,EAAE,CAAC;QAC1B,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;YACzC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACzC,IAAI,SAAS,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC;YAClD,SAAS,GAAG,SAAS,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC;YACnD,MAAM,GAAG,GAAW,CAAC,SAAS,EAAE,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAEjE,KAAK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,QAAQ,CAAC,YAAY,CAAC;YAC9E,CAAE,iBAAiB,CAAC,oBAAgD,CAAC,QAAQ,KAAK,SAAS;gBACzF,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,CAAE,iBAAiB,CAAC,oBAAgD,CAAC,QAAQ,CAAC,CAAC;YACrF,YAAY,KAAK,IAAI,CACtB,CAAC;IACJ,CAAC;CACF;AAjYD,kDAiYC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unnecessary-type-conversion */\n/* eslint-disable @typescript-eslint/restrict-template-expressions */\n/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport pluralize from 'pluralize';\nimport lodash from 'lodash';\nimport { OpenAPIObject, ReferenceObject, SchemaObject } from 'openapi3-ts/oas31';\n\nimport { defaultFilter, IGeneratorOptions } from './models/generator-options.ts';\nimport { SchemaWrapperInfo } from './models/schema-info.ts';\nimport { IImportType, IPath, ITemplateData } from './models/template-data.ts';\nimport { IEntity } from './models/entity.ts';\nimport { IReferenceProperty } from './models/reference-property.ts';\nimport { IValueProperty } from './models/value-property.ts';\nimport { IEnumValue } from './models/enum-value.ts';\n\nexport class OpenApiDocConverter {\n public readonly endAlphaNumRegex = /[A-z0-9]*$/s;\n public readonly startNumberregex = /^\\d*/;\n constructor(\n private readonly options: IGeneratorOptions,\n private readonly apiDocument: OpenAPIObject,\n ) { }\n\n public convertDocument(): ITemplateData {\n const entities = this.convertEntities();\n const paths = this.convertPaths();\n return { entities, paths };\n }\n public convertPaths(): IPath[] {\n const paths: IPath[] = [];\n for (const key in this.apiDocument.paths) {\n const path = this.apiDocument.paths[key];\n let tagLookup = path.get || path.post || path.put;\n tagLookup = tagLookup || path.delete || path.patch;\n const tag: string = (tagLookup?.tags || ['unknown_endpoint'])[0];\n\n paths.push({\n tag: lodash.snakeCase(tag),\n endpoint: this.options.pathUrlFormattingCallBack ? this.options.pathUrlFormattingCallBack(key) : key,\n });\n }\n return paths;\n }\n\n public convertEntities(): IEntity[] {\n const entities: IEntity[] = [];\n for (const schemaName in this.apiDocument.components?.schemas) {\n if (this.apiDocument.components.schemas[schemaName]) {\n const schemaWrapperInfo = new SchemaWrapperInfo(this.apiDocument.components?.schemas[schemaName] as SchemaObject);\n if (schemaWrapperInfo.componentSchemaObject.enum) {\n this.buildSchemaWrapperInfoForEnum(schemaWrapperInfo);\n } else {\n this.buildSchemaWrapperInfo(schemaName, schemaWrapperInfo);\n }\n schemaWrapperInfo.updateReferenceProperties(this.options);\n const entity: IEntity = {\n isEnum: schemaWrapperInfo.isEnum,\n isCharEnum: schemaWrapperInfo.isCharEnum || false,\n enumValues: schemaWrapperInfo.enumValues.map((t) =>\n typeof t === 'string' || t instanceof String\n ? t\n : {\n ...t,\n key: schemaWrapperInfo.isCharEnum ? t.key : +(t.key as number),\n },\n ),\n name: schemaName,\n kebabCasedName: lodash.kebabCase(schemaName),\n singularName: pluralize.singular(schemaName),\n camelSingularName: lodash.camelCase(pluralize.singular(schemaName)),\n description: schemaWrapperInfo.description,\n referenceProperties: schemaWrapperInfo.referenceProperties,\n valueProperties: schemaWrapperInfo.valueProperties.filter(this.options.valuePropertyTypeFilterCallBack || defaultFilter),\n importTypes: this.getImportTypes(schemaName, schemaWrapperInfo),\n };\n entities.push(entity);\n }\n }\n return entities.filter(this.options.typeFilterCallBack || defaultFilter);\n }\n\n public buildSchemaWrapperInfoForEnum(schemaWrapperInfo: SchemaWrapperInfo): void {\n schemaWrapperInfo.isEnum = true;\n let enumValues: IEnumValue[] = [\n ...(schemaWrapperInfo.componentSchemaObject.enum || []).map((x: string) => {\n const key = this.startNumberregex.exec(x)?.at(0);\n const name = this.endAlphaNumRegex.exec(x)?.at(0) ?? '';\n return {\n key: key ? +key : 0,\n name,\n titleName: lodash.startCase(name),\n snakeCaseName: lodash.snakeCase(name).toUpperCase(),\n };\n }),\n ];\n schemaWrapperInfo.isCharEnum =\n enumValues.length > 0 &&\n enumValues\n .filter((enumVal): enumVal is IEnumValue => typeof enumVal !== 'string' && typeof enumVal.key === 'number')\n .map((enumVal: IEnumValue) => enumVal.key as number)\n .every((val: number) => val >= 65 && val <= 90); // A-Z ASCII range\n if (schemaWrapperInfo.isCharEnum) {\n enumValues = enumValues.map((enumvalue) => ({\n ...enumvalue,\n key: String.fromCharCode(enumvalue.key as number),\n }));\n }\n schemaWrapperInfo.enumValues.push(...enumValues);\n }\n\n public buildSchemaWrapperInfo(parentTypeName: string, schemaWrapperInfo: SchemaWrapperInfo): void {\n for (const propertyName in schemaWrapperInfo.componentSchemaObject.properties) {\n if (\n (schemaWrapperInfo.propertySchemaObject = schemaWrapperInfo.componentSchemaObject.properties[propertyName] as SchemaObject).type && // NOSONAR\n schemaWrapperInfo.propertySchemaObject.type !== 'array'\n ) {\n schemaWrapperInfo.valueProperties.push(this.convertSchemaObjectToPropertyType(parentTypeName, propertyName, schemaWrapperInfo));\n } else {\n schemaWrapperInfo.propertyReferenceObject = schemaWrapperInfo.componentSchemaObject.properties[propertyName] as ReferenceObject;\n if (schemaWrapperInfo.propertyReferenceObject.$ref) {\n schemaWrapperInfo.referenceProperties.push(\n this.convertReferenceObjectToPropertyType(parentTypeName, propertyName, schemaWrapperInfo),\n );\n } else if (schemaWrapperInfo.propertySchemaObject.type === 'array' && schemaWrapperInfo.propertySchemaObject.items) {\n this.convertArray(parentTypeName, propertyName, schemaWrapperInfo);\n }\n }\n }\n }\n\n public convertArray(parentTypeName: string, propertyName: string, schemaWrapperInfo: SchemaWrapperInfo): void {\n const arraySchemaObject = schemaWrapperInfo.propertySchemaObject.items as SchemaObject;\n if (arraySchemaObject.type) {\n schemaWrapperInfo.valueProperties.push(this.convertArrayObjectToValuePropertyType(parentTypeName, propertyName, schemaWrapperInfo));\n } else {\n schemaWrapperInfo.propertyReferenceObject = schemaWrapperInfo.propertySchemaObject.items as ReferenceObject;\n schemaWrapperInfo.referenceProperties.push(\n this.convertArrayObjectToReferencePropertyType(parentTypeName, propertyName, schemaWrapperInfo),\n );\n }\n }\n\n public convertSchemaObjectToPropertyType(\n parentTypeName: string,\n propertyName: string,\n schemaWrapperInfo: SchemaWrapperInfo,\n ): IValueProperty {\n const required = this.getIsRequired(propertyName, schemaWrapperInfo);\n const validatorCount = this.getValidatorCount(propertyName, schemaWrapperInfo);\n const initialValue = this.options.genAngularFormGroupsWithDefaultValues\n ? this.getInitialValue(propertyName, schemaWrapperInfo)\n : 'undefined';\n const initialTestValue = this.getInitialTestValue(parentTypeName, propertyName, schemaWrapperInfo);\n return {\n required,\n name: propertyName,\n initialValue,\n initialTestValue,\n isArray: false,\n snakeCaseName: lodash.snakeCase(propertyName).toUpperCase(),\n typeScriptType: this.getPropertyTypeScriptType(schemaWrapperInfo),\n maxLength: schemaWrapperInfo.propertySchemaObject.maxLength,\n minLength: schemaWrapperInfo.propertySchemaObject.minLength,\n maximum: schemaWrapperInfo.propertySchemaObject.maximum,\n minimum: schemaWrapperInfo.propertySchemaObject.minimum,\n email: schemaWrapperInfo.propertySchemaObject.format?.toLowerCase() === 'email',\n uri: schemaWrapperInfo.propertySchemaObject.format?.toLowerCase() === 'uri',\n minItems: schemaWrapperInfo.propertySchemaObject.minItems,\n maxItems: schemaWrapperInfo.propertySchemaObject.maxItems,\n description: schemaWrapperInfo.propertySchemaObject.description,\n pattern: schemaWrapperInfo.propertySchemaObject.pattern,\n hasMultipleValidators: validatorCount > 1,\n hasValidators: validatorCount > 0,\n };\n }\n private convertValidator(validationValue: string | number | null | undefined): number {\n const exists = validationValue !== null && validationValue !== undefined;\n return +exists;\n }\n\n public convertArrayObjectToValuePropertyType(\n parentTypeName: string,\n propertyName: string,\n schemaWrapperInfo: SchemaWrapperInfo,\n ): IValueProperty {\n const required = this.getIsRequired(propertyName, schemaWrapperInfo);\n const validatorCount = this.getValidatorCount(propertyName, schemaWrapperInfo);\n const initialValue = this.options.genAngularFormGroupsWithDefaultValues\n ? this.getInitialValue(propertyName, schemaWrapperInfo)\n : 'undefined';\n const initialTestValue = this.getInitialTestValue(parentTypeName, propertyName, schemaWrapperInfo);\n return {\n required,\n typeScriptType: this.getPropertyTypeScriptType(schemaWrapperInfo),\n initialValue,\n initialTestValue,\n name: propertyName,\n email: false,\n uri: false,\n isArray: true,\n snakeCaseName: lodash.snakeCase(propertyName).toUpperCase(),\n hasMultipleValidators: false,\n hasValidators: validatorCount > 0,\n };\n }\n getInitialValue(propertyName: string, schemaWrapperInfo: SchemaWrapperInfo): string {\n const typescriptType = this.getPropertyTypeScriptType(schemaWrapperInfo);\n const isRequired = this.getIsRequired(propertyName, schemaWrapperInfo);\n\n const refName: string = (schemaWrapperInfo?.componentSchemaObject?.properties?.[propertyName] as ReferenceObject).$ref;\n const refObject = this.apiDocument.components?.schemas?.[refName] as SchemaObject;\n const defaultValue = (schemaWrapperInfo.componentSchemaObject.default || refObject?.default || (refObject?.enum || [])[0]) as string;\n if (!isRequired) {\n return 'null';\n } else if (defaultValue && refObject.enum) {\n return `${schemaWrapperInfo.propertyReferenceObject['$ref']}.${defaultValue.split(' ').pop() as string}`;\n } else if (defaultValue) {\n return `'${defaultValue.split(' ').pop() as string}'`;\n } else if (typescriptType === 'Date') {\n return 'new Date()';\n } else if (typescriptType === 'boolean') {\n return 'false';\n } else if (typescriptType === 'number') {\n return '0';\n } else {\n return `''`;\n }\n }\n getInitialTestValue(parentTypeName: string, propertyName: string, schemaWrapperInfo: SchemaWrapperInfo): string {\n const typescriptType = this.getPropertyTypeScriptType(schemaWrapperInfo);\n const schemaObject = schemaWrapperInfo?.componentSchemaObject?.properties?.[propertyName] as SchemaObject;\n const maxLength = schemaWrapperInfo.propertySchemaObject.maxLength;\n const minLength = schemaWrapperInfo.propertySchemaObject.minLength;\n const minValue = schemaWrapperInfo.propertySchemaObject.minimum;\n const email = schemaWrapperInfo.propertySchemaObject.format?.toLowerCase() === 'email';\n\n const refName: string = (schemaObject as unknown as ReferenceObject)?.$ref || (schemaObject.items as unknown as ReferenceObject)?.$ref;\n const refObject = this.apiDocument.components?.schemas?.[refName] as SchemaObject;\n const defaultValue = (schemaWrapperInfo.componentSchemaObject.default || refObject?.default || (refObject?.enum || [])[0]) as string;\n if (defaultValue && refObject.enum && schemaObject.type === 'array') {\n return `[${schemaWrapperInfo.propertyReferenceObject['$ref']}.${defaultValue.split(' ').pop() as string}]`;\n } else if (defaultValue && refObject.enum) {\n return `${schemaWrapperInfo.propertyReferenceObject['$ref']}.${defaultValue.split(' ').pop() as string}`;\n } else if (refObject) {\n return schemaObject.type === 'array' ? `[]` : `undefined`;\n } else if (defaultValue) {\n return `'${defaultValue.split(' ').pop() as string}'`;\n } else if (email) {\n return `'${lodash.kebabCase(parentTypeName)}@email.org'`;\n } else if (typescriptType === 'Date') {\n return 'new Date()';\n } else if (typescriptType === 'boolean') {\n return 'false';\n } else if (typescriptType === 'number' && schemaObject.type === 'array') {\n return minValue ? `[${minValue}]` : '[0]';\n } else if (schemaObject.type === 'array') {\n return defaultValue ? `[${defaultValue}]` : '[]';\n } else if (typescriptType === 'number') {\n return minValue ? `${minValue}` : '0';\n } else {\n let retValue = lodash.snakeCase(propertyName).toUpperCase();\n while (minLength && retValue.length < minLength) {\n retValue = `${retValue}_${retValue}`;\n }\n return `'${maxLength ? retValue.substring(0, maxLength) : retValue}'`;\n }\n }\n\n public convertArrayObjectToReferencePropertyType(\n parentTypeName: string,\n propertyName: string,\n schemaWrapperInfo: SchemaWrapperInfo,\n ): IReferenceProperty {\n const refProperty = {\n ...this.convertReferenceObjectToPropertyType(parentTypeName, propertyName, schemaWrapperInfo),\n isArray: true,\n };\n refProperty.isEnumAndArray = refProperty.isEnum && refProperty.isArray;\n return refProperty;\n }\n\n public convertReferenceObjectToPropertyType(\n parentTypeName: string,\n propertyName: string,\n schemaWrapperInfo: SchemaWrapperInfo,\n ): IReferenceProperty {\n const propertySchema: SchemaObject = this.apiDocument.components?.schemas?.[this.parseRef(schemaWrapperInfo)] as SchemaObject;\n const refSchema = schemaWrapperInfo?.componentSchemaObject?.properties?.[propertyName] as SchemaObject;\n const required = this.getIsRequired(propertyName, schemaWrapperInfo);\n const validatorCount = this.getValidatorCount(propertyName, schemaWrapperInfo);\n const initialValue = this.options.genAngularFormGroupsWithDefaultValues\n ? this.getInitialValue(propertyName, schemaWrapperInfo)\n : 'undefined';\n const initialTestValue = this.getInitialTestValue(parentTypeName, propertyName, schemaWrapperInfo);\n const typeName = this.parseRef(schemaWrapperInfo);\n return {\n required,\n name: propertyName,\n isSameAsParentTypescriptType: parentTypeName.toLowerCase() === typeName.toLowerCase(),\n initialValue,\n initialTestValue,\n snakeCaseName: lodash.snakeCase(propertyName).toUpperCase(),\n referenceTypeName: typeName,\n typeScriptType: typeName,\n isArray: false,\n isEnum: (propertySchema?.enum ?? []).length > 0,\n isEnumAndArray: false,\n hasValidators: validatorCount > 0,\n hasMultipleValidators: validatorCount > 1,\n maxLength: refSchema?.maxLength,\n minLength: refSchema?.minLength,\n maximum: refSchema?.maximum,\n minimum: refSchema?.minimum,\n minItems: refSchema?.minItems,\n maxItems: refSchema?.maxItems,\n };\n }\n getValidatorCount(propertyName: string, schemaWrapperInfo: SchemaWrapperInfo): number {\n const required = this.getIsRequired(propertyName, schemaWrapperInfo);\n const email = schemaWrapperInfo.propertySchemaObject.format?.toLowerCase() === 'email' || false;\n const uri = schemaWrapperInfo.propertySchemaObject.format?.toLowerCase() === 'uri' || false;\n return (\n +required +\n +email +\n +uri +\n +this.convertValidator(schemaWrapperInfo.propertySchemaObject.maxLength) +\n +this.convertValidator(schemaWrapperInfo.propertySchemaObject.minLength) +\n +this.convertValidator(schemaWrapperInfo.propertySchemaObject.maximum) +\n +this.convertValidator(schemaWrapperInfo.propertySchemaObject.minimum) +\n +this.convertValidator(schemaWrapperInfo.propertySchemaObject.maxItems) +\n +this.convertValidator(schemaWrapperInfo.propertySchemaObject.minItems) +\n +this.convertValidator(schemaWrapperInfo.propertySchemaObject.pattern)\n );\n }\n\n public getPropertyTypeScriptType(schemaWrapperInfo: SchemaWrapperInfo): string {\n if (schemaWrapperInfo.propertySchemaObject.type === 'array' && schemaWrapperInfo.propertySchemaObject.items) {\n const type = (schemaWrapperInfo.propertySchemaObject.items as SchemaObject).type;\n return type === 'integer' ? 'number' : (type as string);\n } else if (schemaWrapperInfo.propertySchemaObject.type === 'integer' && schemaWrapperInfo.propertySchemaObject.enum) {\n return 'string | number';\n } else if (schemaWrapperInfo.propertySchemaObject.type === 'integer') {\n return 'number';\n } else if (schemaWrapperInfo.propertySchemaObject.format === 'date' || schemaWrapperInfo.propertySchemaObject.format === 'date-time') {\n return 'Date';\n }\n return (schemaWrapperInfo.propertySchemaObject.type as string) ?? 'string';\n }\n\n public parseRef(schemaWrapperInfo: SchemaWrapperInfo): string {\n let regexResult: RegExpExecArray;\n let result: string | null = null;\n if (\n schemaWrapperInfo.propertyReferenceObject.$ref &&\n // tslint:disable-next-line: no-conditional-assignment\n (regexResult = this.endAlphaNumRegex.exec(schemaWrapperInfo.propertyReferenceObject.$ref) as RegExpExecArray) // NOSONAR\n ) {\n schemaWrapperInfo.propertyReferenceObject.$ref = regexResult[0];\n result = schemaWrapperInfo.propertyReferenceObject.$ref;\n }\n return result || 'unknown';\n }\n\n public getImportTypes(entityName: string, schemaWrapperInfo: SchemaWrapperInfo): IImportType[] {\n const schemaProperties =\n ((this.apiDocument.components?.schemas ?? { [entityName]: { properties: {} } })[entityName] as SchemaObject).properties ?? {};\n\n const properties = Object.keys(schemaProperties).map((key) => ({\n key,\n ...schemaProperties[key],\n $ref: (schemaProperties[key] as ReferenceObject).$ref,\n items: (schemaProperties[key] as SchemaObject).items || {},\n type: (schemaProperties[key] as SchemaObject).type,\n }));\n return schemaWrapperInfo.referenceProperties\n .map((t) => t.referenceTypeName)\n .filter((value, index, array) => array.indexOf(value) === index)\n .map((value): IImportType => {\n const refSchema = this.apiDocument.components?.schemas?.[value] as SchemaObject;\n const props = properties.filter((t) => (t.items as ReferenceObject).$ref === value || t.$ref === value);\n return {\n name: value,\n kebabCasedTypeName: lodash.kebabCase(value),\n isEnum: (refSchema?.enum ?? []).length > 0,\n areAllArrays: props.every((val) => val.type === 'array'),\n hasArrays: props.some((val) => val.type === 'array'),\n isSelfReferencing: entityName === value,\n };\n });\n }\n\n public getIsRequired(propertyName: string, schemaWrapperInfo: SchemaWrapperInfo): boolean {\n return (\n ((schemaWrapperInfo.componentSchemaObject.required ?? []).includes(propertyName) ||\n ((schemaWrapperInfo.propertySchemaObject as { nullable?: boolean; }).nullable === undefined\n ? false\n : !(schemaWrapperInfo.propertySchemaObject as { nullable?: boolean; }).nullable)) &&\n propertyName !== 'id'\n );\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-ts-generator",
|
|
3
|
-
"version": "10.50.
|
|
3
|
+
"version": "10.50.4",
|
|
4
4
|
"description": "Based on swagger-ts-generator, this is a type script model generator specifically for services with OpenApi spec documentation.",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"type": "module",
|
|
7
6
|
"types": "index.d.ts",
|
|
8
7
|
"exports": {
|
|
9
8
|
".": {
|
package/jest.setup.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/jest.setup.js
DELETED
package/models/utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getDirName: () => string;
|