more TODOs, and especially clarify the situation for input type names

This commit is contained in:
Ben Kraft
2021-03-22 18:45:52 -07:00
parent 088ec53ad5
commit 17a95fd4de
10 changed files with 115 additions and 22 deletions
+5 -2
View File
@@ -2,6 +2,7 @@ package generate
import (
"fmt"
"go/token"
"io/ioutil"
"path/filepath"
@@ -42,7 +43,10 @@ func (c *Config) ValidateAndFillDefaults() error {
}
base := filepath.Base(abs)
// TODO: remove/replace bad chars, make sure there's something left?
if !token.IsIdentifier(base) {
return fmt.Errorf("unable to guess package-name: %v is not a valid identifier", base)
}
c.Package = base
}
@@ -69,7 +73,6 @@ func ReadAndValidateConfig(filename string) (*Config, error) {
}
// Make paths relative to config dir
// TODO: more principled typing here?
basename := filepath.Dir(filename)
config.Schema = filepath.Join(basename, config.Schema)
config.Queries = filepath.Join(basename, config.Queries)