@protocolnebula/ts-openapi-generator
Version:
Build API and models from Swagger/OpenAPI to use in any project type
25 lines • 676 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModelStore = void 0;
class ModelStore {
constructor() {
this._models = new Set();
}
get models() {
return [...this._models];
}
add(model) {
if (!this._models.has(model)) {
console.debug('Added model to the store:', model.name, model.uri);
this._models.add(model);
}
else {
throw `Model ${model.uri} declared twice`;
}
}
getByUri(uri) {
return this.models.find((model) => model.uri === uri);
}
}
exports.ModelStore = ModelStore;
//# sourceMappingURL=model.store.js.map