Closed metalmatze closed 7 years ago
Thanks for your issue.
This basic PoC is really inspired by https://github.com/shurcooL/githubql/blob/master/example/githubqldev/main.go#L44L97 which also uses "structs / instances" to define queries.
I didn't notice the fact that you could be much more productive by copying queries from GraphiQL into the code. I think a next step could be to use the https://pub.dartlang.org/packages/graphql_parser to transform a GQL query string into the internal library DSL...
I am going to add it to the roadmap!
Hi @metalmatze,
I have worked on this improvement this morning and it seems promising. You could check a code example here.
I will be glad to have your opinion on that.
Cheers 🍻
That looks really awesome and pretty easy to copy from GraphiQL. :+1: I'd like to test it myself, but time just doesn't allow for it right now. Maybe at the beginning of August I can manage to give it a try!
Hey. I finally have time to check this out. Sadly this option to write the queries as a string was removed again, correct? :thinking:
That is right. The previous implementation was working but was using mirrors. Since #7, I have remove mirrors usage to support flutter.
At the moment, you have to use the graphql_client.dsl
documented here. A code example is available here.
I will create a code generator soon that converts GQL queries (as string) to the graphql_client.dsl
. An issue is opened here and a doc detailing the code generator is available here.
Hey! Thanks for creating that lib. I'm going to look into at once I'm more familiar with the basics of dart again. It's been a long time...
I want to learn about your approach to create the queries like this: https://github.com/hourliert/graphql_client/blob/716ddcae1b33a7400c99dd89fc96a0a6b0a948a6/example/graphql_client_example.dart#L27-L39
IMO it's way better to use simple string queries, run them and after getting the response marshall them into the objects you'd like to work with. What makes this so much better to work with, is the fact that you can actually write the queries in GraphiQL and just copy & paste them over into your code. This is just not possible with the current approach and thus probably error prone.
Cheers :beers: