Strawberry GraphQL @ 0.308.0
Released
This release adds support for defining fields using the Annotated syntax. This provides an
alternative way to specify field metadata alongside the type annotation.
Example usage:
from typing import Annotated
import strawberry
@strawberry.typeclass Query: name: Annotated[str, strawberry.field(description="The name")] age: Annotated[int, strawberry.field(deprecation_reason="Use birthDate instead")]
@strawberry.inputclass CreateUserInput: name: Annotated[str, strawberry.field(description="User's name")] email: Annotated[str, strawberry.field(description="User's email")]This syntax works alongside the existing assignment syntax:
@strawberry.typeclass Query: # Both styles work field1: Annotated[str, strawberry.field(description="Using Annotated")] field2: str = strawberry.field(description="Using assignment") All strawberry.field() options are supported including description , name ,
deprecation_reason , directives , metadata , and permission_classes .
Releases contributed by @patrick91 via #4059