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
Enhancements #68
Comments
Do you want to generate some framework code through GraphQL Schema DSL? |
Hi, tks for the quick reply. |
I thought about it, in fact, rust has another library to do this, https://github.com/davidpdrsn/juniper-from-schema, but it does not support async-graphql. The biggest problem is that this type of code generation will create new types, but these types of IDEs do not recognize them, so they cannot be automatically completed. I think this increases the difficulty of writing code, so I am still considering whether I really need to implement this. 😁 |
Instead of using macros to generate the rust code, there could be a command line tool that outputs the rust code (like |
You mean a tool that - given a GQL Schema and access to your business logic - generates some boilerplate for your api before compilation? |
@phated I understand what you mean, this way can really solve the problem that ide can't recognize the type. After I am busy with the work at hand, I will study the feasibility. 😁 |
Thank you. For the context. I built a GraphQL UI designer - it generates SDL code. Ideally would love to have it generate RUST code for the same model. Which brings me to two questions:
|
What I understand is that you have a tool that can automatically generate GraphQL code for js, including the implementation of solving functions. Now you want to generate rust? |
GraphQL UI designer contains the definition of the data source, so you can generate the entire code, similar to hasura? 😁 |
The tool goes from UI UML like models -> GraphQL SDL from there: Now, I would love to see you implementation read the SDL, but it doesn't at this point.
|
I have seen the code of graphql-shorthand-parser, if I have not misunderstood, it is a GraphQL Schema parser, and your purpose is to be able to use this parser result (AST) to generate rust code, is that true? 😁 |
If I understand correctly above, there is a small problem here. If I hope that the tools from SDL to |
Sorry, I just understood the meaning of SDL, which is Schema Definition Language. |
No worries, I think they call it IDL but anyways.. glad you got it On my side, I am really not familiar with Rust... what are macros? |
There is a syntax in javascript, |
I see. that's actually one of the "missing" features I identified up on the thread. Glad it's there, then. |
I think it's worth it. After all, some developers like "Schema first", so I'm already thinking about how to implement this. 😁 |
And when I started to do this, I thought I would finish it soon. |
When/if you implement it.. I found this library - https://github.com/kevinmehall/rust-peg Cheers |
Thank you very much. 🍺 |
Alternatively, some way to export the Schema in the schema format at build time would be nice. |
Export sdl for the client? |
Yes, I haven't used graphql before, this is my first time, so forgive me if I'm missing something, I was thinking exporting the schema definition |
@kellpossible the common practice is just to use a tool against your development environment and check in the |
I think it's better that way. |
@phated thanks ooh okay that does sound good, so the idea is that using the CLI tool you can pull the schema from the graphql server/api and updates the schema file that way? A pity it is an older version. |
So...is it currently possible to use |
https://docs.rs/crate/codegen-for-async-graphql/0.2.6 I haven't used this, but it seems to be schema first. |
Ah...ok, so i have to use an external lib for that. Thanks for the info. Yes, that is schema first. Just for others reading this, it is working, but has a few caveats. It currently is not able to generate code for a required array with required elements, i.e. |
Nice implementation - congrats
Surprised to see federation built in
Would be nice to see:
With basic annotations (http proxy, oauth validation, structure getter) you can support 70-80% of the typical graphql use cases.
The text was updated successfully, but these errors were encountered: