-
Notifications
You must be signed in to change notification settings - Fork 279
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
Support for Inline Fragments #3
Comments
Yes, inline fragments are already supported. I still need to work on adding a section to README that explains how to do them. Let's use this issue to track that. In the meantime, see issue shurcooL/githubv4#10 which was about union + inline fragment support. It was resolved in shurcooL/githubv4#15.
Can you show you did it it? Then I can suggest a better way, if there is one. |
I just found a way that don't need inline fragment in the API I use. |
I see. Here's how you can do the above GraphQL query using query HeroForEpisode($ep: Episode!) {
hero(episode: $ep) {
name
... on Droid { # Inline Fragment.
primaryFunction
}
}
} var query struct {
Hero struct {
Name graphql.String
Droid struct {
PrimaryFunction graphql.String
} `graphql:"... on Droid"` // Inline Fragment.
} `graphql:"hero(episode: $ep)"`
} |
@artonge, have you had a chance to try the above? Any issues? |
Hi, |
The support for inline fragments is documented in README now: https://github.com/shurcooL/graphql#inline-fragments /cc @artonge FYI. |
In the case we developers want to decode JSON response ourself. Moreover, the default `UnmarshalGraphQL` function isn't ideal with complicated nested interfaces
Hi,
Any plan to support Inline Fragments ?
Example :
Do you think it would be feasible ?
Edit: manage to do without it. But it would be a nice feature :)
The text was updated successfully, but these errors were encountered: