Right now it makes a difference when accessing arguments via the function arguments or via the Info
object:
@strawberry.field
def resolver_arguments(self, info: Info, date: datetime.date):
[selected_field] = info.selected_fields
assert type(date) == date
assert selected_field.arguments["date"]) == date
# ^^^ This fails when passing the `date` argument as part of the query
# It works when passing the argument via the variables.
...
Dataclasses aren't parsed at all when accessing them via the Info
object:
@strawberry.input
class Obj:
date: Optional[datetime.date] = None
@strawberry.type
class Query:
@strawberry.field
def typenames(self, info: Info, obj: Optional[Obj] = None):
assert isinstance(obj, Obj)
[field] = info.selected_fields
assert isinstance(field.arguments["obj"], Obj)
# ^^^ This always fails.
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