-
Notifications
You must be signed in to change notification settings - Fork 46
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
Macro with generator.cynic-rs.dev functionality #860
Comments
Hi @djkato, This is definitely possible from a technical standpoint. It is something I may support eventually, however it's not something I'm planning on doing in the short term. I agree that for some cases it would be nice, but I know from experience that approach has drawbacks. Prior to writing cynic i used graphql-client which takes this approach, but I found:
Given these drawbacks I'd rather focus time on other things first. I think I can solve some of the pain of copy & pasting into a web UI improvements to the cynic CLI such as this issue. I've not fleshed that issue out too much, but I'm imagining you could keep I've also been considering a |
Oh that's an even better idea! I can see the stuff that a macro would generate to be harder to access, and a CLI regenerator would be way better. Ideally it would also create strings of each query so I can reference them later, cuz in my current projects I have to always send that query as pure string somewhere, eg. with webhook subscriptions. |
Yeah, it's definitely an approach I want to explore. Although I can't promise I'll get to it anytime soon.
Could you explain this use case a bit more please? I can see why you might need the string query, but how that relates to webhooks I'm less clear on? Just curious to see if there's some way to improve cynic to cater to this. |
Sure, tho this is probably very specific to me. I'm making Saleor apps, and the way they communicate is through webhooks, where if an event happens in Saleor, Saleor sends me back a graphql queries result, which I define in an app manifest. |
Ah yeah, I see. Interesting, I haven't seen that approach to webhooks before, though it makes sense. Might be something I can do to make that easier at the moment tbh. It's definitely possible to generate the query off the structs, I'm just not sure if I've exposed enough of the internals to let a user do it. |
That's a fabulous idea! Also, something like custom derive macros for all structs would be cool. E.g. derive |
Hello, I would like to ask if a macro that could do the job of https://generator.cynic-rs.dev/ could exist? And if not, then why? I'm not sure what the limits of macros are, but I always rely on that generator, and every time I change my query I have to go to the site and copy everything around. Would be more convenient for me to just keep it in rust.
The text was updated successfully, but these errors were encountered: