New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: fix mistakes in v2 tutorial #785
base: master
Are you sure you want to change the base?
Conversation
@@ -101,7 +102,7 @@ func ExampleParsePrintDocument() { | |||
if err != nil { | |||
panic(err) | |||
} | |||
fmt.Println(out.String()) // Output: query { hello } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The operation type (query
) is no longer part of the output. It wasn't clear to me whether this is intentional or not.
operationNames = append(operationNames, name) | ||
operationType := document.RootOperationTypeDefinitions[node.Ref].OperationType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RootOperationTypeDefinitions
is an empty slice here. Likewise, it wasn't clear to me whether this is intentional or not.
ChildNodes: plan.TypeFields{ | ||
{ | ||
TypeName: "Foo", | ||
FieldNames: []string{"bar"}, | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without defining child nodes, the plan action fails with
panic: internal: nodesResolvableVisitor: could not select the datasource to resolve Query.foo on a path query.foo
@@ -560,7 +565,7 @@ func ExampleExecuteOperation() { | |||
if err != nil { | |||
panic(err) | |||
} | |||
fmt.Println(out.String()) // Output: {"data":{"hello":"world"}} | |||
fmt.Println(out) // Output: {"data":{"hello":"world"}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am still getting an error instead of the suggested output here:
{"errors":[{"message":"String cannot represent non-string value: \"\"","path":[]}],"data":null}
I'll need more time to trace why this is happening, so in case the cause is obvious to someone, feel free to point me in the right direction.
e5a84bf
to
d8f5720
Compare
While going over the tutorial code, I spotted a few mistakes in the sample outputs and method calls.
I'm leaving a few comments on selected changes for consideration.