Skip to content

0.324.2

Latest

Choose a tag to compare

@botberry botberry released this 28 Aug 23:49
· 1 commit to main since this release
9f9e840

This release fixes fields configured with strawberry.field() inside
typing.Annotated.

You can now use this syntax consistently on object types, input types, and
interfaces, including in projects that use from __future__ import annotations:

from typing import Annotated

import strawberry

Name = Annotated[
    str,
    strawberry.field(name="displayName", default="Anonymous"),
]


@strawberry.type
class User:
    name: Name

All strawberry.field() options are supported. Fields with default or
default_factory can be omitted when creating an instance, and field
configuration can be combined with other Strawberry metadata such as named
unions.

This release was contributed by @patrick91 in #4594

Additional contributors: @patrick, @ampagent