Skip to content

Commit

Permalink
Release 🍓 0.241.0
Browse files Browse the repository at this point in the history
  • Loading branch information
botberry committed Sep 16, 2024
1 parent 7287047 commit a162c9b
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 52 deletions.
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,62 @@
CHANGELOG
=========

0.241.0 - 2024-09-16
--------------------

You can now configure your schemas to provide a custom subclass of
`strawberry.types.Info` to your types and queries.

```py
import strawberry
from strawberry.schema.config import StrawberryConfig

from .models import ProductModel


class CustomInfo(strawberry.Info):
@property
def selected_group_id(self) -> int | None:
"""Get the ID of the group you're logged in as."""
return self.context["request"].headers.get("Group-ID")


@strawberry.type
class Group:
id: strawberry.ID
name: str


@strawberry.type
class User:
id: strawberry.ID
name: str
group: Group


@strawberry.type
class Query:
@strawberry.field
def user(self, id: strawberry.ID, info: CustomInfo) -> Product:
kwargs = {"id": id, "name": ...}

if info.selected_group_id is not None:
# Get information about the group you're a part of, if
# available.
kwargs["group"] = ...

return User(**kwargs)


schema = strawberry.Schema(
Query,
config=StrawberryConfig(info_class=CustomInfo),
)
```

Contributed by [Ethan Henderson](https://github.com/parafoxia) via [PR #3592](https://github.com/strawberry-graphql/strawberry/pull/3592/)


0.240.4 - 2024-09-13
--------------------

Expand Down
51 changes: 0 additions & 51 deletions RELEASE.md

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "strawberry-graphql"
packages = [ { include = "strawberry" } ]
version = "0.240.4"
version = "0.241.0"
description = "A library for creating GraphQL APIs"
authors = ["Patrick Arminio <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit a162c9b

Please sign in to comment.