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

Changing default resolver to dict don't work well with Union types #3423

Open
Syndorik opened this issue Mar 25, 2024 · 1 comment
Open

Changing default resolver to dict don't work well with Union types #3423

Syndorik opened this issue Mar 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Syndorik
Copy link

Syndorik commented Mar 25, 2024

Describe the Bug

Trying to change the default resolver to getitem do not work with union types.

System Information

  • Operating system: Ubuntu
  • Strawberry version (if applicable): Strawberry graphql playground

Additional Context

You can find in the link a way to duplicate the bug!
https://play.strawberry.rocks/?gist=45898fde459d7626b3879292177eecb6

This comes from a discord discussion that was here : https://discord.com/channels/689806334337482765/1221835876448079902

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@Syndorik Syndorik added the bug Something isn't working label Mar 25, 2024
@Syndorik
Copy link
Author

From examining source code, the get_type_resolver method of StrawberryUnion object checks the type name and see if it's in the schema. When you change the default resolver, you work with objects that are not strawberry types making this function throwing error.

I guess a work around would be to have named dict somehow, or precise a typename inside the structure used!

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

1 participant