big refactor to put the codegen onto methods of an object

This commit is contained in:
Ben Kraft
2020-04-10 15:21:23 -07:00
parent dfea9bf128
commit b600df7877
5 changed files with 78 additions and 59 deletions
+3 -2
View File
@@ -118,13 +118,14 @@ func TestTypeForOperation(t *testing.T) {
t.Fatalf("got %v operations, want 1", len(queryDoc.Operations))
}
goType, err := typeForOperation("Response", queryDoc.Operations[0], schema)
g := newGenerator("test_package", schema)
name, err := g.addTypeForOperation(queryDoc.Operations[0])
if err != nil {
t.Error(err)
}
// gofmt before comparing.
goType, err = gofmt(goType)
goType, err := gofmt(g.typeMap[name])
if err != nil {
t.Error(err)
}