v0.285.0 Breaking Changes
This release removes support for Apollo Federation v1 and updates the federation API to always use Federation v2.
What Changed
The enable_federation_2 parameter has been removed and replaced with
federation_version . Federation v2 is now always enabled, with version 2.11 as
the default.
# Before (0.284.x and earlier)schema = strawberry.federation.Schema( query=Query, enable_federation_2=True # Opt-in to Federation 2)
# After (0.285.0+)schema = strawberry.federation.Schema( query=Query, federation_version="2.11" # Defaults to "2.11", always Federation 2) Impact on Your Code
Federation v2 Users
If you were already using enable_federation_2=True , you can remove that
parameter:
# Beforeschema = strawberry.federation.Schema(query=Query, enable_federation_2=True)
# Afterschema = strawberry.federation.Schema(query=Query) Your schemas will continue to work without changes and will now default to Federation v2.11.
Federation v1 Users
If you were using Federation v1 (without enable_federation_2 ), you must
migrate to Federation v2. Apollo Federation v1 is no longer supported by
Strawberry.
Federation v2 provides better schema composition and additional features. Most v1 schemas can be migrated with minimal changes:
# Before (Federation v1)schema = strawberry.federation.Schema(query=Query)
# After (Federation v2)schema = strawberry.federation.Schema(query=Query) # Now uses v2.11 Key differences in Federation v2:
- No
extendkeyword needed: Types no longer need to be marked as extensions - No
@externalrequired: The@keydirective alone is sufficient in most cases -
@shareabledirective: Use this to indicate fields that can be resolved by multiple subgraphs -
@linkdirective: Automatically added to declare federation spec version
See the Apollo Federation v2 migration guide for more details.
Specifying Federation Version
You can now specify which Federation v2 version to use:
schema = strawberry.federation.Schema( query=Query, federation_version="2.5" # Use a specific version) Supported versions: 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 2.10, 2.11
This is useful if you need to ensure compatibility with a specific Apollo Router or Gateway version, or if you want to avoid using newer directives.
Version Validation
Strawberry validates that directives are compatible with your chosen federation version:
from strawberry.federation.schema_directives import Cost
@strawberry.federation.typeclass Product: name: str = strawberry.federation.field( directives=[Cost(weight=10)] # Requires v2.9+ )
# This will raise an error because @cost requires v2.9+schema = strawberry.federation.Schema( query=Query, federation_version="2.5" # Too old for @cost) Why This Change?
- Apollo Federation v1 is deprecated: Apollo has moved to Federation v2 as the standard
- Simpler API: Removes the boolean flag in favor of explicit version control
- Better features: Federation v2 provides improved schema composition and new directives
- Version control: Users can now specify exact federation versions for compatibility
Migration Steps
Step 1: Check Your Current Usage
If youβre using enable_federation_2=False or not setting it at all, youβre
using Federation v1 and need to migrate.
Step 2: Remove Federation v1 Code
# Remove this parameterschema = strawberry.federation.Schema( query=Query, enable_federation_2=True # Remove this line) Step 3: Update Federation v1 Patterns
If you were using Federation v1 patterns like extend=True and explicit
@external fields, you can simplify:
# Before (Federation v1)@strawberry.federation.type(keys=["id"], extend=True)class Product: id: strawberry.ID = strawberry.federation.field(external=True) reviews: list[Review]
# After (Federation v2)@strawberry.federation.type(keys=["id"])class Product: id: strawberry.ID reviews: list[Review] Step 4: Test Your Schema
Run your schema composition and tests to ensure everything works correctly with Federation v2.
Need Help?
- See the Federation guide for comprehensive usage examples
- Review the Apollo Federation v2 documentation
- If you encounter issues, please report them on GitHub