@tsed/schema
Version:
JsonSchema module for Ts.ED Framework
23 lines (22 loc) • 477 B
JavaScript
import { isArrowFn, isClass } from "@tsed/core";
import { JsonEntityFn } from "./jsonEntityFn.js";
/**
* Declare a new property on a model.
*
* @param type
* @decorator
* @validation
* @swagger
* @schema
* @input
*/
export function Property(type) {
return JsonEntityFn((store) => {
if (type) {
if (isClass(type) || isArrowFn(type)) {
store.type = type;
}
store.itemSchema.type(type);
}
});
}