UNPKG

@tsed/schema

Version:
34 lines (33 loc) 1.01 kB
import { __decorate } from "tslib"; import { DecoratorTypes } from "@tsed/core"; import { JsonEntityComponent } from "../decorators/config/jsonEntityComponent.js"; import { JsonEntityStore } from "./JsonEntityStore.js"; import { JsonSchema } from "./JsonSchema.js"; let JsonClassStore = class JsonClassStore extends JsonEntityStore { constructor() { super(...arguments); /** * List of children JsonEntityStore (properties or methods or params) */ this.children = new Map(); } get path() { return this.store.get("path", "/"); } set path(path) { this.store.set("path", path); } build() { if (!this._type) { this.buildType(this.target); } this._type = this._type || Object; this._schema = JsonSchema.from({ type: this.type }); } }; JsonClassStore = __decorate([ JsonEntityComponent(DecoratorTypes.CLASS) ], JsonClassStore); export { JsonClassStore };