Repository navigation
Conversation
…hile preserving dialect dispatch (modelcontextprotocol#3017)
🦋 Changeset detectedLatest commit: 86ee45e The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
@modelcontextprotocol/client
@modelcontextprotocol/codemod
@modelcontextprotocol/core
@modelcontextprotocol/server
@modelcontextprotocol/server-legacy
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
|
Checked the test against the merge-base (46d9c99) to confirm it guards the regression. On this branch, test/validators/ajvLazyInit.test.ts passes 7/7 and the full core-internal suite passes 1837/1837 (77 files, 6.7s). On base with only the test file overlaid, the new test fails its first assertion: the old constructor treats any argument as a caller engine, so |
Summary
Closes #3017.
AjvJsonSchemaValidatorpicks an AJV engine according to each schema's declared$schemadialect (Ajv2020 for 2020-12, Ajv2019 for 2019-09, and classic Draft7 Ajv for draft-07/06). Previously, the only way to configure engine options was to pass a pre-configured instance (new AjvJsonSchemaValidator(ajv)), which bypassed the$schemadialect dispatch entirely.This PR adds support for passing validator options:
The options are merged into the default options (
strict: false,validateFormats: true,validateSchema: false,allErrors: true, plus caller options) across each dialect engine while preserving lazy construction and dialect dispatch.Changes
AjvJsonSchemaValidatorOptionsinterface and exported it from@modelcontextprotocol/core-internal/validators/ajv,@modelcontextprotocol/server/validators/ajv, and@modelcontextprotocol/client/validators/ajv.AjvJsonSchemaValidatorconstructor to acceptajvOrOptions?: AjvLike | AjvJsonSchemaValidatorOptions.createDefaultAjvInstancewhen lazily constructing dialect engines.AjvLikeinstance (new AjvJsonSchemaValidator(ajv)).packages/core-internal/test/validators/ajvLazyInit.test.tsverifying that custom engine options (likeuseDefaults: true) work across all dialects (2020-12, 2019-09, draft-07) while maintaining lazy instantiation and dialect dispatch.ajvProvider.examples.ts.@modelcontextprotocol/serverand@modelcontextprotocol/client.Testing
packages/core-internal/test/validators/ajvLazyInit.test.ts: all passed.pnpm --filter @modelcontextprotocol/core-internal run check: typecheck, eslint, and prettier passed cleanly.pnpm --filter @modelcontextprotocol/client run check: passed.pnpm --filter @modelcontextprotocol/server run check: passed.pnpm --filter @modelcontextprotocol/core-internal test: 1526/1526 passed.pnpm --filter @modelcontextprotocol/client test: 998/998 passed.pnpm --filter @modelcontextprotocol/server test: 577/577 passed.pnpm run sync:snippets: confirmed all snippets up to date.