Skip to content

Commit 0e08c7a

Browse files
Add validation for required parameters and pagination
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent e27559d commit 0e08c7a

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎pkg/github/automation_tags.go‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@ func ListAutomationTags(t translations.TranslationHelperFunc) inventory.ServerTo
5757
if input.Repo == "." || input.Repo == ".." {
5858
return utils.NewToolResultError(fmt.Sprintf("repo must not be %q", input.Repo)), nil, nil
5959
}
60+
if input.Owner == "" {
61+
return utils.NewToolResultError("missing required parameter: owner"), nil, nil
62+
}
63+
if input.Repo == "" {
64+
return utils.NewToolResultError("missing required parameter: repo"), nil, nil
65+
}
66+
if input.Page != nil && *input.Page < 1 {
67+
return utils.NewToolResultError("page must be at least 1"), nil, nil
68+
}
69+
if input.PerPage != nil && (*input.PerPage < 1 || *input.PerPage > 100) {
70+
return utils.NewToolResultError("perPage must be between 1 and 100"), nil, nil
71+
}
6072
pagination := PaginationParams{Page: 1, PerPage: 30}
6173
if input.Page != nil {
6274
pagination.Page = *input.Page

0 commit comments

Comments
 (0)