-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
Client: autogenerate view classes from query #574
Comments
Do you have any plan to implement the feature? |
I think that would require some macros, I have no knowledge about that (and not really willing to learn now since Scala 3 will make it obsolete :D), but open to contributions. |
@viclovsky @benwaffle |
FYI it is now possible to generate view classes when running the code gen (it's slightly different from your example though: it generates view classes with all fields (not based on any query). |
This would be a nice addition. I'll give an example why I need it. So for now I just manually define my case classes for that query... |
Perhaps this is what @DGolubets is describing but I'll try to state it in Caliban's terms, having limited experience with it: this could be implemented purely as the code-gen part of Caliban.
In other words, it'd be nice to have a "schema first" approach to using Caliban client. I find the Scala DSL cumbersome to use in many cases. Our schema is quite complex and has a lot of nesting. On the other hand, the graphql as a query language is widely used and has good IDE support with autocompletion and validations so I'd rather write the queries in |
I think that approach could work. We could require all queries to be named so that we create an object for each query and put related case classes under it. |
It would be useful to write the graphql query as a string and generate the view classes
The text was updated successfully, but these errors were encountered: