Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/entities/plugin_entities/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const (
ARRAY = "array"
OBJECT = "object"
CHECKBOX = "checkbox"
DATE = "date"
DATE_PICKER = "date-picker"
)

type ParameterOption struct {
Expand Down
6 changes: 5 additions & 1 deletion pkg/entities/plugin_entities/tool_declaration.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const (
TOOL_PARAMETER_ARRAY ToolParameterType = ARRAY
TOOL_PARAMETER_OBJECT ToolParameterType = OBJECT
TOOL_PARAMETER_TYPE_CHECKBOX ToolParameterType = CHECKBOX
TOOL_PARAMETER_TYPE_DATE ToolParameterType = DATE
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The addition of the DATE type highlights a limitation in the ToolParameter struct (line 128), where Min and Max are defined as *float64. These fields cannot be used to enforce date range constraints. Additionally, there is currently no validation for the Default value to ensure it follows a specific format (e.g., ISO 8601). Consider updating the validation logic to support these requirements for date-related types.

TOOL_PARAMETER_TYPE_DATE_PICKER ToolParameterType = DATE_PICKER
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider whether both DATE and DATE_PICKER are necessary as distinct types. If they both represent a date string and the difference is purely a UI hint, it might be more maintainable to have a single DATE type. This avoids redundancy in the type system and simplifies the logic for consumers of these parameters.

)

func isToolParameterType(fl validator.FieldLevel) bool {
Expand All @@ -69,7 +71,9 @@ func isToolParameterType(fl validator.FieldLevel) bool {
string(TOOL_PARAMETER_TYPE_DYNAMIC_SELECT),
string(TOOL_PARAMETER_ARRAY),
string(TOOL_PARAMETER_OBJECT),
string(TOOL_PARAMETER_TYPE_CHECKBOX):
string(TOOL_PARAMETER_TYPE_CHECKBOX),
string(TOOL_PARAMETER_TYPE_DATE),
string(TOOL_PARAMETER_TYPE_DATE_PICKER):
return true
}
return false
Expand Down