From e2d2e65620dad397a9dc7cbfea27b4e980544954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=A4=A9=E4=B8=80?= Date: Fri, 6 Feb 2026 21:37:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(schema):=20=E4=BF=AE=E5=A4=8D=20properties?= =?UTF-8?q?=20=E5=AE=B9=E5=99=A8=E8=AF=AF=E5=88=A4=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=B3=A8=E5=85=A5=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/napcat-schema/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/napcat-schema/index.ts b/packages/napcat-schema/index.ts index 87ca7351..d644a506 100644 --- a/packages/napcat-schema/index.ts +++ b/packages/napcat-schema/index.ts @@ -215,6 +215,16 @@ function sanitizeSchemaForOpenAPI (schema: T): T { const next: Record = {}; for (const [key, child] of Object.entries(obj)) { + // 特殊处理 properties 容器:只遍历每个属性的 schema,避免将容器对象误判为 schema 元对象 + if (key === 'properties' && child && typeof child === 'object' && !Array.isArray(child)) { + const cleanProps: Record = {}; + for (const [propName, propSchema] of Object.entries(child as Record)) { + cleanProps[propName] = walk(propSchema); + } + next[key] = cleanProps; + continue; + } + if (key === '$id') { if (typeof child === 'string' && child.length > 0) { next['x-schema-id'] = child;