MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / loadAndCompileSchema

Function loadAndCompileSchema

tests/extension-fields.test.cjs:82–94  ·  view source on GitHub ↗
(schemaPath)

Source from the content-addressed store, hash-verified

80const schemaCache = new Map();
81
82async function loadAndCompileSchema(schemaPath) {
83 // Use cache to avoid "already exists" error
84 if (schemaCache.has(schemaPath)) {
85 return schemaCache.get(schemaPath);
86 }
87
88 const schemaContent = fs.readFileSync(schemaPath, 'utf8');
89 const schema = JSON.parse(schemaContent);
90 const validate = await ajv.compileAsync(schema);
91
92 schemaCache.set(schemaPath, validate);
93 return validate;
94}
95
96// Schemas that should have ext field
97const EXTENSIBLE_SCHEMAS = [

Callers 1

runTestsFunction · 0.70

Calls 3

hasMethod · 0.80
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected