Skip to content

Commit

Permalink
Release 🍓 0.218.0
Browse files Browse the repository at this point in the history
  • Loading branch information
botberry committed Jan 22, 2024
1 parent 85fb58c commit 5d23399
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 34 deletions.
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,44 @@
CHANGELOG
=========

0.218.0 - 2024-01-22
--------------------

This release adds a new method `get_fields` on the `Schema` class.
You can use `get_fields` to hide certain field based on some conditions,
for example:

```python
@strawberry.type
class User:
name: str
email: str = strawberry.field(metadata={"tags": ["internal"]})


@strawberry.type
class Query:
user: User


def public_field_filter(field: StrawberryField) -> bool:
return "internal" not in field.metadata.get("tags", [])


class PublicSchema(strawberry.Schema):
def get_fields(
self, type_definition: StrawberryObjectDefinition
) -> List[StrawberryField]:
return list(filter(public_field_filter, type_definition.fields))


schema = PublicSchema(query=Query)
```

The schema here would only have the `name` field on the `User` type.

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


0.217.1 - 2024-01-04
--------------------

Expand Down
33 changes: 0 additions & 33 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.217.1"
version = "0.218.0"
description = "A library for creating GraphQL APIs"
authors = ["Patrick Arminio <patrick.arminio@gmail.com>"]
license = "MIT"
Expand Down

0 comments on commit 5d23399

Please sign in to comment.