MCPcopy Create free account
hub / github.com/anomalyco/opencode / normalizeZodJsonSchema

Function normalizeZodJsonSchema

packages/opencode/src/tool/registry.ts:375–387  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

373}
374
375function normalizeZodJsonSchema(value: unknown): unknown {
376 if (Array.isArray(value)) return value.map((item) => normalizeZodJsonSchema(item))
377 if (typeof value !== "object" || value === null) return value
378 return Object.fromEntries(
379 Object.entries(value)
380 .filter((entry) =>
381 (entry[0] === "exclusiveMaximum" || entry[0] === "exclusiveMinimum") && typeof entry[1] === "boolean"
382 ? false
383 : true,
384 )
385 .map(([key, item]) => [key, normalizeZodJsonSchema(item)]),
386 )
387}
388
389function isJsonSchemaObject(value: unknown): value is Record<string, unknown> {
390 return typeof value === "object" && value !== null && !Array.isArray(value)

Callers 1

zodJsonSchemaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected