Set up a test

This commit is contained in:
Ben Kraft
2020-03-27 15:57:22 -07:00
parent 9ae5f71bce
commit 9074926cea
6 changed files with 58 additions and 18 deletions
+11 -2
View File
@@ -99,8 +99,17 @@ func fromASTOperation(op *ast.OperationDefinition, schema *ast.Schema) (operatio
}, nil
}
func Generate(schema *ast.Schema, document *ast.QueryDocument) ([]byte, error) {
var err error
func Generate(config *Config) ([]byte, error) {
schema, err := getSchema(config.Schema)
if err != nil {
return nil, err
}
document, err := getAndValidateQueries(config.Queries, schema)
if err != nil {
return nil, err
}
operations := make([]operation, len(document.Operations))
for i, op := range document.Operations {
operations[i], err = fromASTOperation(op, schema)