@tsed/schema
Version:
JsonSchema module for Ts.ED Framework
50 lines (49 loc) • 1.24 kB
JavaScript
import { concatPath } from "../utils/concatPath.js";
export class JsonOperationRoute {
constructor(options) {
Object.assign(this, options);
this.paramsTypes = this.endpoint.getParamTypes();
}
get url() {
return this.fullPath;
}
get path() {
return this.operationPath?.path;
}
get fullPath() {
return concatPath(this.basePath, this.path);
}
get method() {
return this.operationPath?.method || "USE";
}
get name() {
return `${this.endpoint.targetName}.${this.methodClassName}()`;
}
get className() {
return this.endpoint.targetName;
}
get methodClassName() {
return this.propertyKey;
}
get parameters() {
return this.endpoint.parameters;
}
get propertyKey() {
return String(this.endpoint.propertyKey);
}
get propertyName() {
return this.endpoint.propertyName;
}
get store() {
return this.endpoint.store;
}
get operation() {
return this.endpoint.operation;
}
get operationId() {
return this.operation.get("operationId") || this.endpoint.propertyKey;
}
has(key) {
return this.paramsTypes[key];
}
}