-
Notifications
You must be signed in to change notification settings - Fork 10
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
clarify merge order #132
Comments
@dariuszkuc yes, we should also do this with the schemas, order them by name |
Would it not make more sense to respect the order in which the source schemas are passed in? Ordering by name:
Of course, this depends on how the schemas are passed in (and I'm not sure which method this issue assumes):
|
The challenge is that, in practice, subgraphs are often composed one after another without a specific order, as seen in CI/CD pipelines. Ordering by name allows for the option to prefix with an order key if needed. |
IMHO composition should generate exactly the same supergraph regardless of user provided order, i.e. A + B + C = B +A + C. Depending on the merge order you will get slightly different (but semantically equivalent*) schemas, e.g. order of the fields may differ on the merged types. If you can get different schemas depending on the order this means you have to do semantic comparison to check whether your supergraph changed (yes you could potentially detect those on a subgraph level as well... but it is just simpler to recompose after each subgraph publish and compare the final result). Depending on the order you process those subgraphs you will also end up with slightly different query graphs so you may also end up with different query plans (there could be multiple plans with the same cost). *there could be a difference in the descriptions but other than that they should be the same |
Ah, right. The only alternative that I can think of would be adding an @schema(name: "Products", order: 1) But even if that became necessary, it's likely not needed for a "v1".
I agree, I didn't think about recomposition with single source schemas. The only issue would be in renaming source schemas, in which case, as you mention, descriptions and query plans may change. |
Currently we don't specify the order in which we process the source schemas (at least I haven't seen it here). Should this be explicitly called out?
This just came up with the discussion around which description should be picked up during the merge process
If we don't specify the order (e.g. source schemas should be sorted lexographically) then we may potentially end up with different supergraphs.
related: #88
The text was updated successfully, but these errors were encountered: