UNPKG

swagger-typescript-generator

Version:

Generate typescript code from swagger.json. Before start this project I try use [swagger-typescript-codegen](https://github.com/mtennoe/swagger-typescript-codegen) based on [mustache templates](https://github.com/mtennoe/swagger-js-codegen/tree/master/lib

44 lines 1.83 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.SwaggerClass = void 0; var swagger_method_1 = require("./swagger-method"); var swagger_base_1 = require("./swagger-base"); var SwaggerClass = /** @class */ (function (_super) { __extends(SwaggerClass, _super); function SwaggerClass(parent, name, source, paths) { var _this = _super.call(this) || this; _this.name = ""; _this.tag = ""; _this.methods = []; _this.parent = parent; _this.source = source; _this.tag = name; _this.name = _this.utils.getClassName(_this, name); _this.fileName = _this.utils.getClassFileName(_this, _this.name); _this.methods = paths.map(function (path) { return path.httpMethods.map(function (httpMethod) { return new swagger_method_1.SwaggerMethod(_this, httpMethod, path, path.source[httpMethod]); }); }).flat(); return _this; } SwaggerClass.prototype.init = function () { this.methods.forEach(function (m) { return m.init(); }); }; return SwaggerClass; }(swagger_base_1.SwaggerBase)); exports.SwaggerClass = SwaggerClass; //# sourceMappingURL=swagger-class.js.map