chore: update yaml tag for tools (#2356)

Update yaml tag in tools from `kind` to `type`.

Upcoming PRs: 
* Update config in `/tests` and `/docs`

Will resolve other unit tests failure in the final PR to keep things
simpler.
This commit is contained in:
Yuan Teoh
2026-01-26 17:53:37 -08:00
committed by Yuan Teoh
parent 83ebaf20b7
commit 474e480b2c
369 changed files with 4707 additions and 5752 deletions

View File

@@ -17,7 +17,6 @@ package cloudsqlcreatedatabase_test
import (
"testing"
"github.com/goccy/go-yaml"
"github.com/google/go-cmp/cmp"
"github.com/googleapis/genai-toolbox/internal/server"
"github.com/googleapis/genai-toolbox/internal/testutils"
@@ -37,11 +36,11 @@ func TestParseFromYaml(t *testing.T) {
{
desc: "basic example",
in: `
tools:
create-database:
kind: cloud-sql-create-database
source: my-source
description: some description
kind: tools
name: create-database
type: cloud-sql-create-database
source: my-source
description: some description
`,
want: server.ToolConfigs{
"create-database": cloudsqlcreatedatabase.Config{
@@ -56,15 +55,11 @@ func TestParseFromYaml(t *testing.T) {
}
for _, tc := range tcs {
t.Run(tc.desc, func(t *testing.T) {
got := struct {
Tools server.ToolConfigs `yaml:"tools"`
}{}
// Parse contents
err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got)
_, _, _, got, _, _, err := server.UnmarshalResourceConfig(ctx, testutils.FormatYaml(tc.in))
if err != nil {
t.Fatalf("unable to unmarshal: %s", err)
}
if diff := cmp.Diff(tc.want, got.Tools); diff != "" {
if diff := cmp.Diff(tc.want, got); diff != "" {
t.Fatalf("incorrect parse: diff %v", diff)
}
})