Skip to content

fix(schema): upgrade server.json dialect to JSON Schema 2020-12 - #1446

Open
piyushbag wants to merge 1 commit into
modelcontextprotocol:mainfrom
piyushbag:fix/842-json-schema-2020-12
Open

piyushbag wants to merge 1 commit into
modelcontextprotocol:mainfrom
piyushbag:fix/842-json-schema-2020-12

Conversation

@piyushbag

Copy link
Copy Markdown

Summary

The generated server.schema.json still advertised JSON Schema draft-07 while OpenAPI already sets jsonSchemaDialect to 2020-12. This updates the extractor and regenerates the draft artifact to match.

Approach

  • Emit https://json-schema.org/draft/2020-12/schema from tools/extract-server-schema
  • Regenerate docs/reference/server-json/draft/server.schema.json

Test plan

  • make generate-schema
  • make check-schema

Fixes #842

Match the OpenAPI jsonSchemaDialect and the official MCP server.json
schema by emitting https://json-schema.org/draft/2020-12/schema from the
extractor and regenerating the draft artifact.

Fixes modelcontextprotocol#842

@JosephDoUrden JosephDoUrden left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied this on current main (edd9fa7): make check-schema exits 0, make validate passes every example, go test ./internal/validators/... is green, and the two one-line hunks do not touch the lines #1364 and #1404 change. The runtime is unaffected today because schema.go:196 only compiles the embedded internal/validators/schemas/*.json, which are all still draft-07.

One thing changes silently. jsonschema v5.3.1 only enforces format for 2019-09 and later when AssertFormat is set (compiler.go:666); under draft-07 it is on by default. The compiler.Draft = Draft7 in tools/validate-*/main.go is only the fallback for a missing $schema, so once this file says 2020-12 the five format: uri fields stop being checked. I probed it with a document carrying repository.url: "::bad": the main schema rejects it, the PR schema accepts it, with and without the Draft7 fallback. That reaches publish-time validation the moment the next version is synced into the embedded set.

The fix is small: AssertFormat = true on the three compilers. With that in, this closes #842.

Not tested: a full 2020-12 vocabulary audit beyond definitions refs, items, dependencies and $id, which all look fine here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade JSON schema version to https://json-schema.org/draft/2020-12/schema

2 participants