thanks to @cache-missing for the report!
This:
import strawberry
@strawberry.input
class InputData:
name: str = "10"
@strawberry.type
class Query:
@strawberry.field
def example(self, data: InputData = InputData()) -> str:
return data.name
schema = strawberry.Schema(query=Query)
Results in an error when not passing anything to data
:
argument of type 'InputData' is not iterable
GraphQL supports non scalar types as input (they also show up in the schema), while in python you'd usually use None/UNSET
as default. We should support this use case, by either adding direct support for default values or by providing a default factory.
Here's an example on the playground
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