openapi-ts-generator 9.24.2 → 9.28.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 -1
- package/enums/enum-helpers.js +6 -9
- package/enums/enum-properties.js +1 -1
- package/enums/enum-value.d.ts +3 -3
- package/generators/barrel.generator.js +13 -34
- package/generators/base.generator.js +16 -18
- package/generators/endpoints.generator.js +23 -63
- package/generators/enum.generator.js +13 -33
- package/generators/form-group-factory.generator.js +59 -48
- package/generators/form.generator.js +14 -33
- package/generators/model-properties.generator.js +15 -33
- package/generators/model.generator.js +14 -34
- package/generators/test-object-factory.generator.js +14 -33
- package/index.js +72 -92
- package/models/generator-options.js +19 -21
- package/models/logger.js +6 -9
- package/models/nrsrx-filters.js +3 -4
- package/models/schema-info.d.ts +1 -1
- package/models/schema-info.js +7 -9
- package/openapidoc-converter.d.ts +1 -1
- package/openapidoc-converter.js +164 -180
- package/package.json +24 -23
|
@@ -1,40 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.ModelGenerator = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var _a, _b;
|
|
26
|
-
_this = _super.call(this, options, options.genClasses ? (_a = options.templates) === null || _a === void 0 ? void 0 : _a.entity : (_b = options.templates) === null || _b === void 0 ? void 0 : _b.model) || this;
|
|
27
|
-
_this.GeneratorName = 'ModelGenerator';
|
|
28
|
-
return _this;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const base_generator_1 = require("./base.generator");
|
|
6
|
+
class ModelGenerator extends base_generator_1.BaseGenerator {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
super(options, options.genClasses ? options.templates?.entity : options.templates?.model);
|
|
9
|
+
this.GeneratorName = 'ModelGenerator';
|
|
29
10
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
11
|
+
generate(templateData) {
|
|
12
|
+
const fileSuffix = this.generatorOptions.genClasses ? '.entity.ts' : '.model.ts';
|
|
13
|
+
templateData.entities
|
|
14
|
+
?.filter((entity) => !entity.isEnum)
|
|
15
|
+
.forEach((entity) => {
|
|
16
|
+
super.generateFile(`${this.generatorOptions.outputPath}/${(0, lodash_1.kebabCase)(entity.name)}${fileSuffix}`, entity);
|
|
36
17
|
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
}(base_generator_1.BaseGenerator));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
40
20
|
exports.ModelGenerator = ModelGenerator;
|
|
@@ -1,39 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
17
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
4
|
exports.TestObjectFactoryGenerator = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var _a;
|
|
26
|
-
_this = _super.call(this, options, (_a = options.templates) === null || _a === void 0 ? void 0 : _a.testObjectFactory) || this;
|
|
27
|
-
_this.GeneratorName = 'TestObjectFactoryGenerator';
|
|
28
|
-
return _this;
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const base_generator_1 = require("./base.generator");
|
|
7
|
+
class TestObjectFactoryGenerator extends base_generator_1.BaseGenerator {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
super(options, options.templates?.testObjectFactory);
|
|
10
|
+
this.GeneratorName = 'TestObjectFactoryGenerator';
|
|
29
11
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
generate(templateData) {
|
|
13
|
+
templateData.entities
|
|
14
|
+
?.filter((val) => val.valueProperties?.length + val.referenceProperties?.length > 0)
|
|
15
|
+
.forEach((entity) => {
|
|
16
|
+
super.generateFile(`${this.generatorOptions.outputPath}/${(0, lodash_1.kebabCase)(entity.name)}.test-obj-fac.ts`, entity);
|
|
35
17
|
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}(base_generator_1.BaseGenerator));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
39
20
|
exports.TestObjectFactoryGenerator = TestObjectFactoryGenerator;
|
package/index.js
CHANGED
|
@@ -1,117 +1,97 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
36
7
|
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
exports.nrsrxValuePropertyTypeFilterCallBack = exports.nrsrxTypeFilterCallBack = void 0;
|
|
40
|
+
exports.generateTsModels = generateTsModels;
|
|
41
|
+
const fs = __importStar(require("node:fs"));
|
|
42
|
+
const generators_1 = require("./generators");
|
|
43
|
+
const generator_options_1 = require("./models/generator-options");
|
|
44
|
+
const openapidoc_converter_1 = require("./openapidoc-converter");
|
|
45
|
+
const axios_1 = __importDefault(require("axios"));
|
|
45
46
|
var nrsrx_filters_1 = require("./models/nrsrx-filters");
|
|
46
47
|
Object.defineProperty(exports, "nrsrxTypeFilterCallBack", { enumerable: true, get: function () { return nrsrx_filters_1.nrsrxTypeFilterCallBack; } });
|
|
47
48
|
Object.defineProperty(exports, "nrsrxValuePropertyTypeFilterCallBack", { enumerable: true, get: function () { return nrsrx_filters_1.nrsrxValuePropertyTypeFilterCallBack; } });
|
|
48
|
-
function generateTsModels(options) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
options = (0, generator_options_1.setGeneratorOptionDefaults)(options);
|
|
55
|
-
return [4 /*yield*/, getOpenApiDocumentAsync(options)];
|
|
56
|
-
case 1:
|
|
57
|
-
apiDocument = _a.sent();
|
|
58
|
-
converter = new openapidoc_converter_1.OpenApiDocConverter(options, apiDocument);
|
|
59
|
-
templateData = converter.convertDocument();
|
|
60
|
-
generateOutput(options, templateData);
|
|
61
|
-
return [2 /*return*/];
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
});
|
|
49
|
+
async function generateTsModels(options) {
|
|
50
|
+
options = (0, generator_options_1.setGeneratorOptionDefaults)(options);
|
|
51
|
+
const apiDocument = await getOpenApiDocumentAsync(options);
|
|
52
|
+
const converter = new openapidoc_converter_1.OpenApiDocConverter(options, apiDocument);
|
|
53
|
+
const templateData = converter.convertDocument();
|
|
54
|
+
generateOutput(options, templateData);
|
|
65
55
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (options.openApiJsonFileName) {
|
|
81
|
-
response = fs.readFileSync("".concat(__dirname, "/").concat(options.openApiJsonFileName));
|
|
82
|
-
apiDoc = JSON.parse(response.toString());
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
throw new Error('You must specify either an OpenApi Json Url or FileName. Please review the readme.md @ https://github.com/ikemtz/openapi-ts-generator.');
|
|
86
|
-
}
|
|
87
|
-
_a.label = 3;
|
|
88
|
-
case 3: return [2 /*return*/, apiDoc];
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
});
|
|
56
|
+
async function getOpenApiDocumentAsync(options) {
|
|
57
|
+
let apiDoc;
|
|
58
|
+
if (options.openApiJsonUrl) {
|
|
59
|
+
const response = await axios_1.default.get(options.openApiJsonUrl, options.axiosConfig);
|
|
60
|
+
apiDoc = response.data;
|
|
61
|
+
}
|
|
62
|
+
else if (options.openApiJsonFileName) {
|
|
63
|
+
const response = fs.readFileSync(`${__dirname}/${options.openApiJsonFileName}`);
|
|
64
|
+
apiDoc = JSON.parse(response.toString());
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
throw new Error('You must specify either an OpenApi Json Url or FileName. Please review the readme.md @ https://github.com/ikemtz/openapi-ts-generator.');
|
|
68
|
+
}
|
|
69
|
+
return apiDoc;
|
|
92
70
|
}
|
|
93
71
|
function generateOutput(options, templateData) {
|
|
94
72
|
if (fs.existsSync(options.outputPath)) {
|
|
95
|
-
fs.readdirSync(options.outputPath).forEach(
|
|
73
|
+
fs.readdirSync(options.outputPath).forEach((file) => {
|
|
74
|
+
fs.unlinkSync(`${options.outputPath}/${file}`);
|
|
75
|
+
});
|
|
96
76
|
fs.rmdirSync(options.outputPath);
|
|
97
77
|
}
|
|
98
78
|
fs.mkdirSync(options.outputPath, { recursive: true });
|
|
99
|
-
|
|
79
|
+
const modelGenerator = new generators_1.ModelGenerator(options);
|
|
100
80
|
modelGenerator.generate(templateData);
|
|
101
81
|
if (options.genAngularFormGroups) {
|
|
102
|
-
|
|
82
|
+
const formGroupGenerator = new generators_1.FormGroupFactoryGenerator(options);
|
|
103
83
|
formGroupGenerator.generate(templateData);
|
|
104
|
-
|
|
84
|
+
const formGenerator = new generators_1.FormGenerator(options);
|
|
105
85
|
formGenerator.generate(templateData);
|
|
106
86
|
}
|
|
107
|
-
|
|
87
|
+
const modelPropertiesGenerator = new generators_1.ModelPropertiesGenerator(options);
|
|
108
88
|
modelPropertiesGenerator.generate(templateData);
|
|
109
|
-
|
|
89
|
+
const endpointGenerator = new generators_1.EndPointsGenerator(options);
|
|
110
90
|
endpointGenerator.generate(templateData);
|
|
111
|
-
|
|
112
|
-
|
|
91
|
+
const barrelGenerator = new generators_1.BarrelGenerator(options);
|
|
92
|
+
const enumGenerator = new generators_1.EnumGenerator(options);
|
|
113
93
|
enumGenerator.generate(templateData);
|
|
114
|
-
|
|
94
|
+
const testObjFacGenerator = new generators_1.TestObjectFactoryGenerator(options);
|
|
115
95
|
testObjFacGenerator.generate(templateData);
|
|
116
96
|
barrelGenerator.generate();
|
|
117
97
|
}
|
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
3
|
+
exports.defaultFilter = defaultFilter;
|
|
4
|
+
exports.setGeneratorOptionDefaults = setGeneratorOptionDefaults;
|
|
15
5
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
16
|
-
|
|
6
|
+
const path_1 = require("path");
|
|
17
7
|
function defaultFilter(_value, _index, _array) {
|
|
18
8
|
return true;
|
|
19
9
|
}
|
|
20
|
-
exports.defaultFilter = defaultFilter;
|
|
21
10
|
function setGeneratorOptionDefaults(options) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
options.
|
|
25
|
-
options.
|
|
26
|
-
options.
|
|
27
|
-
|
|
11
|
+
const templateFolder = (0, path_1.resolve)(`${__dirname}/..`, 'templates');
|
|
12
|
+
options.typeFilterCallBack = options.typeFilterCallBack ?? defaultFilter;
|
|
13
|
+
options.valuePropertyTypeFilterCallBack = options.valuePropertyTypeFilterCallBack ?? defaultFilter;
|
|
14
|
+
options.referencePropertyTypeFilterCallBack = options.referencePropertyTypeFilterCallBack ?? defaultFilter;
|
|
15
|
+
options.templates = {
|
|
16
|
+
...options.templates,
|
|
17
|
+
model: options.templates?.model ?? `${templateFolder}/model.ts.hbs`,
|
|
18
|
+
entity: options.templates?.entity ?? `${templateFolder}/entity.ts.hbs`,
|
|
19
|
+
form: options.templates?.form ?? `${templateFolder}/form.ts.hbs`,
|
|
20
|
+
formGroupFactory: options.templates?.formGroupFactory ?? `${templateFolder}/form-group-factory.ts.hbs`,
|
|
21
|
+
testObjectFactory: options.templates?.testObjectFactory ?? `${templateFolder}/test-object-factory.ts.hbs`,
|
|
22
|
+
barrel: options.templates?.barrel ?? `${templateFolder}/index.ts.hbs`,
|
|
23
|
+
enum: options.templates?.barrel ?? `${templateFolder}/enum.ts.hbs`,
|
|
24
|
+
modelProperties: options.templates?.barrel ?? `${templateFolder}/model-properties.ts.hbs`,
|
|
25
|
+
endpoints: options.templates?.endpoints ?? `${templateFolder}/endpoints.ts.hbs`,
|
|
26
|
+
};
|
|
28
27
|
return options;
|
|
29
28
|
}
|
|
30
|
-
exports.setGeneratorOptionDefaults = setGeneratorOptionDefaults;
|
package/models/logger.js
CHANGED
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MockConsoleLogger = void 0;
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.
|
|
10
|
-
this.error = function (data) { };
|
|
11
|
-
this.warn = function (data) { };
|
|
5
|
+
class MockConsoleLogger {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.log = (data) => { };
|
|
8
|
+
this.error = (data) => { };
|
|
9
|
+
this.warn = (data) => { };
|
|
12
10
|
}
|
|
13
|
-
|
|
14
|
-
}());
|
|
11
|
+
}
|
|
15
12
|
exports.MockConsoleLogger = MockConsoleLogger;
|
package/models/nrsrx-filters.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.nrsrxTypeFilterCallBack = nrsrxTypeFilterCallBack;
|
|
4
|
+
exports.nrsrxValuePropertyTypeFilterCallBack = nrsrxValuePropertyTypeFilterCallBack;
|
|
5
|
+
const edmRegex = /^Edm[A-z]*Kind$/;
|
|
5
6
|
function nrsrxTypeFilterCallBack(val, _i, _arr) {
|
|
6
7
|
return !val.name.endsWith('ODataEnvelope') && !edmRegex.test(val.name);
|
|
7
8
|
}
|
|
8
|
-
exports.nrsrxTypeFilterCallBack = nrsrxTypeFilterCallBack;
|
|
9
9
|
function nrsrxValuePropertyTypeFilterCallBack(val, _i, _arr) {
|
|
10
10
|
return !val.name.startsWith('created') && !val.name.startsWith('updated');
|
|
11
11
|
}
|
|
12
|
-
exports.nrsrxValuePropertyTypeFilterCallBack = nrsrxValuePropertyTypeFilterCallBack;
|
package/models/schema-info.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReferenceObject, SchemaObject } from 'openapi3-ts/
|
|
1
|
+
import { ReferenceObject, SchemaObject } from 'openapi3-ts/oas31';
|
|
2
2
|
import { IEnumValue } from './enum-value';
|
|
3
3
|
import { IGeneratorOptions } from './generator-options';
|
|
4
4
|
import { IReferenceProperty } from './reference-property';
|
package/models/schema-info.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SchemaWrapperInfo = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const generator_options_1 = require("./generator-options");
|
|
5
|
+
class SchemaWrapperInfo {
|
|
6
|
+
constructor(schemaItem) {
|
|
7
7
|
this.propertySchemaObject = {};
|
|
8
8
|
this.propertyReferenceObject = { $ref: '' };
|
|
9
9
|
this.componentSchemaObject = schemaItem;
|
|
@@ -12,10 +12,8 @@ var SchemaWrapperInfo = /** @class */ (function () {
|
|
|
12
12
|
this.referenceProperties = [];
|
|
13
13
|
this.enumValues = [];
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return SchemaWrapperInfo;
|
|
20
|
-
}());
|
|
15
|
+
updateReferenceProperties(options) {
|
|
16
|
+
this.referenceProperties = this.referenceProperties.filter(options.referencePropertyTypeFilterCallBack ?? generator_options_1.defaultFilter);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
21
19
|
exports.SchemaWrapperInfo = SchemaWrapperInfo;
|
|
@@ -4,7 +4,7 @@ import { IImportType, IPath, ITemplateData } from './models/template-data';
|
|
|
4
4
|
import { IEntity } from './models/entity';
|
|
5
5
|
import { IReferenceProperty } from './models/reference-property';
|
|
6
6
|
import { IValueProperty } from './models/value-property';
|
|
7
|
-
import { OpenAPIObject } from 'openapi3-ts/
|
|
7
|
+
import { OpenAPIObject } from 'openapi3-ts/oas31';
|
|
8
8
|
export declare class OpenApiDocConverter {
|
|
9
9
|
private readonly options;
|
|
10
10
|
private readonly apiDocument;
|