@tsed/schema
Version:
JsonSchema module for Ts.ED Framework
14 lines (13 loc) • 397 B
JavaScript
import { JsonEntityStore } from "../domain/JsonEntityStore.js";
import { JsonLazyRef } from "../domain/JsonLazyRef.js";
export function lazyRef(cb) {
try {
// solve issue with a self referenced model
if (cb()) {
// type is already accessible
return JsonEntityStore.from(cb()).schema;
}
}
catch (er) { }
return new JsonLazyRef(cb);
}