-
-
Notifications
You must be signed in to change notification settings - Fork 543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support explicit setting of federation version #3503
Comments
Hey @bradleyoesch! Thank you for bringing this up. It's a valid concern and something we should indeed think about carefully to ensure Strawberry remains flexible and user-friendly, especially when it comes to dealing with different federation versions. Your input is greatly appreciated! 😊 Regarding your suggestions and questions, let's dive a bit deeper:
I would lean against this. Having this functionality as a core feature is essential. Overriding such functions could lead to unnecessary complexity and potentially unexpected behaviors. It's better to handle versioning more intrinsically within the framework.
This is a tricky one. Ideally, we aim to provide forward compatibility with newer versions of federation while also offering a degree of backward compatibility. However, supporting every version past and future indefinitely isn't feasible due mainly to the maintenance overhead and potential limitations it imposes on evolving Strawberry's schema handling.
Implementing some form of version validation sounds like a prudent approach. This could help prevent confusion and errors by ensuring that the features being used are compatible with the specified federation version. Of course, the challenge here is to determine the most effective and user-friendly way to implement such checks.
Rover or other composition tools should fail composition if some versions are incompatible. Given these considerations, here's what I believe could be a balanced approach:
There is one catch with the last variant though: we still don't support every version of federation for new releases. From time to time, a strawberry upgrade will require upgrading to the very newest federation version because the federation library had to be updated to accompany the newest strawberry breaking changes. This is an acceptable trade off in my opinion and is in line with common deprecation practices. If anyone has further thoughts or suggestions, please don't hesitate to share. I'm all ears! 🍓 |
@bradleyoesch I'm assuming you were getting errors because you're on older version of the router? I think we can allow to specify the version (maybe using a Literal, so we only allow versions we know we support[1]), but it would be nice to also add validation if you're using newer features in older versions (as @erikwrede suggested)
@erikwrede not sure I understood this point 😊 [1] at least at a "type checking" level |
@patrick91 I meant publishing a separate package called |
If it's just to change the version numbers in the schema then imo just let users override it themselves, since it's not real functionality.
Yeah I'm concerned with that too. There'd probably have to be a running list of supported versions and a threshold where old ones get dropped off. I'm not too familiar with the differences in federation versions and how frequently they release, so I'm not sure how much of a lift that would be.
Sounds interesting, and could address the "running list of supported versions" and at least document it well. Wish I had a stronger opinion at the moment to help direct ideas! |
100x thumbs up for this. My org is stuck on federation version 2.3, so I have to pin my strawberry versions and can't get any updates :(. Curious @bradleyoesch , how did you manually override your schema version in the schema generator? |
Feature Request Type
Description
The latest version of strawberry supports federation v2.7 and hardcodes the directive urls as such: #3420
The apollo federation version at my company is v2.5 so I've updated our schema generator to manually replace
v2.7
withv2.5
It would be nice to be able to set this at the schema level, e.g.
federation.Schema(query=Query, federation_version="v2.5")
At first glance it seems relatively straightforward:
federation_version
argument to the schema, default to"v2.7"
ifenable_federation_2=True
enable_federation_2=True
if federation_version >= 2But I imagine that the versioning actually changes underlying support, so then there are outstanding questions:
print_schema
function with version instead?Not sure what the approach should be, but I don't think this library should dictate the federation version, and more explicitly, I think that users of this library should be able to get library updates unrelated to federation version, rather than having to pin to the version before some federation version was explicitly supported / mandated.
Upvote & Fund
The text was updated successfully, but these errors were encountered: