MCPcopy Create free account
hub / github.com/zenstackhq/zenstack / canCreateModel

Method canCreateModel

packages/orm/src/client/zod/factory.ts:2619–2631  ·  view source on GitHub ↗
(model: string)

Source from the content-addressed store, hash-verified

2617 }
2618
2619 private canCreateModel(model: string) {
2620 const modelDef = requireModel(this.schema, model);
2621 if (modelDef.isDelegate) {
2622 return false;
2623 }
2624 const hasRequiredUnsupportedFields = Object.values(modelDef.fields).some(
2625 (fieldDef) => fieldDef.type === 'Unsupported' && !fieldDef.optional && !fieldHasDefaultValue(fieldDef),
2626 );
2627 if (hasRequiredUnsupportedFields) {
2628 return false;
2629 }
2630 return true;
2631 }
2632
2633 private isModelAllowed(targetModel: string): boolean {
2634 const slicing = this.options.slicing;

Callers 1

Calls 2

requireModelFunction · 0.90
fieldHasDefaultValueFunction · 0.90

Tested by

no test coverage detected