chkimes / graphql-net

Convert GraphQL to IQueryable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to send query variables

fabiodr opened this issue · comments

Is there a way to send the variable $episode in following example?

query HeroNameAndFriends($episode: Episode) {
  hero(episode: $episode) {
    name
    friends {
      name
    }
  }
}

{
  "episode": "JEDI"
}

http://graphql.org/learn/queries/#variables

Thanks!

Hey @fabiodr,

This is what #23 is about. The IExecContext is simply an implementation that provides a Value (https://github.com/ckimes89/graphql-net/blob/master/GraphQL.Parser/Parsing/ParserAST.fs#L62) from a string. The user can specify their own implementation of IExecContext, but it makes a lot of sense for us to provide ones that handle this from common formats (e.g. JSON). This is not a very difficult thing to implement, but unfortunately due to my time constraints as of late I have not been able to do so. I may be able to work on this sometime during next week, though.

Great! I tried to dig a little into the code and found these indications of an IExecContext implementation needed, i'll try to better understand F# to see if i can be helpfull in these, anyway, it seems a nice language.

Are you using Apollo Client too? Just found a nice chrome extension from them for client store inspection:
https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm

If you're looking to learn F#, this eBook is pretty good: https://swlaschin.gitbooks.io/fsharpforfunandprofit/content/ It's a collection of all the content from the F# For Fun and Profit blog.

I have used Apollo Client before for a few things and I used their inspector extension as well. I was pretty amazed when I first used it - it's a very high quality tool.