Skip to content

Commit

Permalink
Release 🍓 0.255.0
Browse files Browse the repository at this point in the history
  • Loading branch information
botberry committed Dec 20, 2024
1 parent 8a8e3aa commit 0981661
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.255.0 - 2024-12-20
--------------------

This release adds support for making Relay connection optional, this is useful
when you want to add permission classes to the connection and not fail the whole
query if the user doesn't have permission to access the connection.

Example:

```python
import strawberry
from strawberry import relay
from strawberry.permission import BasePermission


class IsAuthenticated(BasePermission):
message = "User is not authenticated"

# This method can also be async!
def has_permission(
self, source: typing.Any, info: strawberry.Info, **kwargs
) -> bool:
return False


@strawberry.type
class Fruit(relay.Node):
code: relay.NodeID[int]
name: str
weight: float

@classmethod
def resolve_nodes(
cls,
*,
info: strawberry.Info,
node_ids: Iterable[str],
):
return []


@strawberry.type
class Query:
node: relay.Node = relay.node()

@relay.connection(
relay.ListConnection[Fruit] | None, permission_classes=[IsAuthenticated()]
)
def fruits(self) -> Iterable[Fruit]:
# This can be a database query, a generator, an async generator, etc
return all_fruits.values()
```

Contributed by [Patrick Arminio](https://github.com/patrick91) via [PR #3707](https://github.com/strawberry-graphql/strawberry/pull/3707/)


0.254.1 - 2024-12-20
--------------------

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.254.1"
version = "0.255.0"
description = "A library for creating GraphQL APIs"
authors = ["Patrick Arminio <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 0981661

Please sign in to comment.