Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

antoineco
Copy link

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.

@@ -101,7 +102,7 @@ func ExampleParsePrintDocument() {
if err != nil {
panic(err)
}
fmt.Println(out.String()) // Output: query { hello }
Copy link
Author

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
Copy link
Author

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.

Comment on lines +502 to +508
ChildNodes: plan.TypeFields{
{
TypeName: "Foo",
FieldNames: []string{"bar"},
},
},
Copy link
Author

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"}}
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant