-
Notifications
You must be signed in to change notification settings - Fork 433
FieldResult should implement GraphQLType #320
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
Comments
I'm not sure that would make sense. Let me know if that isn't what you are trying to do or if I misunderstand. |
I have a field that can either:
So the most correct return type would be |
I ran into this issue while researching a problem I was facing. I'm not a fan of using too many macro's in my code-base (for a lack of clarity, and usually a lack of informative compiler error messages), so I wanted to implement The documentation states "Manually deriving an object is straightforward but tedious". I ran into an issue where I wanted to manually derive a registry.field<FieldResult<Vec<&MyT>>>("my_t", info) As it returned:
I had to dig into the Am I doing something wrong here, or is this the correct way to use a |
@JeanMertz if you are manually implementing Also: the API is really not intended for implementing You might be interested in the just merged #333. struct Query;
#[juniper::object]
impl Query {
fn add(&self, a: i32, b: i32) -> i32 {
a + b
}
} See the updated |
Ah thanks @theduke, that's great, and it works flawlessly, thank you for this 👍 (documentation is still a bit lacking, I had to dig through the tests to find how to rename a field, as it only showed how to rename the object itself, but other than that, it worked as expected) |
There is some more extensive documentation on the But thanks for pointing it out, I'll add that to the book. |
I wanted to return
Option<FieldResult<Foo>>
from a field, but I can't because FieldResult doesn't implement GraphQLType. Thoughts? I could probably do the PR (assuming this is even possible, didn't really look into it).The text was updated successfully, but these errors were encountered: