Skip to content
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

Crashes when initializing schema with similar Connection types #870

Closed
djc opened this issue Mar 16, 2022 · 2 comments
Closed

Crashes when initializing schema with similar Connection types #870

djc opened this issue Mar 16, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@djc
Copy link
Contributor

djc commented Mar 16, 2022

I have a Domain, Post and Image types. Both my Domain and my Post types have an images() resolver. Domain::images() creates a Connection<i64, Image, DomainEdge, EmptyFields>, while Post::images() returns a Connection<i64, Image, PostEdgeFields, EmptyFields>.

Actual behavior

When I build the schema containing my types, I get the following panic:

'async_graphql::types::connection::connection_type::Connection<i64, Image, PostEdgeFields> and async_graphql::types::connection::connection_type::Connection<i64, Image, DomainEdge> have the same GraphQL name ImageConnection' in /Users/djc/.cargo/registry/src/github.com-1ecc6299db9ec823/async-graphql-3.0.35/src/registry/mod.rs:411:25.

Additionally, if I name the additional type PostEdge instead of PostEdgeFields I get a different panic:

thread 'main' panicked at 'called Option::unwrap() on a None value', /Users/djc/.cargo/registry/src/github.com-1ecc6299db9ec823/async-graphql-3.0.35/src/registry/mod.rs:435:45

Actual Behavior

Since these types are different, I don't think this cause a failure. I was additionally surprised that this kind of thing causes a run-time failure rather than a compile-time failure.

Specifications

  • Version: 3.0.35
  • Platform: macOS
  • Subsystem: registry
@djc djc added the bug Something isn't working label Mar 16, 2022
@sunli829
Copy link
Collaborator

I'll try to fix it these days, maybe add a procedural macro, which can't be done with generics. 😁

@sunli829
Copy link
Collaborator

sunli829 commented May 6, 2022

Fixed in v4.0.0

@sunli829 sunli829 closed this as completed May 6, 2022
@sunli829 sunli829 unpinned this issue May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants