Ajv defaults: non-standard "format": "json" in third-party schemas (e.g. Notion) warns twice per property — register it like #2601
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 70/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, typescript
- Área
- developer-experience, tooling
Línea de trabajo
Observe la función createDefaultAjvInstance en el módulo validador del SDK. El problema trata sobre agregar un formato de no operación para 'json' a las instancias de Ajv para suprimir advertencias. Revise cómo se registró 'google-duration' en el issue #2601 como referencia. El cambio implica modificar la configuración del validador predeterminado para incluir ajv.addFormat('json', true) para los tres motores de dialecto (Ajv2020, Ajv2019, Ajv). Después de realizar el cambio, pruebe con el código de reproducción proporcionado para asegurarse de que las advertencias hayan desaparecido.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Context
This is the same class of noise as #2601 (google-duration), with an instance found in the wild.
The Notion MCP server's post-page tool annotates two string properties with "format": "json" — a value that is defined neither by JSON Schema nor by ajv-formats. Compiling that inputSchema through the default validator instances of @modelcontextprotocol/client@2.0.0 (createDefaultAjvInstance: { strict: false, allErrors: true } + ajv-formats) logs, per compile:
unknown format "json" ignored in schema at path "#/properties/icon"
unknown format "json" ignored in schema at path "#/properties/icon"
unknown format "json" ignored in schema at path "#/properties/cover"
unknown format "json" ignored in schema at path "#/properties/cover"
Two lines per property, because allErrors: true makes Ajv compile the format check twice — i.e. connecting to that one server costs 4 lines of client-side warning output per session.
It is not purely cosmetic: with Ajv's own defaults (strict: true) the same schema throws during compile (Error: unknown format "json" ignored in schema at path "#/properties/icon"), so any integrator who wants a strict validator cannot load that tool.
Ask
- Register
jsonas a no-op format (ajv.addFormat("json", true)) increateDefaultAjvInstance, for all three dialect engines, alongside thegoogle-durationregistration proposed in #2601; or - Downgrade the unknown-format message to debug-level output, so quirks in third-party schemas don't surface as user-visible warnings.
Note on custom validator providers
Consumers that pass their own Ajv instance to AjvJsonSchemaValidator bypass the default instances entirely, so registering formats there does not help them — e.g. a downstream extension that constructs its own validator provider still gets the warnings until it registers json itself. Worth a line in the validator docs.
Environment / reproduction
@modelcontextprotocol/client 2.0.0 · ajv 8.20.0 · node 24.12.0
import Ajv2020 from "ajv/dist/2020.js";
import addFormats from "ajv-formats";
const ajv = new Ajv2020({ strict: false, allErrors: true }); // mirrors createDefaultAjvInstance
addFormats(ajv);
ajv.compile({
type: "object",
properties: {
icon: { type: "string", format: "json" },
cover: { type: "string", format: "json" },
},
});
// -> the four "unknown format" lines above
Filed after reproducing the behaviour locally with the reporter's coding agent; outputs above are from that run and can be provided on request.
- Lenguaje dominante
- TypeScript
- Estrellas
- 13.4k
- Forks
- 2.2k
- Merge medio
- 4 d 18 h
- PR fusionados (30 d)
- 6
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de modelcontextprotocol/typescript-sdk
-
v1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Auth metadata discovery: fallback URL built on resource host instead of authorization-server host Abiertov1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
-
v1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
modelcontextprotocol/typescript-sdk#2783 · 1 comentario ·
-
v1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
modelcontextprotocol/typescript-sdk#2773 · 1 comentario ·
-
v2
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
modelcontextprotocol/typescript-sdk#2766 · 1 comentario ·
Todos los issues de modelcontextprotocol/typescript-sdk
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
bcgov/bc-wallet-mobile#4761 · 1 comentario ·
-
external-issue to-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
area-deployment area-integrations triage:bot-seen
Dificultad 2/5 Medio día Aptitud para principiantes 86/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100