Closed ycjcl868 closed 4 years ago
var q struct { Repository struct { Issue struct { Number github.Int `json:"id"` Title github.String `json:"title"` URL github.URI `json:"url"` CreatedAt github.DateTime `json:"createdAt"` BodyHTML github.String `json:"bodyHTML"` } `graphql:"issue(number:31)"` } `graphql:"repository(owner: \"\", name: \"\")"` }
error message: [{%!d(string=Field 'bodyHtml' doesn't exist on type 'Issue') [{1 107}]}]data {{{0 %!d(githubv4.String=) {0} {{0 0 0}} %!d(githubv4.String=)}}}%
[{%!d(string=Field 'bodyHtml' doesn't exist on type 'Issue') [{1 107}]}]data {{{0 %!d(githubv4.String=) {0} {{0 0 0}} %!d(githubv4.String=)}}}%
but I use https://developer.github.com/v4/explorer/ can output the result:
BodyHTML github.String `json:"bodyHTML"`
You should use "graphql" tag, not "json", to specify the name of the GraphQL field:
BodyHTML github.String `graphql:"bodyHTML"`
error message:
[{%!d(string=Field 'bodyHtml' doesn't exist on type 'Issue') [{1 107}]}]data {{{0 %!d(githubv4.String=) {0} {{0 0 0}} %!d(githubv4.String=)}}}%
but I use https://developer.github.com/v4/explorer/ can output the result: