Is your feature request related to a problem? Please describe.
I'm always frustrated when I need to replace:
#[derive(juniper::GraphQLObject)]
struct Foo {
name: String
}
by
struct Foo {
name: String
}
#[juniper::graphql_object]
impl Foo {
fn computed(&self) -> String {
...
}
}
because I lose the nice default field accessor for name and I have to manually add it to the impl:
#[juniper::graphql_object]
impl Foo {
...
fn name(&self) -> &String {
&self.name
}
}
Describe the solution you'd like
I'd like for #[derive(juniper::GraphQLObject)] and #[juniper::graphql_object] to work together so I don't have to add the dummy accessors for every field in the impl block.
I would imagine it is complicated to achieve this because both macros currently generate the same impl block underneath.
Describe alternatives you've considered
I couldn't come up with any alternative to this 😿
Additional context
This is extra painful when wrapping REST interfaces which have many simple fields (like strings) and a few complex fields (references to other resources).
P.S.: juniper is such a great crate! many thanks to all the contributors! 💯
Is your feature request related to a problem? Please describe.
I'm always frustrated when I need to replace:
by
because I lose the nice default field accessor for
nameand I have to manually add it to theimpl:Describe the solution you'd like
I'd like for
#[derive(juniper::GraphQLObject)]and#[juniper::graphql_object]to work together so I don't have to add the dummy accessors for every field in theimplblock.I would imagine it is complicated to achieve this because both macros currently generate the same
implblock underneath.Describe alternatives you've considered
I couldn't come up with any alternative to this 😿
Additional context
This is extra painful when wrapping REST interfaces which have many simple fields (like strings) and a few complex fields (references to other resources).
P.S.:
juniperis such a great crate! many thanks to all the contributors! 💯