-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
How to really solve version problem #134
Comments
See my conversation with @leebyron about versioning here: https://twitter.com/leeb/status/679045650575527936 |
This is a good question @CatTail and one that comes up all the time. We encourage GraphQL endpoints to take an add-only approach to schema evolution over time instead of changing existing fields. This is important for the preservation of behavior for existing clients without creating another dimension to implement on the server. To be clear, this has its tradeoffs. You're exactly right that if you wanted to change your field The addition of new fields is always safe for older clients. You can add your Of course, there is nothing stopping you from changing a field's type in your GraphQL schema other than this concern. So for example, at Facebook, we often are developing new features and new applications which undergo rapid development and often require their GraphQL schema to change. However since no users are using them yet, we can safely cheat and change a field's type, knowing that we're only going to break our prototype builds for our internal developers. However once we've shipped a feature to our users, we do everything we can to avoid breaking it including not changing the GraphQL schema. |
Graphql do solve version problem by allow server add field dynamically without client changing their endpoint.
That's great, however, with an existing backend with versioning api, which is a proper way to support version change.
For example, with exist versioning backend api
There are two problem,
/api/v1/foo
, how to setup a graphql server allow app1's future requirement to"additional"
data (and use the old version of"key"
)?/api/v2/foo
, is that possible to allow both app1 and app2 use the same graphql server without overhead (such as introduce versioning inside graphql server)?The text was updated successfully, but these errors were encountered: