Skip to content

Commit

Permalink
Check models config for package-only specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathew Byrne committed Jul 9, 2018
1 parent 6391596 commit c8355f4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions codegen/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"strings"

"github.com/pkg/errors"
"github.com/vektah/gqlgen/neelance/schema"
Expand Down Expand Up @@ -115,6 +116,9 @@ func (tm TypeMap) Check() error {
if entry.Model == "" {
return fmt.Errorf("model %s: entityPath is not defined", typeName)
}
if strings.LastIndex(entry.Model, ".") < strings.LastIndex(entry.Model, "/") {
return fmt.Errorf("model %s: invalid type specifier \"%s\" - you need to specify a struct to map to", typeName, entry.Model)
}
}
return nil
}
Expand Down

0 comments on commit c8355f4

Please sign in to comment.