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
Types generation #26
Comments
@degroote22 Yes we are planning to create a fully typed library. Right now we mainly need it to handle caching more effectively, by actually passing response date into the appropriate GraphQL types. Feel free to try implementing a generator, we will jump in to help with Dart to make something great together. |
I've just finished my college's semeter and I did not have the time to look at it before. |
I got a prototype working. See how it would be added to the example folder of this repository. I'm currently using dartz's Option abstrasct data type to model fields that are optional. It uses this function know which string is a GraphQL operation. String gql(String input) => input;
String readRepositories = gql("""
... I'd appreciate feedback 👍 |
Great work! I really like how you generate the comments for the classes, so that you have some documentation while coding. On the other side it feels a bit weird to have javascript running inside a dart project. It would be possible to use graphql_parser to process the query strings. |
I am using that parser. It works well !
…On Mon, 3 Sep 2018, 10:26 Zino Hofmann, ***@***.***> wrote:
Great work!
I really like how you generate the comments for the classes, so that you
have some documentation while coding.
On the other side it feels a bit weird to have javascript running inside a
dart project.
It would be possible to use graphql_parser
<https://github.com/angel-dart/graphql/tree/master/graphql_parser> to
process the query strings.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#26 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATuCwqBuFL-LFrYRm2ipuP8i9muV5OsCks5uXOfJgaJpZM4U8jiB>
.
|
The way types are being generated is with 2 things, the generator and the template. |
There are many graphql parsers and generators in golang. Because it's golang which has built in code gen at its core it already supports many frontend languages. It can also do graphql to grpc and db gen. All from the graphql schema. https://github.com/graphql-go/graphql https://github.com/99designs/gqlgen
The dart type generator then runs from the golang types using standard AST. I need to find the repo... |
@gedw99 Go is faster than JS but the friction would be there anyways. |
I've got serviceable type/json_serializable generation with graphql-to-dart working, although it still has some limitations. For instance, it doesn't extract graphql strings from dart code, and I still feel like I might be generating non-idiomatic code. Eventually doing code generation with dart faculties would be more convenient, build process wise, but I don't think it's a priority for anyone anytime soon. |
I'm not sure if |
@lucasavila00 that generator https://github.com/comigor/artemis seems really cool |
Hey guys! Yeah, I also think this project would benefit from types generation, and that's why I've started Artemis, actually. The goal of it is to have GraphQL type generation for any Dart project, not just Flutter-based projects (I'm already using it with Flutter for desktop and some CLI's). It was on my roadmap to make a Flutter widget layer to it and, for this, Would it be possible to just reference Artemis as a dependency of |
@comigor I don't see any issue with that - if I can manage to replace There are some features we have implemented that I'd like to publish as standalone modules eventually, namely caching. So, if you go to add caching support, I'd rather put in the time to break that out, and work with you to get an appealing API design and the features you need.
|
Yeah, I'd like to have cache (and even HTTP) decoupled from the code generation, but I had to create And what I meant of "pure Dart" is just using some default abstractions (like I didn't know about Ping me if you want some help on the migration! I'm actively working on Artemis right now (and adding documentation as we speak). |
Now that #429 has been merged, is there a plan to integrate https://github.com/comigor/artemis? |
@smkhalsa in a sense - at the least, I'm probably going to start implementing a 3rd party code that does so, and if it gets to a mature state I'll PR it as another package. |
Hey guys, how are you doing? With the introduction of Are guys thinking in another kind of integration? I hope we can think in a first-class integration, but without losing the customization possibilities of Artemis. |
Can you make an example of this? I'm curious to see how this would work. |
Here is a fresh example from my today experiments. Works pretty fine.
|
What is the status of this one? Are there any documentations yet? |
Thank you, this one look nice. It will be great if this can be added to the README so that more people will be able to see that. |
@michaellee8 there is a PR for that #540 @mainawycliffe @micimize please... |
Both |
I can make a generator for the types, but it would be nice to pass the parameters to the runtime.
I think Dart doesn't allow it, but how could we go towards that full typed approach?
I haven't written a single line of Dart but I liked Flutter a lot, but I'd need to use it with GraphQL. I can help with the GraphQL part but I would need help with Dart.
The text was updated successfully, but these errors were encountered: