MCPcopy Create free account
hub / github.com/apache/maka / schemaShapeForHash

Function schemaShapeForHash

packages/runtime/src/request-shape.ts:597–614  ·  view source on GitHub ↗
(schema: unknown)

Source from the content-addressed store, hash-verified

595}
596
597function schemaShapeForHash(schema: unknown): unknown {
598 if (isObjectLike(schema)) {
599 try {
600 return stripJsonSchemaRuntimeFields(
601 toJSONSchema(schema as never, {
602 io: 'input',
603 target: 'draft-07',
604 unrepresentable: 'any',
605 cycles: 'ref',
606 reused: 'inline',
607 }),
608 );
609 } catch {
610 // Fall through to structural canonicalization for plain JSON-schema-like objects.
611 }
612 }
613 return schema;
614}
615
616function stripJsonSchemaRuntimeFields(value: unknown): unknown {
617 if (Array.isArray(value)) return value.map(stripJsonSchemaRuntimeFields);

Callers 1

toolShapeForDiagnosticsFunction · 0.85

Calls 2

isObjectLikeFunction · 0.85

Tested by

no test coverage detected