Skip to content

Commit 3c882cb

Browse files
committed
Release 🍓 0.310.0
1 parent 7854220 commit 3c882cb

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
CHANGELOG
22
=========
33

4+
0.310.0 - 2026-03-08
5+
--------------------
6+
7+
Fix two `NameError` issues in schema-codegen output when types are referenced before they are defined.
8+
9+
First, forward references in field annotations (e.g. `foo: Foo` appearing before `Foo` is defined) are now handled by emitting `from __future__ import annotations` at the top of the generated file. Per PEP 563, this stores all annotations as strings instead of evaluating them at class definition time, so the referenced names don't need to exist yet.
10+
11+
Second, union definitions like `FooOrBar = Annotated[Foo | Bar, strawberry.union(...)]` are runtime expressions that `from __future__ import annotations` cannot defer. These are now correctly ordered by declaring union member types as dependencies, so unions are always emitted after their members.
12+
13+
Changes:
14+
- Emit `from __future__ import annotations` in generated code to handle forward references in field annotations.
15+
- Add member-type dependencies for union definitions so unions are emitted after their member types.
16+
- Ensure the schema assignment is emitted last by giving it dependencies on all other definitions.
17+
18+
Contributed by [Sandra Liljeqvist](https://github.com/sanlil) via [PR #4192](https://github.com/strawberry-graphql/strawberry/pull/4192/)
19+
20+
421
0.309.0 - 2026-03-08
522
--------------------
623

RELEASE.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "strawberry-graphql"
3-
version = "0.309.0"
3+
version = "0.310.0"
44
description = "A library for creating GraphQL APIs"
55
authors = [{ name = "Patrick Arminio", email = "patrick.arminio@gmail.com" }]
66
license = { text = "MIT" }

0 commit comments

Comments
 (0)