MCPcopy
hub / github.com/thesysdev/openui / getSchemaId

Function getSchemaId

packages/lang-core/src/library.ts:184–197  ·  view source on GitHub ↗
(schema: unknown, reg: SchemaRegistry)

Source from the content-addressed store, hash-verified

182type SchemaRegistry = ReturnType<typeof z.registry<{ id: string }>>;
183
184function getSchemaId(schema: unknown, reg: SchemaRegistry): string | undefined {
185 // Check per-library registry first
186 try {
187 const meta = reg.get(schema as z.$ZodType) as { id?: string } | undefined;
188 if (meta?.id) return meta.id;
189 } catch {
190 // not registered — fall through
191 }
192 // Fallback: WeakMap tags from defineComponent / tagSchemaId
193 if (typeof schema === "object" && schema !== null) {
194 return schemaIdTags.get(schema);
195 }
196 return undefined;
197}
198
199function getUnionOptions(schema: unknown): unknown[] | undefined {
200 const def = getZodDef(schema);

Callers 1

resolveBaseTypeFunction · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected