You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm facing a weird issue about the input types generated by the GraphQL macro.
Lets say I already have the CardInfo type in my codebase (on the server side), and I use the CardInfo type in my _schema.graphql :
When I use a build script to generate a sdl back from this _schema.graphqlwhich is in a different crate, it creates both a CardInfosInput input and a CardInfo type :
build.rs
let schema = Schema::build(QueryRoot{},MutationRoot{},SubscriptionRoot{}).finish();letmut file = BufWriter::new(File::create(&generated_path)?);writeln!(&mut file,"{}", schema.sdl())?;
However during the implementation of the resolver of such operations, I figured out there was no way to convert X to XInput types using something like a From or Into trait, in order to only write something like :
I'd say this is out of scope for this crate, but I am happy to discuss feature requests if there is an elegant mechanism we can implement to make From / Into impls less painful.
Hi,
I'm facing a weird issue about the input types generated by the GraphQL macro.
Lets say I already have the
CardInfo
type in my codebase (on the server side), and I use theCardInfo
type in my_schema.graphql
:_schema.graphql
When I use a build script to generate a sdl back from this
_schema.graphql
which is in a different crate, it creates both aCardInfosInput
input and aCardInfo
type :build.rs
server_sdl.graphql
(the generated one)Which forces me to use
...Input
types in my GraphQL operations definitionscreateCard.graphql
This mutation is merged to the MutationRoot, and is defined as such :
However during the implementation of the resolver of such operations, I figured out there was no way to convert
X
toXInput
types using something like aFrom
orInto
trait, in order to only write something like :Furthermore, when using nested types I have to write more and more boilerplate.
Is there a way to avoid doing such a thing ? Or maybe could this macro expansion behavior be improved in any way ?
The problem can be summarized as follows :
Is there a way to reuse backend structs ?
Thanks in advance !
The text was updated successfully, but these errors were encountered: