It's not possible to use strawberry.UNSET
for optional parameters:
@strawberry.input
class StrawberryUnset:
a: int = strawberry.UNSET
b: int = strawberry.UNSET
@strawberry.type
class Query:
@strawberry.field
async def test(self, input: StrawberryUnset) -> None:
return None
query GetTest {
test(input: {}) # fails: a and b weren't provided
}
Would fail because a and b are required.
_UNSET = object()
@strawberry.federation.input
class StrawberryUnset:
a: int = _UNSET
b: int = _UNSET
Code Reference: https://gitlab.com/ThirVondukr/strawberry-info-warning/-/blob/unset/tests/test_error.py
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