Skip to content

Commit

Permalink
chore: revert tool ids to action names for generated tools (#1616)
Browse files Browse the repository at this point in the history
  • Loading branch information
RutZap authored Sep 27, 2024
1 parent bd959e2 commit 82d603e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
3 changes: 1 addition & 2 deletions tools/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"sort"
"strings"

"github.com/iancoleman/strcase"
"github.com/teamkeel/keel/casing"
"github.com/teamkeel/keel/proto"
toolsproto "github.com/teamkeel/keel/tools/proto"
Expand Down Expand Up @@ -83,7 +82,7 @@ func (g *Generator) scaffoldTools() {
for _, action := range model.GetActions() {
t := Tool{
Config: &toolsproto.ActionConfig{
Id: strcase.ToKebab(action.GetName()),
Id: action.GetName(),
ApiNames: g.Schema.FindApiNames(model.Name, action.Name),
Name: casing.ToSentenceCase(action.Name),
ActionName: action.GetName(),
Expand Down
26 changes: 13 additions & 13 deletions tools/testdata/blog/tools.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"tools": [
{
"id": "create-from-image",
"id": "createFromImage",
"name": "Create from image",
"actionName": "createFromImage",
"apiNames": ["Api"],
Expand All @@ -22,7 +22,7 @@
"capabilities": {}
},
{
"id": "create-post",
"id": "createPost",
"name": "Create post",
"actionName": "createPost",
"apiNames": ["Api"],
Expand Down Expand Up @@ -178,7 +178,7 @@
}
},
{
"id": "delete-category",
"id": "deleteCategory",
"name": "Delete category",
"actionName": "deleteCategory",
"apiNames": ["Api"],
Expand Down Expand Up @@ -233,7 +233,7 @@
"capabilities": {}
},
{
"id": "delete-post",
"id": "deletePost",
"name": "Delete post",
"actionName": "deletePost",
"apiNames": ["Api"],
Expand Down Expand Up @@ -343,7 +343,7 @@
"capabilities": {}
},
{
"id": "get-category",
"id": "getCategory",
"name": "Get category",
"actionName": "getCategory",
"apiNames": ["Api"],
Expand Down Expand Up @@ -404,7 +404,7 @@
]
},
{
"id": "get-post",
"id": "getPost",
"name": "Get post",
"actionName": "getPost",
"apiNames": ["Api"],
Expand Down Expand Up @@ -534,7 +534,7 @@
"createEntryAction": { "toolId": "createPost" }
},
{
"id": "list-categories",
"id": "listCategories",
"name": "List categories",
"actionName": "listCategories",
"apiNames": ["Api"],
Expand Down Expand Up @@ -680,7 +680,7 @@
}
},
{
"id": "list-comments",
"id": "listComments",
"name": "List comments",
"actionName": "listComments",
"apiNames": ["Api"],
Expand Down Expand Up @@ -889,7 +889,7 @@
}
},
{
"id": "list-posts",
"id": "listPosts",
"name": "List posts",
"actionName": "listPosts",
"apiNames": ["Api"],
Expand Down Expand Up @@ -1109,7 +1109,7 @@
"createEntryAction": { "toolId": "createPost" }
},
{
"id": "list-posts-embeds",
"id": "listPostsEmbeds",
"name": "List posts embeds",
"actionName": "listPostsEmbeds",
"apiNames": ["Api"],
Expand Down Expand Up @@ -1494,7 +1494,7 @@
"createEntryAction": { "toolId": "createPost" }
},
{
"id": "request-password-reset",
"id": "requestPasswordReset",
"name": "Request password reset",
"actionName": "requestPasswordReset",
"apiNames": ["Api"],
Expand Down Expand Up @@ -1522,7 +1522,7 @@
"capabilities": {}
},
{
"id": "reset-password",
"id": "resetPassword",
"name": "Reset password",
"actionName": "resetPassword",
"apiNames": ["Api"],
Expand Down Expand Up @@ -1550,7 +1550,7 @@
"capabilities": {}
},
{
"id": "update-post",
"id": "updatePost",
"name": "Update post",
"actionName": "updatePost",
"apiNames": ["Api"],
Expand Down
6 changes: 3 additions & 3 deletions tools/testdata/nested_inputs/tools.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"tools": [
{
"id": "create-invoice",
"id": "createInvoice",
"name": "Create invoice",
"actionName": "createInvoice",
"apiNames": ["Api"],
Expand Down Expand Up @@ -98,7 +98,7 @@
"capabilities": {}
},
{
"id": "request-password-reset",
"id": "requestPasswordReset",
"name": "Request password reset",
"actionName": "requestPasswordReset",
"apiNames": ["Api"],
Expand Down Expand Up @@ -126,7 +126,7 @@
"capabilities": {}
},
{
"id": "reset-password",
"id": "resetPassword",
"name": "Reset password",
"actionName": "resetPassword",
"apiNames": ["Api"],
Expand Down
6 changes: 3 additions & 3 deletions tools/testdata/nested_outputs/tools.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"tools": [
{
"id": "read-invoices",
"id": "readInvoices",
"name": "Read invoices",
"actionName": "readInvoices",
"apiNames": ["Api"],
Expand Down Expand Up @@ -93,7 +93,7 @@
"capabilities": {}
},
{
"id": "request-password-reset",
"id": "requestPasswordReset",
"name": "Request password reset",
"actionName": "requestPasswordReset",
"apiNames": ["Api"],
Expand Down Expand Up @@ -121,7 +121,7 @@
"capabilities": {}
},
{
"id": "reset-password",
"id": "resetPassword",
"name": "Reset password",
"actionName": "resetPassword",
"apiNames": ["Api"],
Expand Down

0 comments on commit 82d603e

Please sign in to comment.