err explicitly if there's no operation name

This commit is contained in:
Ben Kraft
2021-04-07 17:18:03 -07:00
parent eae8553c04
commit b8f922a41b
+4
View File
@@ -116,6 +116,10 @@ func (g *generator) getDocComment(op *ast.OperationDefinition) string {
}
func (g *generator) addOperation(op *ast.OperationDefinition) error {
if op.Name == "" {
return fmt.Errorf("operations must have operation-names")
}
var builder strings.Builder
f := formatter.NewFormatter(&builder)
// TODO: this could even get minifed.