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
I'm having trouble implementing the cursor connections based pagination specification. https://relay.dev/graphql/connections.htm
My Node implementation is like this:
/// A node in a pagination query.#[graphql_interface(for = [Company], scalar = juniper::DefaultScalarValue)]pubtraitNode{fnid(&self) -> String;}
And company is like this:
#[derive(Serialize,Deserialize,Clone,Debug)]pubstructCompany{pubuuid:Uuid,pubname:String,#[serde(default)]pubusers:Vec<ClientUserNoCompany>,}#[graphql_object(impl = [NodeValue], description = "A generic company")]implCompany{pubfnid(&self) -> String{self.uuid.to_string()}}
But I'm getting errors like this
#[graphql_object(impl = [NodeValue], description = "A generic company")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `GraphQLInterface<__S>` is not implemented for `NodeValueEnum<Company>`
Why is this happening? Note: I'm using the master branch
The text was updated successfully, but these errors were encountered:
@Anderssorby the Book on the master branch is quite outdated, sorry for that. We're not going to update it now, because there are some more fundamental changes to happen. We're going to update it right before release.
The problem with your example is in scalar = juniper::DefaultScalarValue attribute argument on the Node trait. By default, the derived implementations are abstracted over ScalarValue types via type parameter __S: ScalarValue, and you define the Company GraphQL object this way. On the other hand, the Node GraphQL interface is derived for juniper::DefaultScalarValue usage only, not for any __S: ScalarValue. That's why compilation fails. So:
either remove scalar = juniper::DefaultScalarValue attribute argument from the Node interface definition;
or add scalar = juniper::DefaultScalarValue attribute argument to the Company GraphQL object definition.
I'd recommend the option 1.
I'm trying to rework the whole traits machinery in #1072, so it will be much more flexible and polymorphic, without such gotchas. However, it needs quite a time to land.
I'm having trouble implementing the cursor connections based pagination specification. https://relay.dev/graphql/connections.htm
My Node implementation is like this:
And company is like this:
But I'm getting errors like this
Why is this happening? Note: I'm using the master branch
The text was updated successfully, but these errors were encountered: