Open patrick91 opened 2 years ago
It can be done with an empty dict/object. The received value will still be the default input type.
def example(self, data: InputData = {}) -> str:
It can be done with an empty dict/object. The received value will still be the default input type.
def example(self, data: InputData = {}) -> str:
Thank you so much! I was running into this problem when testing and this solution worked wonders. I have no idea how the default value of {} converts to the input type but it does 👍
thanks to @cache-missing for the report!
This:
Results in an error when not passing anything to
data
: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
Upvote & Fund