Skip to content

Bump strawberry-graphql[fastapi] from 0.217.1 to 0.218.0

Bumps strawberry-graphql[fastapi] from 0.217.1 to 0.218.0.

Release notes

Sourced from strawberry-graphql[fastapi]'s releases.

🍓 0.218.0

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:

@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.

Releases contributed by @​patrick91 via #3274

Changelog

Sourced from strawberry-graphql[fastapi]'s 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:

@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 via [PR #3274](strawberry-graphql/strawberry#3274)

Commits

Merge request reports