chore: 更新版本号至0.0.78,并在 fromJSONSchema 函数中将返回值设为可选
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user