Closed g14a closed 4 years ago
Either rename the StarGazers
field to Stargazers
, or add an explicit name override via field tag:
StarGazers struct {
TotalCount githubv4.Int
} `graphql:"stargazers"`
There's an implicit conversion happening if you don't set an explicit GraphQL field name via the graphql
tag, and the Go field "StarGazers" is converted to "starGazers" (capital 'G'), which doesn't match the field "stargazers" (lower case 'g') in the GraphQL schema. It is case sensitive and fields must match exactly.
@dmitshur Thank you my dude. You saved my day. Will remember the implicit conversion in the future. :grin:
Hello! I was exploring the GraphQL explorer and I'm able to list down the total count of stars on a repo with this following query
But when I use the library to list it down it gives the error
Field 'starGazers' doesn't exist on type 'Repository'
I'm declaring the structs as follows:
Is there anything simple I'm missing here? I'm able to get values of the ForkCount and WatcherCount but not the StarGazers. Thank you in advance.