Compare commits

...

2 Commits

Author SHA1 Message Date
Yuan Teoh
1613cc7606 chore: update yaml tag in tools 2025-09-09 11:18:26 -07:00
Yuan Teoh
66d5a10790 chore: update unmarshal function for ToolsFile 2025-09-05 17:41:01 -07:00
153 changed files with 441 additions and 397 deletions

View File

@@ -265,7 +265,6 @@ func NewCommand(opts ...Option) *Command {
type ToolsFile struct {
Sources server.SourceConfigs `yaml:"sources"`
AuthSources server.AuthServiceConfigs `yaml:"authSources"` // Deprecated: Kept for compatibility.
AuthServices server.AuthServiceConfigs `yaml:"authServices"`
Tools server.ToolConfigs `yaml:"tools"`
Toolsets server.ToolsetConfigs `yaml:"toolsets"`
@@ -374,8 +373,13 @@ func parseToolsFile(ctx context.Context, raw []byte) (ToolsFile, error) {
}
raw = []byte(output)
raw, err = convertToolsFile(ctx, raw)
if err != nil {
return toolsFile, fmt.Errorf("error converting tools file: %s", err)
}
// Parse contents
err = yaml.UnmarshalContext(ctx, raw, &toolsFile, yaml.Strict())
toolsFile.Sources, toolsFile.AuthServices, toolsFile.Tools, toolsFile.Toolsets, err = server.UnmarshalResourceConfig(ctx, raw)
if err != nil {
return toolsFile, err
}
@@ -405,15 +409,6 @@ func mergeToolsFiles(files ...ToolsFile) (ToolsFile, error) {
}
}
// Check for conflicts and merge authSources (deprecated, but still support)
for name, authSource := range file.AuthSources {
if _, exists := merged.AuthSources[name]; exists {
conflicts = append(conflicts, fmt.Sprintf("authSource '%s' (file #%d)", name, fileIndex+1))
} else {
merged.AuthSources[name] = authSource
}
}
// Check for conflicts and merge authServices
for name, authService := range file.AuthServices {
if _, exists := merged.AuthServices[name]; exists {
@@ -869,11 +864,6 @@ func run(cmd *Command) error {
}
cmd.cfg.SourceConfigs, cmd.cfg.AuthServiceConfigs, cmd.cfg.ToolConfigs, cmd.cfg.ToolsetConfigs = toolsFile.Sources, toolsFile.AuthServices, toolsFile.Tools, toolsFile.Toolsets
authSourceConfigs := toolsFile.AuthSources
if authSourceConfigs != nil {
cmd.logger.WarnContext(ctx, "`authSources` is deprecated, use `authServices` instead")
cmd.cfg.AuthServiceConfigs = authSourceConfigs
}
instrumentation, err := telemetry.CreateTelemetryInstrumentation(versionString)
if err != nil {

View File

@@ -723,6 +723,71 @@ func TestParseToolFile(t *testing.T) {
},
},
},
{
description: "basic example",
in: `
kind: sources
name: my-pg-instance
type: cloud-sql-postgres
project: my-project
region: my-region
instance: my-instance
database: my_db
user: my_user
password: my_pass
---
kind: tools
name: example_tool
type: postgres-sql
source: my-pg-instance
description: some description
statement: |
SELECT * FROM SQL_STATEMENT;
parameters:
- name: country
type: string
description: some description
---
kind: toolsets
name: example_toolset
tools:
- example_tool
`,
wantToolsFile: ToolsFile{
Sources: server.SourceConfigs{
"my-pg-instance": cloudsqlpgsrc.Config{
Name: "my-pg-instance",
Type: cloudsqlpgsrc.SourceType,
Project: "my-project",
Region: "my-region",
Instance: "my-instance",
IPType: "public",
Database: "my_db",
User: "my_user",
Password: "my_pass",
},
},
Tools: server.ToolConfigs{
"example_tool": postgressql.Config{
Name: "example_tool",
Type: "postgres-sql",
Source: "my-pg-instance",
Description: "some description",
Statement: "SELECT * FROM SQL_STATEMENT;\n",
Parameters: []tools.Parameter{
tools.NewStringParameter("country", "some description"),
},
AuthRequired: []string{},
},
},
Toolsets: server.ToolsetConfigs{
"example_toolset": tools.ToolsetConfig{
Name: "example_toolset",
ToolNames: []string{"example_tool"},
},
},
},
},
}
for _, tc := range tcs {
t.Run(tc.description, func(t *testing.T) {
@@ -920,7 +985,7 @@ func TestParseToolFileWithAuth(t *testing.T) {
Password: "my_pass",
},
},
AuthSources: server.AuthServiceConfigs{
AuthServices: server.AuthServiceConfigs{
"my-google-service": google.Config{
Name: "my-google-service",
Type: google.AuthServiceType,

View File

@@ -14,6 +14,7 @@
package server
import (
"bytes"
"context"
"fmt"
"strings"
@@ -111,162 +112,151 @@ func (s *StringLevel) Type() string {
return "stringLevel"
}
func UnmarshalResourceConfig(ctx context.Context, raw []byte) (SourceConfigs, AuthServiceConfigs, ToolConfigs, ToolsetConfigs, error) {
// prepare configs map
sourceConfigs := make(SourceConfigs)
authServiceConfigs := make(AuthServiceConfigs)
toolConfigs := make(ToolConfigs)
toolsetConfigs := make(ToolsetConfigs)
decoder := yaml.NewDecoder(bytes.NewReader(raw))
// for loop to unmarshal documents with the `---` separator
for {
var resource map[string]any
if err := decoder.DecodeContext(ctx, &resource); err != nil {
if err.Error() == "EOF" {
break
}
return nil, nil, nil, nil, fmt.Errorf("unable to parse kind: %s", err)
}
var kind, name string
var ok bool
if kind, ok = resource["kind"].(string); !ok {
return nil, nil, nil, nil, fmt.Errorf("missing 'kind' field or it is not a string")
}
if name, ok = resource["name"].(string); !ok {
return nil, nil, nil, nil, fmt.Errorf("missing 'name' field or it is not a string")
}
// remove 'kind' from map for strict unmarshaling
delete(resource, "kind")
switch kind {
case "sources":
c, err := UnmarshalYAMLSourceConfig(ctx, name, resource)
if err != nil {
return nil, nil, nil, nil, fmt.Errorf("error unmarshaling %s: %s", kind, err)
}
sourceConfigs[name] = c
case "authServices":
c, err := UnmarshalYAMLAuthServiceConfig(ctx, name, resource)
if err != nil {
return nil, nil, nil, nil, fmt.Errorf("error unmarshaling %s: %s", kind, err)
}
authServiceConfigs[name] = c
case "tools":
c, err := UnmarshalYAMLToolConfig(ctx, name, resource)
if err != nil {
return nil, nil, nil, nil, fmt.Errorf("error unmarshaling %s: %s", kind, err)
}
toolConfigs[name] = c
case "toolsets":
c, err := UnmarshalYAMLToolsetConfig(ctx, name, resource)
if err != nil {
return nil, nil, nil, nil, fmt.Errorf("error unmarshaling %s: %s", kind, err)
}
toolsetConfigs[name] = c
default:
return nil, nil, nil, nil, fmt.Errorf("invalid kind %s", kind)
}
}
return sourceConfigs, authServiceConfigs, toolConfigs, toolsetConfigs, nil
}
// SourceConfigs is a type used to allow unmarshal of the data source config map
type SourceConfigs map[string]sources.SourceConfig
// validate interface
var _ yaml.InterfaceUnmarshalerContext = &SourceConfigs{}
func (c *SourceConfigs) UnmarshalYAML(ctx context.Context, unmarshal func(interface{}) error) error {
*c = make(SourceConfigs)
// Parse the 'type' fields for each source
var raw map[string]util.DelayedUnmarshaler
if err := unmarshal(&raw); err != nil {
return err
func UnmarshalYAMLSourceConfig(ctx context.Context, name string, r map[string]any) (sources.SourceConfig, error) {
typeStr, ok := r["type"].(string)
if !ok {
return nil, fmt.Errorf("missing 'name' field or it is not a string")
}
for name, u := range raw {
// Unmarshal to a general type that ensure it capture all fields
var v map[string]any
if err := u.Unmarshal(&v); err != nil {
return fmt.Errorf("unable to unmarshal %q: %w", name, err)
}
sourceType, ok := v["kind"]
if !ok {
return fmt.Errorf("missing 'kind' field for source %q", name)
}
typeStr, ok := sourceType.(string)
if !ok {
return fmt.Errorf("invalid 'kind' field for source %q (must be a string)", name)
}
yamlDecoder, err := util.NewStrictDecoder(v)
if err != nil {
return fmt.Errorf("error creating YAML decoder for source %q: %w", name, err)
}
sourceConfig, err := sources.DecodeConfig(ctx, typeStr, name, yamlDecoder)
if err != nil {
return err
}
(*c)[name] = sourceConfig
dec, err := util.NewStrictDecoder(r)
if err != nil {
return nil, fmt.Errorf("error creating decoder: %s", err)
}
return nil
sourceConfig, err := sources.DecodeConfig(ctx, typeStr, name, dec)
if err != nil {
return nil, err
}
return sourceConfig, nil
}
// AuthServiceConfigs is a type used to allow unmarshal of the data authService config map
type AuthServiceConfigs map[string]auth.AuthServiceConfig
// validate interface
var _ yaml.InterfaceUnmarshalerContext = &AuthServiceConfigs{}
func (c *AuthServiceConfigs) UnmarshalYAML(ctx context.Context, unmarshal func(interface{}) error) error {
*c = make(AuthServiceConfigs)
// Parse the 'type' fields for each authService
var raw map[string]util.DelayedUnmarshaler
if err := unmarshal(&raw); err != nil {
return err
func UnmarshalYAMLAuthServiceConfig(ctx context.Context, name string, r map[string]any) (auth.AuthServiceConfig, error) {
typeStr, ok := r["type"].(string)
if !ok {
return nil, fmt.Errorf("missing 'name' field or it is not a string")
}
for name, u := range raw {
var v map[string]any
if err := u.Unmarshal(&v); err != nil {
return fmt.Errorf("unable to unmarshal %q: %w", name, err)
}
asType, ok := v["kind"]
if !ok {
return fmt.Errorf("missing 'kind' field for %q", name)
}
dec, err := util.NewStrictDecoder(v)
if err != nil {
return fmt.Errorf("error creating decoder: %w", err)
}
switch asType {
case google.AuthServiceType:
actual := google.Config{Name: name}
if err := dec.DecodeContext(ctx, &actual); err != nil {
return fmt.Errorf("unable to parse as %q: %w", asType, err)
}
(*c)[name] = actual
default:
return fmt.Errorf("%q is not a valid kind of auth source", asType)
}
if typeStr != google.AuthServiceType {
return nil, fmt.Errorf("%s is not a valid type of auth source", typeStr)
}
return nil
dec, err := util.NewStrictDecoder(r)
if err != nil {
return nil, fmt.Errorf("error creating decoder: %s", err)
}
actual := google.Config{Name: name}
if err := dec.DecodeContext(ctx, &actual); err != nil {
return nil, fmt.Errorf("unable to parse as %s: %w", name, err)
}
return actual, nil
}
// ToolConfigs is a type used to allow unmarshal of the tool configs
type ToolConfigs map[string]tools.ToolConfig
// validate interface
var _ yaml.InterfaceUnmarshalerContext = &ToolConfigs{}
func (c *ToolConfigs) UnmarshalYAML(ctx context.Context, unmarshal func(interface{}) error) error {
*c = make(ToolConfigs)
// Parse the 'type' fields for each source
var raw map[string]util.DelayedUnmarshaler
if err := unmarshal(&raw); err != nil {
return err
func UnmarshalYAMLToolConfig(ctx context.Context, name string, r map[string]any) (tools.ToolConfig, error) {
typeStr, ok := r["type"].(string)
if !ok {
return nil, fmt.Errorf("missing 'name' field or it is not a string")
}
for name, u := range raw {
var v map[string]any
if err := u.Unmarshal(&v); err != nil {
return fmt.Errorf("unable to unmarshal %q: %w", name, err)
}
// `authRequired` and `useClientOAuth` cannot be specified together
if v["authRequired"] != nil && v["useClientOAuth"] == true {
return fmt.Errorf("`authRequired` and `useClientOAuth` are mutually exclusive. Choose only one authentication method")
}
// Make `authRequired` an empty list instead of nil for Tool manifest
if v["authRequired"] == nil {
v["authRequired"] = []string{}
}
typeVal, ok := v["kind"]
if !ok {
return fmt.Errorf("missing 'kind' field for tool %q", name)
}
typeStr, ok := typeVal.(string)
if !ok {
return fmt.Errorf("invalid 'kind' field for tool %q (must be a string)", name)
}
yamlDecoder, err := util.NewStrictDecoder(v)
if err != nil {
return fmt.Errorf("error creating YAML decoder for tool %q: %w", name, err)
}
toolCfg, err := tools.DecodeConfig(ctx, typeStr, name, yamlDecoder)
if err != nil {
return err
}
(*c)[name] = toolCfg
// `authRequired` and `useClientOAuth` cannot be specified together
if r["authRequired"] != nil && r["useClientOAuth"] == true {
return nil, fmt.Errorf("`authRequired` and `useClientOAuth` are mutually exclusive. Choose only one authentication method")
}
return nil
// Make `authRequired` an empty list instead of nil for Tool manifest
if r["authRequired"] == nil {
r["authRequired"] = []string{}
}
dec, err := util.NewStrictDecoder(r)
if err != nil {
return nil, fmt.Errorf("error creating decoder: %s", err)
}
toolCfg, err := tools.DecodeConfig(ctx, typeStr, name, dec)
if err != nil {
return nil, err
}
return toolCfg, nil
}
// ToolConfigs is a type used to allow unmarshal of the toolset configs
type ToolsetConfigs map[string]tools.ToolsetConfig
// validate interface
var _ yaml.InterfaceUnmarshalerContext = &ToolsetConfigs{}
func (c *ToolsetConfigs) UnmarshalYAML(ctx context.Context, unmarshal func(interface{}) error) error {
*c = make(ToolsetConfigs)
func UnmarshalYAMLToolsetConfig(ctx context.Context, name string, r map[string]any) (tools.ToolsetConfig, error) {
var toolsetConfig tools.ToolsetConfig
justTools := map[string]any{"tools": r["tools"]}
dec, err := util.NewStrictDecoder(justTools)
if err != nil {
return toolsetConfig, fmt.Errorf("error creating decoder: %s", err)
}
var raw map[string][]string
if err := unmarshal(&raw); err != nil {
return err
if err := dec.DecodeContext(ctx, &raw); err != nil {
return toolsetConfig, fmt.Errorf("unable to unmarshal tools: %s", err)
}
for name, toolList := range raw {
(*c)[name] = tools.ToolsetConfig{Name: name, ToolNames: toolList}
}
return nil
return tools.ToolsetConfig{Name: name, ToolNames: raw["tools"]}, nil
}

View File

@@ -53,7 +53,7 @@ var compatibleSources = [...]string{alloydbpg.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
NLConfig string `yaml:"nlConfig" validate:"required"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlAlloyDBNLA(t *testing.T) {
in: `
tools:
example_tool:
kind: alloydb-ai-nl
type: alloydb-ai-nl
source: my-alloydb-instance
description: AlloyDB natural language query tool
nlConfig: 'my_nl_config'
@@ -74,7 +74,7 @@ func TestParseFromYamlAlloyDBNLA(t *testing.T) {
in: `
tools:
complex_tool:
kind: alloydb-ai-nl
type: alloydb-ai-nl
source: my-alloydb-instance
description: AlloyDB natural language query tool with multiple parameters
nlConfig: 'complex_nl_config'

View File

@@ -107,7 +107,7 @@ var compatibleSources = [...]string{bigqueryds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlBigQueryConversationalAnalytics(t *testing.T) {
in: `
tools:
example_tool:
kind: bigquery-conversational-analytics
type: bigquery-conversational-analytics
source: my-instance
description: some description
`,

View File

@@ -59,7 +59,7 @@ var compatibleSources = [...]string{bigqueryds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlBigQueryExecuteSql(t *testing.T) {
in: `
tools:
example_tool:
kind: bigquery-execute-sql
type: bigquery-execute-sql
source: my-instance
description: some description
`,

View File

@@ -59,7 +59,7 @@ var compatibleSources = [...]string{bigqueryds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlBigQueryForecast(t *testing.T) {
in: `
tools:
example_tool:
kind: bigquery-forecast
type: bigquery-forecast
source: my-instance
description: some description
`,

View File

@@ -57,7 +57,7 @@ var compatibleSources = [...]string{bigqueryds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlBigQueryGetDatasetInfo(t *testing.T) {
in: `
tools:
example_tool:
kind: bigquery-get-dataset-info
type: bigquery-get-dataset-info
source: my-instance
description: some description
`,

View File

@@ -58,7 +58,7 @@ var compatibleSources = [...]string{bigqueryds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlBigQueryGetTableInfo(t *testing.T) {
in: `
tools:
example_tool:
kind: bigquery-get-table-info
type: bigquery-get-table-info
source: my-instance
description: some description
`,

View File

@@ -57,7 +57,7 @@ var compatibleSources = [...]string{bigqueryds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlBigQueryListDatasetIds(t *testing.T) {
in: `
tools:
example_tool:
kind: bigquery-list-dataset-ids
type: bigquery-list-dataset-ids
source: my-instance
description: some description
`,

View File

@@ -58,7 +58,7 @@ var compatibleSources = [...]string{bigqueryds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlBigQueryListTableIds(t *testing.T) {
in: `
tools:
example_tool:
kind: bigquery-list-table-ids
type: bigquery-list-table-ids
source: my-instance
description: some description
`,

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlBigQuery(t *testing.T) {
in: `
tools:
example_tool:
kind: bigquery-sql
type: bigquery-sql
source: my-instance
description: some description
statement: |
@@ -98,7 +98,7 @@ func TestParseFromYamlWithTemplateBigQuery(t *testing.T) {
in: `
tools:
example_tool:
kind: bigquery-sql
type: bigquery-sql
source: my-instance
description: some description
statement: |

View File

@@ -60,7 +60,7 @@ var compatibleSources = [...]string{bigqueryds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
Statement string `yaml:"statement" validate:"required"`

View File

@@ -52,7 +52,7 @@ var compatibleSources = [...]string{bigtabledb.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
Statement string `yaml:"statement" validate:"required"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlBigtable(t *testing.T) {
in: `
tools:
example_tool:
kind: bigtable-sql
type: bigtable-sql
source: my-pg-instance
description: some description
statement: |
@@ -98,7 +98,7 @@ func TestParseFromYamlWithTemplateBigtable(t *testing.T) {
in: `
tools:
example_tool:
kind: bigtable-sql
type: bigtable-sql
source: my-pg-instance
description: some description
statement: |

View File

@@ -48,7 +48,7 @@ func newExecuteSQLConfig(ctx context.Context, name string, decoder *yaml.Decoder
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -38,7 +38,7 @@ func TestParseFromYamlClickHouseExecuteSQL(t *testing.T) {
in: `
tools:
example_tool:
kind: clickhouse-execute-sql
type: clickhouse-execute-sql
source: my-instance
description: some description
`,

View File

@@ -48,7 +48,7 @@ func newSQLConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tool
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
Statement string `yaml:"statement" validate:"required"`

View File

@@ -48,7 +48,7 @@ func TestParseFromYamlClickHouseSQL(t *testing.T) {
in: `
tools:
example_tool:
kind: clickhouse-sql
type: clickhouse-sql
source: my-instance
description: some description
statement: SELECT 1
@@ -69,7 +69,7 @@ func TestParseFromYamlClickHouseSQL(t *testing.T) {
in: `
tools:
param_tool:
kind: clickhouse-sql
type: clickhouse-sql
source: test-source
description: Test ClickHouse tool
statement: SELECT * FROM test_table WHERE id = $1

View File

@@ -54,7 +54,7 @@ var compatibleSources = [...]string{couchbase.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
Statement string `yaml:"statement" validate:"required"`

View File

@@ -37,7 +37,7 @@ func TestParseFromYamlCouchbase(t *testing.T) {
in: `
tools:
example_tool:
kind: couchbase-sql
type: couchbase-sql
source: my-couchbase-instance
description: some tool description
statement: |
@@ -101,7 +101,7 @@ func TestParseFromYamlWithTemplateMssql(t *testing.T) {
in: `
tools:
example_tool:
kind: couchbase-sql
type: couchbase-sql
source: my-couchbase-instance
description: some tool description
statement: |

View File

@@ -53,7 +53,7 @@ var compatibleSources = [...]string{dataplexds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlDataplexLookupEntry(t *testing.T) {
in: `
tools:
example_tool:
kind: dataplex-lookup-entry
type: dataplex-lookup-entry
source: my-instance
description: some description
`,
@@ -59,7 +59,7 @@ func TestParseFromYamlDataplexLookupEntry(t *testing.T) {
in: `
tools:
example_tool:
kind: dataplex-lookup-entry
type: dataplex-lookup-entry
source: my-instance
description: some description
parameters:

View File

@@ -55,7 +55,7 @@ var compatibleSources = [...]string{dataplexds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlDataplexSearchAspectTypes(t *testing.T) {
in: `
tools:
example_tool:
kind: dataplex-search-aspect-types
type: dataplex-search-aspect-types
source: my-instance
description: some description
`,

View File

@@ -54,7 +54,7 @@ var compatibleSources = [...]string{dataplexds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlDataplexSearchEntries(t *testing.T) {
in: `
tools:
example_tool:
kind: dataplex-search-entries
type: dataplex-search-entries
source: my-instance
description: some description
`,

View File

@@ -52,7 +52,7 @@ var compatibleSources = [...]string{dgraph.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
Statement string `yaml:"statement" validate:"required"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlDgraph(t *testing.T) {
in: `
tools:
example_tool:
kind: dgraph-dql
type: dgraph-dql
source: my-dgraph-instance
description: some tool description
isQuery: true
@@ -65,7 +65,7 @@ func TestParseFromYamlDgraph(t *testing.T) {
in: `
tools:
example_tool:
kind: dgraph-dql
type: dgraph-dql
source: my-dgraph-instance
description: some tool description
statement: |

View File

@@ -52,7 +52,7 @@ var compatibleSources = [...]string{firebird.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlExecuteSql(t *testing.T) {
in: `
tools:
example_tool:
kind: firebird-execute-sql
type: firebird-execute-sql
source: my-instance
description: some description
authRequired:

View File

@@ -53,7 +53,7 @@ var compatibleSources = [...]string{firebird.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
Statement string `yaml:"statement" validate:"required"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlFirebird(t *testing.T) {
in: `
tools:
example_tool:
kind: firebird-sql
type: firebird-sql
source: my-fdb-instance
description: some description
statement: |
@@ -108,7 +108,7 @@ func TestParseFromYamlWithTemplateParamsFirebird(t *testing.T) {
in: `
tools:
example_tool:
kind: firebird-sql
type: firebird-sql
source: my-fdb-instance
description: some description
statement: |

View File

@@ -56,7 +56,7 @@ var compatibleSources = [...]string{firestoreds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlFirestoreAddDocuments(t *testing.T) {
in: `
tools:
add_docs_tool:
kind: firestore-add-documents
type: firestore-add-documents
source: my-firestore-instance
description: Add documents to Firestore collections
`,
@@ -58,7 +58,7 @@ func TestParseFromYamlFirestoreAddDocuments(t *testing.T) {
in: `
tools:
secure_add_docs:
kind: firestore-add-documents
type: firestore-add-documents
source: prod-firestore
description: Add documents with authentication
authRequired:
@@ -101,17 +101,17 @@ func TestParseFromYamlMultipleTools(t *testing.T) {
in := `
tools:
add_user_docs:
kind: firestore-add-documents
type: firestore-add-documents
source: users-firestore
description: Add user documents
authRequired:
- user-auth
add_product_docs:
kind: firestore-add-documents
type: firestore-add-documents
source: products-firestore
description: Add product documents
add_order_docs:
kind: firestore-add-documents
type: firestore-add-documents
source: orders-firestore
description: Add order documents
authRequired:

View File

@@ -54,7 +54,7 @@ var compatibleSources = [...]string{firestoreds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlFirestoreDeleteDocuments(t *testing.T) {
in: `
tools:
delete_docs_tool:
kind: firestore-delete-documents
type: firestore-delete-documents
source: my-firestore-instance
description: Delete documents from Firestore by paths
`,
@@ -58,7 +58,7 @@ func TestParseFromYamlFirestoreDeleteDocuments(t *testing.T) {
in: `
tools:
secure_delete_docs:
kind: firestore-delete-documents
type: firestore-delete-documents
source: prod-firestore
description: Delete documents with authentication
authRequired:
@@ -101,17 +101,17 @@ func TestParseFromYamlMultipleTools(t *testing.T) {
in := `
tools:
delete_user_docs:
kind: firestore-delete-documents
type: firestore-delete-documents
source: users-firestore
description: Delete user documents
authRequired:
- user-auth
delete_product_docs:
kind: firestore-delete-documents
type: firestore-delete-documents
source: products-firestore
description: Delete product documents
delete_order_docs:
kind: firestore-delete-documents
type: firestore-delete-documents
source: orders-firestore
description: Delete order documents
authRequired:

View File

@@ -54,7 +54,7 @@ var compatibleSources = [...]string{firestoreds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlFirestoreGetDocuments(t *testing.T) {
in: `
tools:
get_docs_tool:
kind: firestore-get-documents
type: firestore-get-documents
source: my-firestore-instance
description: Retrieve documents from Firestore by paths
`,
@@ -58,7 +58,7 @@ func TestParseFromYamlFirestoreGetDocuments(t *testing.T) {
in: `
tools:
secure_get_docs:
kind: firestore-get-documents
type: firestore-get-documents
source: prod-firestore
description: Get documents with authentication
authRequired:
@@ -101,17 +101,17 @@ func TestParseFromYamlMultipleTools(t *testing.T) {
in := `
tools:
get_user_docs:
kind: firestore-get-documents
type: firestore-get-documents
source: users-firestore
description: Get user documents
authRequired:
- user-auth
get_product_docs:
kind: firestore-get-documents
type: firestore-get-documents
source: products-firestore
description: Get product documents
get_order_docs:
kind: firestore-get-documents
type: firestore-get-documents
source: orders-firestore
description: Get order documents
authRequired:

View File

@@ -53,7 +53,7 @@ var compatibleSources = [...]string{firestoreds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlFirestoreGetRules(t *testing.T) {
in: `
tools:
get_rules_tool:
kind: firestore-get-rules
type: firestore-get-rules
source: my-firestore-instance
description: Retrieves the active Firestore security rules for the current project
`,
@@ -58,7 +58,7 @@ func TestParseFromYamlFirestoreGetRules(t *testing.T) {
in: `
tools:
secure_get_rules:
kind: firestore-get-rules
type: firestore-get-rules
source: prod-firestore
description: Get Firestore security rules with authentication
authRequired:
@@ -101,17 +101,17 @@ func TestParseFromYamlMultipleTools(t *testing.T) {
in := `
tools:
get_dev_rules:
kind: firestore-get-rules
type: firestore-get-rules
source: dev-firestore
description: Get development Firestore rules
authRequired:
- dev-auth
get_staging_rules:
kind: firestore-get-rules
type: firestore-get-rules
source: staging-firestore
description: Get staging Firestore rules
get_prod_rules:
kind: firestore-get-rules
type: firestore-get-rules
source: prod-firestore
description: Get production Firestore rules
authRequired:

View File

@@ -54,7 +54,7 @@ var compatibleSources = [...]string{firestoreds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlFirestoreListCollections(t *testing.T) {
in: `
tools:
list_collections_tool:
kind: firestore-list-collections
type: firestore-list-collections
source: my-firestore-instance
description: List collections in Firestore
`,
@@ -58,7 +58,7 @@ func TestParseFromYamlFirestoreListCollections(t *testing.T) {
in: `
tools:
secure_list_collections:
kind: firestore-list-collections
type: firestore-list-collections
source: prod-firestore
description: List collections with authentication
authRequired:
@@ -101,17 +101,17 @@ func TestParseFromYamlMultipleTools(t *testing.T) {
in := `
tools:
list_user_collections:
kind: firestore-list-collections
type: firestore-list-collections
source: users-firestore
description: List user-related collections
authRequired:
- user-auth
list_product_collections:
kind: firestore-list-collections
type: firestore-list-collections
source: products-firestore
description: List product-related collections
list_admin_collections:
kind: firestore-list-collections
type: firestore-list-collections
source: admin-firestore
description: List administrative collections
authRequired:

View File

@@ -99,7 +99,7 @@ var compatibleSources = [...]string{firestoreds.SourceType}
// Config represents the configuration for the Firestore query collection tool
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlFirestoreQueryCollection(t *testing.T) {
in: `
tools:
query_users_tool:
kind: firestore-query-collection
type: firestore-query-collection
source: my-firestore-instance
description: Query users collection with filters and ordering
`,
@@ -58,7 +58,7 @@ func TestParseFromYamlFirestoreQueryCollection(t *testing.T) {
in: `
tools:
secure_query_tool:
kind: firestore-query-collection
type: firestore-query-collection
source: prod-firestore
description: Query collections with authentication
authRequired:
@@ -101,17 +101,17 @@ func TestParseFromYamlMultipleTools(t *testing.T) {
in := `
tools:
query_users:
kind: firestore-query-collection
type: firestore-query-collection
source: users-firestore
description: Query user documents with filtering
authRequired:
- user-auth
query_products:
kind: firestore-query-collection
type: firestore-query-collection
source: products-firestore
description: Query product catalog
query_orders:
kind: firestore-query-collection
type: firestore-query-collection
source: orders-firestore
description: Query customer orders with complex filters
authRequired:

View File

@@ -58,7 +58,7 @@ var compatibleSources = [...]string{firestoreds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -37,7 +37,7 @@ func TestNewConfig(t *testing.T) {
name: "valid config",
yaml: `
name: test-update-document
kind: firestore-update-document
type: firestore-update-document
source: test-firestore
description: Update a document in Firestore
authRequired:
@@ -56,7 +56,7 @@ authRequired:
name: "minimal config",
yaml: `
name: test-update-document
kind: firestore-update-document
type: firestore-update-document
source: test-firestore
description: Update a document
`,
@@ -72,7 +72,7 @@ description: Update a document
name: "invalid yaml",
yaml: `
name: test-update-document
kind: [invalid
type: [invalid
`,
wantErr: true,
},

View File

@@ -59,7 +59,7 @@ var compatibleSources = [...]string{firestoreds.SourceType}
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -39,7 +39,7 @@ func TestParseFromYamlFirestoreValidateRules(t *testing.T) {
in: `
tools:
validate_rules_tool:
kind: firestore-validate-rules
type: firestore-validate-rules
source: my-firestore-instance
description: Validate Firestore security rules
`,
@@ -58,7 +58,7 @@ func TestParseFromYamlFirestoreValidateRules(t *testing.T) {
in: `
tools:
secure_validate_rules:
kind: firestore-validate-rules
type: firestore-validate-rules
source: prod-firestore
description: Validate rules with authentication
authRequired:
@@ -101,17 +101,17 @@ func TestParseFromYamlMultipleTools(t *testing.T) {
in := `
tools:
validate_dev_rules:
kind: firestore-validate-rules
type: firestore-validate-rules
source: dev-firestore
description: Validate development environment rules
authRequired:
- dev-auth
validate_staging_rules:
kind: firestore-validate-rules
type: firestore-validate-rules
source: staging-firestore
description: Validate staging environment rules
validate_prod_rules:
kind: firestore-validate-rules
type: firestore-validate-rules
source: prod-firestore
description: Validate production environment rules
authRequired:

View File

@@ -51,7 +51,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -41,7 +41,7 @@ func TestParseFromYamlHTTP(t *testing.T) {
in: `
tools:
example_tool:
kind: http
type: http
source: my-instance
method: GET
description: some description
@@ -64,7 +64,7 @@ func TestParseFromYamlHTTP(t *testing.T) {
in: `
tools:
example_tool:
kind: http
type: http
source: my-instance
method: GET
path: "{{.pathParam}}?name=alice&pet=cat"
@@ -171,7 +171,7 @@ func TestFailParseFromYamlHTTP(t *testing.T) {
in: `
tools:
example_tool:
kind: http
type: http
source: my-instance
method: GOT
path: "search?name=alice&pet=cat"

View File

@@ -46,7 +46,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlLookerAddDashboardElement(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-add-dashboard-element
type: looker-add-dashboard-element
source: my-instance
description: some description
`,
@@ -88,12 +88,12 @@ func TestFailParseFromYamlLookerAddDashboardElement(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-add-dashboard-element
type: looker-add-dashboard-element
source: my-instance
method: GOT
description: some description
`,
err: "unable to parse tool \"example_tool\" as kind \"looker-add-dashboard-element\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | kind: looker-add-dashboard-element\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
err: "unable to parse tool \"example_tool\" as type \"looker-add-dashboard-element\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | type: looker-add-dashboard-element\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
},
}
for _, tc := range tcs {

View File

@@ -46,7 +46,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlLookerGetDashboards(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-dashboards
type: looker-get-dashboards
source: my-instance
description: some description
`,
@@ -88,12 +88,12 @@ func TestFailParseFromYamlLookerGetDashboards(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-dashboards
type: looker-get-dashboards
source: my-instance
method: GOT
description: some description
`,
err: "unable to parse tool \"example_tool\" as kind \"looker-get-dashboards\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | kind: looker-get-dashboards\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
err: "unable to parse tool \"example_tool\" as type \"looker-get-dashboards\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | type: looker-get-dashboards\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
},
}
for _, tc := range tcs {

View File

@@ -46,7 +46,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlLookerGetDimensions(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-dimensions
type: looker-get-dimensions
source: my-instance
description: some description
`,
@@ -88,12 +88,12 @@ func TestFailParseFromYamlLookerGetDimensions(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-dimensions
type: looker-get-dimensions
source: my-instance
method: GOT
description: some description
`,
err: "unable to parse tool \"example_tool\" as kind \"looker-get-dimensions\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | kind: looker-get-dimensions\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
err: "unable to parse tool \"example_tool\" as type \"looker-get-dimensions\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | type: looker-get-dimensions\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
},
}
for _, tc := range tcs {

View File

@@ -46,7 +46,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlLookerGetExplores(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-explores
type: looker-get-explores
source: my-instance
description: some description
`,
@@ -88,12 +88,12 @@ func TestFailParseFromYamlLookerGetFilters(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-explores
type: looker-get-explores
source: my-instance
method: GOT
description: some description
`,
err: "unable to parse tool \"example_tool\" as kind \"looker-get-explores\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | kind: looker-get-explores\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
err: "unable to parse tool \"example_tool\" as type \"looker-get-explores\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | type: looker-get-explores\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
},
}
for _, tc := range tcs {

View File

@@ -46,7 +46,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlLookerGetFilters(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-filters
type: looker-get-filters
source: my-instance
description: some description
`,
@@ -88,12 +88,12 @@ func TestFailParseFromYamlLookerGetFilters(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-filters
type: looker-get-filters
source: my-instance
method: GOT
description: some description
`,
err: "unable to parse tool \"example_tool\" as kind \"looker-get-filters\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | kind: looker-get-filters\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
err: "unable to parse tool \"example_tool\" as type \"looker-get-filters\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | type: looker-get-filters\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
},
}
for _, tc := range tcs {

View File

@@ -46,7 +46,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlLookerGetLooks(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-looks
type: looker-get-looks
source: my-instance
description: some description
`,
@@ -88,12 +88,12 @@ func TestFailParseFromYamlLookerGetLooks(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-looks
type: looker-get-looks
source: my-instance
method: GOT
description: some description
`,
err: "unable to parse tool \"example_tool\" as kind \"looker-get-looks\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | kind: looker-get-looks\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
err: "unable to parse tool \"example_tool\" as type \"looker-get-looks\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | type: looker-get-looks\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
},
}
for _, tc := range tcs {

View File

@@ -46,7 +46,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlLookerGetMeasures(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-measures
type: looker-get-measures
source: my-instance
description: some description
`,
@@ -88,12 +88,12 @@ func TestFailParseFromYamlLookerGetMeasures(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-measures
type: looker-get-measures
source: my-instance
method: GOT
description: some description
`,
err: "unable to parse tool \"example_tool\" as kind \"looker-get-measures\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | kind: looker-get-measures\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
err: "unable to parse tool \"example_tool\" as type \"looker-get-measures\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | type: looker-get-measures\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
},
}
for _, tc := range tcs {

View File

@@ -46,7 +46,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlLookerGetModels(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-models
type: looker-get-models
source: my-instance
description: some description
`,
@@ -88,12 +88,12 @@ func TestFailParseFromYamlLookerGetModels(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-models
type: looker-get-models
source: my-instance
method: GOT
description: some description
`,
err: "unable to parse tool \"example_tool\" as kind \"looker-get-models\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | kind: looker-get-models\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
err: "unable to parse tool \"example_tool\" as type \"looker-get-models\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | type: looker-get-models\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
},
}
for _, tc := range tcs {

View File

@@ -46,7 +46,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlLookerGetParameters(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-parameters
type: looker-get-parameters
source: my-instance
description: some description
`,
@@ -88,12 +88,12 @@ func TestFailParseFromYamlLookerGetParameters(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-get-parameters
type: looker-get-parameters
source: my-instance
method: GOT
description: some description
`,
err: "unable to parse tool \"example_tool\" as kind \"looker-get-parameters\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | kind: looker-get-parameters\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
err: "unable to parse tool \"example_tool\" as type \"looker-get-parameters\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | type: looker-get-parameters\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
},
}
for _, tc := range tcs {

View File

@@ -48,7 +48,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlLookerMakeDashboard(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-make-dashboard
type: looker-make-dashboard
source: my-instance
description: some description
`,
@@ -88,12 +88,12 @@ func TestFailParseFromYamlMakeDashboard(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-make-dashboard
type: looker-make-dashboard
source: my-instance
method: GOT
description: some description
`,
err: "unable to parse tool \"example_tool\" as kind \"looker-make-dashboard\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | kind: looker-make-dashboard\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
err: "unable to parse tool \"example_tool\" as type \"looker-make-dashboard\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | type: looker-make-dashboard\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
},
}
for _, tc := range tcs {

View File

@@ -48,7 +48,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlLookerMakeLook(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-make-look
type: looker-make-look
source: my-instance
description: some description
`,
@@ -88,12 +88,12 @@ func TestFailParseFromYamlLookerMakeLook(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-make-look
type: looker-make-look
source: my-instance
method: GOT
description: some description
`,
err: "unable to parse tool \"example_tool\" as kind \"looker-make-look\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | kind: looker-make-look\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
err: "unable to parse tool \"example_tool\" as type \"looker-make-look\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | type: looker-make-look\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
},
}
for _, tc := range tcs {

View File

@@ -47,7 +47,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlLookerQuery(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-query
type: looker-query
source: my-instance
description: some description
`,
@@ -88,12 +88,12 @@ func TestFailParseFromYamlLookerQuery(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-query
type: looker-query
source: my-instance
method: GOT
description: some description
`,
err: "unable to parse tool \"example_tool\" as kind \"looker-query\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | kind: looker-query\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
err: "unable to parse tool \"example_tool\" as type \"looker-query\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | type: looker-query\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
},
}
for _, tc := range tcs {

View File

@@ -46,7 +46,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlLookerQuerySql(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-query-sql
type: looker-query-sql
source: my-instance
description: some description
`,
@@ -88,12 +88,12 @@ func TestFailParseFromYamlLookerQuerySql(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-query-sql
type: looker-query-sql
source: my-instance
method: GOT
description: some description
`,
err: "unable to parse tool \"example_tool\" as kind \"looker-query-sql\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | kind: looker-query-sql\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
err: "unable to parse tool \"example_tool\" as type \"looker-query-sql\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | type: looker-query-sql\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
},
}
for _, tc := range tcs {

View File

@@ -46,7 +46,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlLookerQueryUrl(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-query-url
type: looker-query-url
source: my-instance
description: some description
`,
@@ -88,12 +88,12 @@ func TestFailParseFromYamlLookerQueryUrl(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-query-url
type: looker-query-url
source: my-instance
method: GOT
description: some description
`,
err: "unable to parse tool \"example_tool\" as kind \"looker-query-url\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | kind: looker-query-url\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
err: "unable to parse tool \"example_tool\" as type \"looker-query-url\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | type: looker-query-url\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
},
}
for _, tc := range tcs {

View File

@@ -47,7 +47,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
AuthRequired []string `yaml:"authRequired"`

View File

@@ -40,7 +40,7 @@ func TestParseFromYamlLookerRunLook(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-run-look
type: looker-run-look
source: my-instance
description: some description
`,
@@ -88,12 +88,12 @@ func TestFailParseFromYamlLookerRunLook(t *testing.T) {
in: `
tools:
example_tool:
kind: looker-run-look
type: looker-run-look
source: my-instance
method: GOT
description: some description
`,
err: "unable to parse tool \"example_tool\" as kind \"looker-run-look\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | kind: looker-run-look\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
err: "unable to parse tool \"example_tool\" as type \"looker-run-look\": [4:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n 3 | type: looker-run-look\n> 4 | method: GOT\n ^\n 5 | source: my-instance",
},
}
for _, tc := range tcs {

View File

@@ -46,7 +46,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
AuthRequired []string `yaml:"authRequired" validate:"required"`
Description string `yaml:"description" validate:"required"`

View File

@@ -42,7 +42,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) {
in: `
tools:
example_tool:
kind: mongodb-aggregate
type: mongodb-aggregate
source: my-instance
description: some description
database: test_db
@@ -112,14 +112,14 @@ func TestFailParseFromYamlMongoQuery(t *testing.T) {
in: `
tools:
example_tool:
kind: mongodb-aggregate
type: mongodb-aggregate
source: my-instance
description: some description
collection: test_coll
pipelinePayload: |
[{ $match: { name : {{json .name}} }}]
`,
err: `unable to parse tool "example_tool" as kind "mongodb-aggregate"`,
err: `unable to parse tool "example_tool" as type "mongodb-aggregate"`,
},
}
for _, tc := range tcs {

View File

@@ -47,7 +47,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
AuthRequired []string `yaml:"authRequired" validate:"required"`
Description string `yaml:"description" validate:"required"`

View File

@@ -42,7 +42,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) {
in: `
tools:
example_tool:
kind: mongodb-delete-many
type: mongodb-delete-many
source: my-instance
description: some description
database: test_db
@@ -110,14 +110,14 @@ func TestFailParseFromYamlMongoQuery(t *testing.T) {
in: `
tools:
example_tool:
kind: mongodb-delete-many
type: mongodb-delete-many
source: my-instance
description: some description
collection: test_coll
filterPayload: |
{ name : {{json .name}} }
`,
err: `unable to parse tool "example_tool" as kind "mongodb-delete-many"`,
err: `unable to parse tool "example_tool" as type "mongodb-delete-many"`,
},
}
for _, tc := range tcs {

View File

@@ -46,7 +46,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
AuthRequired []string `yaml:"authRequired" validate:"required"`
Description string `yaml:"description" validate:"required"`

View File

@@ -42,7 +42,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) {
in: `
tools:
example_tool:
kind: mongodb-delete-one
type: mongodb-delete-one
source: my-instance
description: some description
database: test_db
@@ -110,14 +110,14 @@ func TestFailParseFromYamlMongoQuery(t *testing.T) {
in: `
tools:
example_tool:
kind: mongodb-delete-one
type: mongodb-delete-one
source: my-instance
description: some description
collection: test_coll
filterPayload: |
{ name : {{json .name}} }
`,
err: `unable to parse tool "example_tool" as kind "mongodb-delete-one"`,
err: `unable to parse tool "example_tool" as type "mongodb-delete-one"`,
},
}
for _, tc := range tcs {

View File

@@ -47,7 +47,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
AuthRequired []string `yaml:"authRequired" validate:"required"`
Description string `yaml:"description" validate:"required"`

View File

@@ -42,7 +42,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) {
in: `
tools:
example_tool:
kind: mongodb-find
type: mongodb-find
source: my-instance
description: some description
database: test_db
@@ -120,14 +120,14 @@ func TestFailParseFromYamlMongoQuery(t *testing.T) {
in: `
tools:
example_tool:
kind: mongodb-find
type: mongodb-find
source: my-instance
description: some description
collection: test_coll
filterPayload: |
{ name : {{json .name}} }
`,
err: `unable to parse tool "example_tool" as kind "mongodb-find"`,
err: `unable to parse tool "example_tool" as type "mongodb-find"`,
},
}
for _, tc := range tcs {

View File

@@ -47,7 +47,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
AuthRequired []string `yaml:"authRequired" validate:"required"`
Description string `yaml:"description" validate:"required"`

View File

@@ -42,7 +42,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) {
in: `
tools:
example_tool:
kind: mongodb-find-one
type: mongodb-find-one
source: my-instance
description: some description
database: test_db
@@ -120,14 +120,14 @@ func TestFailParseFromYamlMongoQuery(t *testing.T) {
in: `
tools:
example_tool:
kind: mongodb-find-one
type: mongodb-find-one
source: my-instance
description: some description
collection: test_coll
filterPayload: |
{ name : {{json .name}} }
`,
err: `unable to parse tool "example_tool" as kind "mongodb-find-one"`,
err: `unable to parse tool "example_tool" as type "mongodb-find-one"`,
},
}
for _, tc := range tcs {

View File

@@ -47,7 +47,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"kind" validate:"required"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
AuthRequired []string `yaml:"authRequired" validate:"required"`
Description string `yaml:"description" validate:"required"`

Some files were not shown because too many files have changed in this diff Show More