Ajv defaults: non-standard "format": "json" in third-party schemas (e.g. Notion) warns twice per property — register it like #2601
Maintainer thường phản hồi trong vòng 4 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 70/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, typescript
- Lĩnh vực
- developer-experience, tooling
Hướng nghiên cứu
Xem xét hàm createDefaultAjvInstance trong mô-đun trình xác thực của SDK. Vấn đề là về việc thêm định dạng không hoạt động (no-op) cho 'json' vào các phiên bản Ajv để loại bỏ cảnh báo. Kiểm tra cách 'google-duration' đã được đăng ký trong issue #2601 để tham khảo. Thay đổi liên quan đến việc sửa đổi cấu hình trình xác thực mặc định để bao gồm ajv.addFormat('json', true) cho cả ba công cụ phương ngữ (Ajv2020, Ajv2019, Ajv). Sau khi thực hiện thay đổi, hãy kiểm tra với mã tái tạo được cung cấp để đảm bảo các cảnh báo đã biến mất.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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/[email protected] (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.
- Ngôn ngữ chính
- TypeScript
- Star
- 13.5k
- Fork
- 2.2k
- Merge trung bình
- 4 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 15
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelcontextprotocol/typescript-sdk
-
v1 v2
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
modelcontextprotocol/typescript-sdk#2867 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
v1 v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
modelcontextprotocol/typescript-sdk#2843 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Auth metadata discovery: fallback URL built on resource host instead of authorization-server hostĐang mởv1 v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
modelcontextprotocol/typescript-sdk#2784 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
v1 v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
modelcontextprotocol/typescript-sdk#2783 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
v1 v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
modelcontextprotocol/typescript-sdk#2773 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của modelcontextprotocol/typescript-sdk
Issue tương tự
-
priority: P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
prime-radiant-inc/evener#3291 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility bug revealjs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
quarto-dev/quarto-cli#14961 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
supabase/agent-skills#614 ·
-
Content
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
RunestoneInteractive/rs#1559 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày