From bf6b7ad709b0f54f41b977ce5037c9ec414d7f9c Mon Sep 17 00:00:00 2001 From: abearxiong Date: Wed, 18 Feb 2026 10:51:32 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E8=87=B30.0.78=EF=BC=8C=E5=B9=B6=E5=9C=A8=20fromJSONS?= =?UTF-8?q?chema=20=E5=87=BD=E6=95=B0=E4=B8=AD=E5=B0=86=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=80=BC=E8=AE=BE=E4=B8=BA=E5=8F=AF=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/route.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4379b6b..59e93a9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package", "name": "@kevisual/router", - "version": "0.0.77", + "version": "0.0.78", "description": "", "type": "module", "main": "./dist/router.js", diff --git a/src/route.ts b/src/route.ts index 9af27c5..b25049d 100644 --- a/src/route.ts +++ b/src/route.ts @@ -320,7 +320,8 @@ export const fromJSONSchema = (args: any = {}, opt const newArgs: { [key: string]: any } = {}; for (let key of keys) { const item = args[key]; - newArgs[key] = z.fromJSONSchema(item); + // fromJSONSchema 可能会失败,所以先 optional,等使用的时候再验证 + newArgs[key] = z.fromJSONSchema(item).optional(); } resultArgs = newArgs; }