25 lines
964 B
Python
25 lines
964 B
Python
|
"""
|
|||
|
任务参数相关API模型
|
|||
|
包含任务参数的请求和响应的数据模型
|
|||
|
"""
|
|||
|
|
|||
|
from typing import Dict, Any, List, Optional
|
|||
|
from pydantic import BaseModel, Field
|
|||
|
from enum import Enum
|
|||
|
from config.task_config import TaskInputParamType
|
|||
|
|
|||
|
# 任务输入参数模型
|
|||
|
class TaskInputParamModel(BaseModel):
|
|||
|
"""任务输入参数模型"""
|
|||
|
param_id: Optional[str] = Field(None, description="参数ID,新增参数时不需要传")
|
|||
|
param_name: str = Field(..., description="变量名")
|
|||
|
label: str = Field(..., description="标签")
|
|||
|
param_type: TaskInputParamType = Field(..., description="类型")
|
|||
|
required: bool = Field(False, description="是否必填")
|
|||
|
default_value: Optional[Any] = Field(None, description="默认值")
|
|||
|
description: Optional[str] = Field(None, description="说明")
|
|||
|
|
|||
|
class TaskInputParamsUpdateRequest(BaseModel):
|
|||
|
"""任务输入参数更新请求"""
|
|||
|
task_id: str
|
|||
|
params: List[TaskInputParamModel]
|