-
-
Notifications
You must be signed in to change notification settings - Fork 440
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
Nested input types generate an error at introspection time #880
Comments
I can't reproduce it, can you provide a repository that reproduces this issue? 😁 |
Here's a full reproducer: https://github.com/djc/nested-input. What I find really surprising about this is that introspection works okay as long as I comment out the |
#[derive(InputObject)]
#[graphql(name = "InfoInput")] // Add this attribute to rename the input type name
pub struct Info {
email: Option<String>,
} |
This error cannot currently be reported at compile time, I will add a runtime check. 🙂 |
Why can't Rust types implement both the input and the output traits? |
This is not allowed in the GraphQL spec, they need to have different names. |
You can implement as input object and output object for the same Rust type, but for GraphQL they are actually different objects, so must have different names as well. |
Would be nice if there was a way to do this similar to the way currently multiple names can be declared depending on any generic type parameters. |
This should not be possible. 😂 |
Or I don't know how to do it. 😄 |
Actually, it seems like this is already possible? I can use |
Yes, procedural macros can do it. |
You mean, always automatically add the |
Ah, sorry -- I didn't actually mean that the macros should implicitly add a suffix to input type names. I meant that there should be a way for me to reuse the same type under a different name, but it looks like that already exists. I think it might actually be nice if there was a way I could opt in to add |
Well, I'm now going to add a runtime check that panics when the same Rust type has the same name. |
Released in |
I have some types like this:
This compiles fine and I can generate SDL from it.
Expected Behavior
Introspection queries against this schema should work.
Actual Behavior
Introspection query fails; error from GraphiQL:
Specifications
The text was updated successfully, but these errors were encountered: