strawberry
strawberry copied to clipboard
`Annotated` is not supported
trafficstars
The following snippets
@strawberry.input
class AddBookInput:
title: str
author: Annotated[str, "PII"]
Raises the following error when used in a schema:
TypeError: AddBookInput fields cannot be resolved. Unexpected type 'typing.Annotated[str, 'PII']'
We should add support for Annotated
I ran into this today. It would be very useful to be able to provide docstring in the type annotation instead of using field = strawberry.field(description=...) because when using classes decorated with @dataclass, that marks the field as optional and forces all subsequent fields to have default values also.
This has been fixed recently I think. @emosenkis can you open a new issue for that, I'm pretty sure using strawberry.field shouldn't mark a field as optional