feat: 更新上传文件字段的schema,增加文件类型和大小限制,提升文件上传的有效性

This commit is contained in:
iHeyTang 2025-08-20 11:25:48 +08:00
parent 583848e803
commit 7ab784eef6
1 changed files with 7 additions and 1 deletions

View File

@ -409,7 +409,13 @@ def _generate_field_schema(input_field: dict) -> dict:
)
elif field_type == "UploadFile":
field_schema.update(
{"type": "string", "format": "binary", "contentMediaType": "image/*", "description": "上传文件"}
{
"type": "string",
"format": "binary",
"contentMediaType": "image/*",
"pattern": ".*\\.(jpg|jpeg|png)$",
"description": "[ext:jpg,jpeg,png][file-size:1MB] 上传图片文件",
}
)
else: # string
field_schema.update({"type": "string"})