Skip to content
Merged
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
3 changes: 3 additions & 0 deletions internal/config/convert/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ func gen(n *yaml.Node) (interface{}, error) {

}

case yaml.AliasNode:
return gen(n.Alias)

default:
return nil, fmt.Errorf("unknown yaml value: %s (%s)", n.Value, n.Tag)

Expand Down
47 changes: 47 additions & 0 deletions internal/config/convert/convert_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package convert

import (
"testing"

"gopkg.in/yaml.v3"
)

const anchor = `
sql:
- schema: query.sql
queries: query.sql
engine: postgresql
codegen:
- out: gateway/src/gateway/services/organization
plugin: py
options: &base-options
query_parameter_limit: 1
package: gateway
output_models_file_name: null
emit_module: true
emit_generators: false
emit_async: true

- schema: query.sql
queries: query.sql
engine: postgresql
codegen:
- out: gateway/src/gateway/services/project
plugin: py
options: *base-options
`

type config struct {
SQL yaml.Node `yaml:"sql"`
}

func TestAlias(t *testing.T) {
var a config
err := yaml.Unmarshal([]byte(anchor), &a)
if err != nil {
t.Fatal(err)
}
if _, err := gen(&a.SQL); err != nil {
t.Fatal(err)
}
}