Repository navigation
0.342.0
This release fixes types inheriting a field without the permission classes or extensions it was declared with: Strawberry now raises at schema build time instead.
A plain annotation re-declaring an inherited field that has permission classes or extensions in any parent, like email: str on a type implementing an interface that declares email: str = strawberry.field(permission_classes=[IsStaff]), now raises GuardedFieldOverrideError. A plain annotation replaces the inherited field with a new one, like it does for dataclasses, so the field was published without its permission classes and extensions on that type. Override such fields with strawberry.field(...), passing the options they should have, or remove the annotation to inherit the field as it is. This also covers strawberry.auto on strawberry.experimental.pydantic types. Fields that only have directives, like the ones of Apollo Federation, can still be re-declared with a plain annotation, which drops the directives as before.
A type inheriting a field from two parents that share an ancestor, where only one of them re-declares the field, now raises ConflictingInheritedFieldsError. Dataclasses picked the declaration that the last base inherited instead of the one Python's method resolution order gives, so which declaration the type published depended on the order of its bases. Declare the field on the type itself. This also applies to resolvers re-declared by one parent of a diamond.
Schemas that relied on either pattern no longer build. See the 0.342.0 breaking changes page for how to update them.
This release was contributed by @patrick91 in #4837
Additional contributors: @ampagent