PR 239 update: Adding more logging for the initial generate setup (#246)
This is just a tweak to #239 to update the snapshots. I have: - [X] Written a clear PR title and description (above) - [X] Signed the [Khan Academy CLA](https://www.khanacademy.org/r/cla) - [X] Added tests covering my changes, if applicable - [X] Included a link to the issue fixed, if applicable - [X] Included documentation, for new features - [ ] Added an entry to the changelog Signed-off-by: Steve Coffman <[email protected]> Co-authored-by: Sam Wallace <[email protected]>
This commit is contained in:
co-authored by
Sam Wallace
parent
b1adeca6da
commit
596c33f0b0
+6
-2
@@ -102,12 +102,16 @@ func (c *Config) ValidateAndFillDefaults(baseDir string) error {
|
|||||||
if c.Package == "" {
|
if c.Package == "" {
|
||||||
abs, err := filepath.Abs(c.Generated)
|
abs, err := filepath.Abs(c.Generated)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errorf(nil, "unable to guess package-name: %v", err)
|
return errorf(nil, "unable to guess package-name: %v is not a valid identifier"+
|
||||||
|
"\nSet package name in genqlient.yaml"+
|
||||||
|
"\nExample: https://github.com/Khan/genqlient/blob/main/example/genqlient.yaml#L6", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
base := filepath.Base(filepath.Dir(abs))
|
base := filepath.Base(filepath.Dir(abs))
|
||||||
if !token.IsIdentifier(base) {
|
if !token.IsIdentifier(base) {
|
||||||
return errorf(nil, "unable to guess package-name: %v is not a valid identifier", base)
|
return errorf(nil, "unable to guess package-name: %v is not a valid identifier"+
|
||||||
|
"\nSet package name in genqlient.yaml"+
|
||||||
|
"\nExample: https://github.com/Khan/genqlient/blob/main/example/genqlient.yaml#L6", base)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Package = base
|
c.Package = base
|
||||||
|
|||||||
+2
-1
@@ -524,7 +524,8 @@ func (g *generator) convertDefinition(
|
|||||||
|
|
||||||
// (If you had an entry in bindings, we would have returned it above.)
|
// (If you had an entry in bindings, we would have returned it above.)
|
||||||
return nil, errorf(
|
return nil, errorf(
|
||||||
pos, `unknown scalar %v: please add it to "bindings" in genqlient.yaml`, def.Name)
|
pos, "unknown scalar %v: please add it to \"bindings\" in genqlient.yaml"+
|
||||||
|
"\nExample: https://github.com/Khan/genqlient/blob/main/example/genqlient.yaml#L12", def.Name)
|
||||||
default:
|
default:
|
||||||
return nil, errorf(pos, "unexpected kind: %v", def.Kind)
|
return nil, errorf(pos, "unexpected kind: %v", def.Kind)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
testdata/errors/UnknownScalar.schema.graphql:3: unknown scalar UnknownScalar: please add it to "bindings" in genqlient.yaml
|
testdata/errors/UnknownScalar.schema.graphql:3: unknown scalar UnknownScalar: please add it to "bindings" in genqlient.yaml
|
||||||
|
Example: https://github.com/Khan/genqlient/blob/main/example/genqlient.yaml#L12
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
testdata/errors/UnknownScalar.schema.graphql:3: unknown scalar UnknownScalar: please add it to "bindings" in genqlient.yaml
|
testdata/errors/UnknownScalar.schema.graphql:3: unknown scalar UnknownScalar: please add it to "bindings" in genqlient.yaml
|
||||||
|
Example: https://github.com/Khan/genqlient/blob/main/example/genqlient.yaml#L12
|
||||||
|
|||||||
Reference in New Issue
Block a user