openapi-ts-generator
Version:
Based on swagger-ts-generator, this is a type script model generator specifically for services with OpenApi spec documentation.
31 lines (30 loc) • 3.08 kB
JavaScript
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.setGeneratorOptionDefaults = exports.defaultFilter = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars */
var path_1 = require("path");
function defaultFilter(_value, _index, _array) {
return true;
}
exports.defaultFilter = defaultFilter;
function setGeneratorOptionDefaults(options) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
var templateFolder = (0, path_1.resolve)("".concat(__dirname, "/.."), 'templates');
options.typeFilterCallBack = (_a = options.typeFilterCallBack) !== null && _a !== void 0 ? _a : defaultFilter;
options.valuePropertyTypeFilterCallBack = (_b = options.valuePropertyTypeFilterCallBack) !== null && _b !== void 0 ? _b : defaultFilter;
options.referencePropertyTypeFilterCallBack = (_c = options.referencePropertyTypeFilterCallBack) !== null && _c !== void 0 ? _c : defaultFilter;
options.templates = __assign(__assign({}, options.templates), { model: (_e = (_d = options.templates) === null || _d === void 0 ? void 0 : _d.model) !== null && _e !== void 0 ? _e : "".concat(templateFolder, "/model.ts.hbs"), entity: (_g = (_f = options.templates) === null || _f === void 0 ? void 0 : _f.entity) !== null && _g !== void 0 ? _g : "".concat(templateFolder, "/entity.ts.hbs"), form: (_j = (_h = options.templates) === null || _h === void 0 ? void 0 : _h.form) !== null && _j !== void 0 ? _j : "".concat(templateFolder, "/form.ts.hbs"), formGroupFactory: (_l = (_k = options.templates) === null || _k === void 0 ? void 0 : _k.formGroupFactory) !== null && _l !== void 0 ? _l : "".concat(templateFolder, "/form-group-factory.ts.hbs"), testObjectFactory: (_o = (_m = options.templates) === null || _m === void 0 ? void 0 : _m.testObjectFactory) !== null && _o !== void 0 ? _o : "".concat(templateFolder, "/test-object-factory.ts.hbs"), barrel: (_q = (_p = options.templates) === null || _p === void 0 ? void 0 : _p.barrel) !== null && _q !== void 0 ? _q : "".concat(templateFolder, "/index.ts.hbs"), enum: (_s = (_r = options.templates) === null || _r === void 0 ? void 0 : _r.barrel) !== null && _s !== void 0 ? _s : "".concat(templateFolder, "/enum.ts.hbs"), modelProperties: (_u = (_t = options.templates) === null || _t === void 0 ? void 0 : _t.barrel) !== null && _u !== void 0 ? _u : "".concat(templateFolder, "/model-properties.ts.hbs"), endpoints: (_w = (_v = options.templates) === null || _v === void 0 ? void 0 : _v.endpoints) !== null && _w !== void 0 ? _w : "".concat(templateFolder, "/endpoints.ts.hbs") });
return options;
}
exports.setGeneratorOptionDefaults = setGeneratorOptionDefaults;
;