You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using postponed annotation evaluation, annotating resolver arguments no longer works:
from __future__ importannotationsimportrandomfromtypingimportAnnotatedimportstrawberry@strawberry.typeclassQuery:
@strawberry.fielddefdice_roll(
self,
sides: Annotated[
int,
strawberry.argument(description="Number of sides the die should have."),
] =6,
) ->int:
returnrandom.randint(1, sides)
strawberry.Schema(query=Query)
The example above raises this TypeError:
TypeError: Query fields cannot be resolved. Unexpected type 'typing.Annotated[int, <strawberry.arguments.StrawberryArgumentAnnotation object at 0x7fd12e130d00>]'
When the first line (from __future__ import annotations) is left out, everything works as intended. This will probably also break once Python 3.11 lands, since the behavior will become mandatory then. #1586 refers to a somewhat related issue.
The text was updated successfully, but these errors were encountered:
When using postponed annotation evaluation, annotating resolver arguments no longer works:
The example above raises this TypeError:
When the first line (
from __future__ import annotations
) is left out, everything works as intended. This will probably also break once Python 3.11 lands, since the behavior will become mandatory then. #1586 refers to a somewhat related issue.The text was updated successfully, but these errors were encountered: