chore: 更新版本号至0.0.78,并在 fromJSONSchema 函数中将返回值设为可选

This commit is contained in:
2026-02-18 10:51:32 +08:00
parent 0866f01b1e
commit bf6b7ad709
2 changed files with 3 additions and 2 deletions

View File

@@ -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",

View File

@@ -320,7 +320,8 @@ export const fromJSONSchema = <Merge extends boolean = true>(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;
}