Changing default resolver to dict don't work well with Union types
Opened this issue · 1 comments
Syndorik commented
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.
Syndorik commented
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!