better test methods #417
Replies: 2 comments
-
actually, this (and I think it's maven compatriot) already generate request/response classes https://github.com/kobylynskyi/graphql-java-codegen/tree/master/plugins/gradle there's even an example with spring rest template, maybe the better option would be to support these classes |
Beta Was this translation helpful? Give feedback.
-
I like the first part of the idea to be able to select queries/mutations to use by name. Will create an enhancement for that to support it. For the query class do you mean to pass that along just to convert the response to that class (like it's done in https://github.com/graphql-java-kickstart/graphql-spring-webclient)? So you'd call it something like: testTemplate.query("GetUser", variables, User.class); Could you clarify with code snippets on what you have in mind on how to use that kind of functionality? I'm not immediately a fan of relying on codegen libraries. It sounds like we don't have to to be able to support this kind of functionality. You'd be free to generate those classes using codegen with separate configuration to be able to make it all work. |
Beta Was this translation helpful? Give feedback.
-
start by slurping in all of the graphql files
**/*.graphql
(of course it should be configurable)then.
used like
jackson could be used to serialize objects to strings I believe, which although my example doesn't show it, I do believe graphql supports passing complex objects to a query.
obviously similar should be done for a mutation.
In the future, I'd like to see the ability to pass a query "class", apollo servers test client lets you do that, I've asked for upstream to have codegen from graphql graphql-java/graphql-java#1936
Beta Was this translation helpful? Give feedback.
All reactions