UNPKG

@protocolnebula/ts-openapi-generator

Version:

Build API and models from Swagger/OpenAPI to use in any project type

60 lines 1.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ModelAttributessModel = void 0; const models_util_1 = require("../utils/models.util"); class ModelAttributessModel { constructor(name) { this.isOptional = true; /** * Must be increased for each array level */ this.arrayLevels = 0; this.name = name; } get typeURI() { return this._typeURI; } set typeURI(typeURI) { this._typeURI = typeURI; } get hasComments() { return !!this.description || !!this.example || !!this.deprecated; } /** * Return the type parsed, (class or primitive) */ get type() { return (0, models_util_1.getFixedTypeName)(this._typeURI); } get typeIsPrimitive() { return this.typeURI.indexOf('#/') === -1; } get typeNotPrimitive() { return !this.typeIsPrimitive; } /** * Get the path to the file if is not a primitive */ get fileName() { return this.name; } get model() { return this._model; } set model(model) { this._model = model; } /** * Return a fake array with "arrayLevels" elements to print it in mustache.js */ get arrayLevelsRepeater() { if (!this.arrayLevels) return null; return new Array(this.arrayLevels).fill(true); } toString() { return this.name; } } exports.ModelAttributessModel = ModelAttributessModel; //# sourceMappingURL=model-attributes.model.js.map