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

Method registerSchema

packages/orm/src/client/zod/factory.ts:219–227  ·  view source on GitHub ↗

* Registers a schema in the registry under the given id. * Safe to call multiple times with the same id: first registration wins, subsequent ones are silently skipped.

(id: string, schema: ZodType)

Source from the content-addressed store, hash-verified

217 * Safe to call multiple times with the same id: first registration wins, subsequent ones are silently skipped.
218 */
219 private registerSchema(id: string, schema: ZodType) {
220 if (!this.schemaRegistry.has(schema)) {
221 try {
222 this.schemaRegistry.add(schema, { id });
223 } catch {
224 // id already taken by a different schema variant (e.g. different options) — skip
225 }
226 }
227 }
228
229 /**
230 * Returns a JSON Schema document containing all registered Zod schemas as named definitions.

Callers 15

makeFindSchemaMethod · 0.95
makeExistsSchemaMethod · 0.95
makeEnumSchemaMethod · 0.95
makeTypeDefSchemaMethod · 0.95
makeWhereSchemaMethod · 0.95
makeEnumFilterSchemaMethod · 0.95
makeArrayFilterSchemaMethod · 0.95
makeJsonValueSchemaMethod · 0.95
makeJsonFilterSchemaMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected