Strawberry currently uses a newtype for ID
(from str
).
I'm not very familiar with graphql but I can see the reasoning behind this choice: IDs
are supposed to be opaque values that you don't look inside of, but which are serialised as strings.
The drawback of a newtype is that it causes a lot of manual casting when using Strawberry if you have typechecking turned on. For example with a UUID, you must do strawberry.ID(str(a_uuid))
. If you have typing turned off, passing a_uuid
directly works fine.
Perhaps there is some way to make this easier?
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too