-
Notifications
You must be signed in to change notification settings - Fork 242
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
Core schema support and Typescript query planner redux #622
Commits on Mar 19, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 1322e44 - Browse repository at this point
Copy the full SHA 1322e44View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0aa65fb - Browse repository at this point
Copy the full SHA 0aa65fbView commit details -
Configuration menu - View commit details
-
Copy full SHA for f1e0a8a - Browse repository at this point
Copy the full SHA f1e0a8aView commit details -
1
Configuration menu - View commit details
-
Copy full SHA for f9f3784 - Browse repository at this point
Copy the full SHA f9f3784View commit details
Commits on Mar 21, 2021
-
Re-introduce last used TypeScript query planner code
This re-introduces the TypeScript query planner code as of apollographql/apollo-server@60d9742, which is one of the parents of the commit that deleted that code from the `apollo-server` repository: apollographql/apollo-server@149f78e. I wanted to start out with this to then re-apply the changes I've made in an experimental repository in a more tractable manner. On top of that, this commit adds a `composedSchema` directory, which contains code that is used to build a schema with Federation metadata from CSDL (this will be replaced with code that takes a core schema file with join directives as input). That was needed to get things wired up with the current gateway code. We temporarily export the same API we used for the wasm query planner from `@apollo/query-planner`, but implemented as a facade on top of the TypeScript one. This is ugly and inefficient (we shouldn't be parsing the query again), but the goal is to get things working first without making changes to the gateway code.
Configuration menu - View commit details
-
Copy full SHA for 06c42ad - Browse repository at this point
Copy the full SHA 06c42adView commit details -
Use Federation metadata from composed schema
The original code used `getFederationMetadata` from `@apollo/federation`, which is a private utility function that works based on the internal metadata added to the `GraphQLSchema` that's being built up during composition. Since the query planner has its own `buildComposedSchema` now, which uses CSDL as input and builds its own `GraphQLSchema`, we need to switch to its utility functions instead. (We expose separate `getFederationMetadataForType` and `getFederationMetadataForField` functions because there is no need to support both with the same function and that avoids runtime checks.)
Configuration menu - View commit details
-
Copy full SHA for 9a1e715 - Browse repository at this point
Copy the full SHA 9a1e715View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9dab51d - Browse repository at this point
Copy the full SHA 9dab51dView commit details -
Fix discrepancy in schema used for feature test
The corresponding test in `@apollo/gateway` (`single-service.test.ts`) uses a simple value type, not a union. To make sure we come back to this, I've left the union type in there and introduced an additional failing test.
Configuration menu - View commit details
-
Copy full SHA for 9af5533 - Browse repository at this point
Copy the full SHA 9af5533View commit details -
Configuration menu - View commit details
-
Copy full SHA for ac540d2 - Browse repository at this point
Copy the full SHA ac540d2View commit details -
Change
getBaseService
andgetOwningService
to returnundefined
……instead of `null`
Configuration menu - View commit details
-
Copy full SHA for d2ef7c6 - Browse repository at this point
Copy the full SHA d2ef7c6View commit details -
Treat abstract types as value types to replicate type explosion fix
This replicates the behavior of the current Rust query planner, because I wanted to get the tests passing before making further changes. But the type explosion fix this depends on is fundamentally flawed and needs to be replaced.
Configuration menu - View commit details
-
Copy full SHA for 4911364 - Browse repository at this point
Copy the full SHA 4911364View commit details -
Make test pass by removing code that changes field ordering
This code has more problems and should be replaced by proper recursive selection set merging, but removing the unnecessary distinction between aliased fields and non-aliased fields at least fixes the test.
Configuration menu - View commit details
-
Copy full SHA for 5b8dc42 - Browse repository at this point
Copy the full SHA 5b8dc42View commit details -
Disable test for propagation of directives on inline fragments
The disabled test covers code that was added to the Rust query planner to fix #177, but that logic is problematic and we should have a more principled discussion about propagation of executable directives first.
Configuration menu - View commit details
-
Copy full SHA for 439fad2 - Browse repository at this point
Copy the full SHA 439fad2View commit details -
Update ordering of fragments in snapshots for autofragmentization tests
The order of the generated fragments seems to differ between the Rust query planner and the TypeScript one. Since this shouldn't change the semantics of the query, updating the snapshots to make the tests pass.
Configuration menu - View commit details
-
Copy full SHA for 6cb2023 - Browse repository at this point
Copy the full SHA 6cb2023View commit details -
Configuration menu - View commit details
-
Copy full SHA for b9f3a7c - Browse repository at this point
Copy the full SHA b9f3a7cView commit details -
Print valid core schema and change
@http
to@join__endpoint
The generated core schema was invalid because the `@join__type` directive definition should be repeatable and have `key` as its argument (instead of `requires` and `provides`). We would also generate a `@join__field` directive without a graph name in case `serviceName` was undefined, which would lead to a syntax error when parsing. This commit also renames `@http` to `@join__endpoint` and includes a directive definition for it (which was missing before).
Configuration menu - View commit details
-
Copy full SHA for a09e433 - Browse repository at this point
Copy the full SHA a09e433View commit details -
Adapt query planner to core schema input
The goal here is to get the tests passing first, while making as few changes to the gateway as possible. That means the way the gateway generates composed schemas and service lists performs redundant work and should be cleaned up later.
Configuration menu - View commit details
-
Copy full SHA for cbbf8cb - Browse repository at this point
Copy the full SHA cbbf8cbView commit details -
Skip tests that fail because of value type handling in composition
We should rethink the way we handle value types in composition. Currently, a type is only seen as a value type if it is defined in more than one service. Those aren't the right semantics because a type that is only defined in one service can still be a value type if it doesn't have a `@key`. That wasn't an issue before, but with the join spec that means we end up generating `@join__field` directives on fields of what should be value types. A particularly thorny issue is the use of `@provides` on fields of value types, which if allowed, should only apply to the subgraph that includes it. We don't currently keep track of `@requires`/`@provides` per subgraph however, plus `join__field` is defined as non repeatable, so there is no easy way to generate the correct metadata.
Configuration menu - View commit details
-
Copy full SHA for 081c59e - Browse repository at this point
Copy the full SHA 081c59eView commit details
Commits on Mar 22, 2021
-
Print valid core schema and change
@http
to@join__endpoint
The generated core schema was invalid because the `@join__type` directive definition should be repeatable and have `key` as its argument (instead of `requires` and `provides`). We would also generate a `@join__field` directive without a graph name in case `serviceName` was undefined, which would lead to a syntax error when parsing. This commit also renames `@http` to `@join__endpoint` and includes a directive definition for it (which was missing before).
Configuration menu - View commit details
-
Copy full SHA for 1e324f2 - Browse repository at this point
Copy the full SHA 1e324f2View commit details -
Configuration menu - View commit details
-
Copy full SHA for eadfe94 - Browse repository at this point
Copy the full SHA eadfe94View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2313d5a - Browse repository at this point
Copy the full SHA 2313d5aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 37773db - Browse repository at this point
Copy the full SHA 37773dbView commit details
Commits on Mar 23, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 166bce7 - Browse repository at this point
Copy the full SHA 166bce7View commit details
Commits on Mar 24, 2021
-
Filter out core and join elements in
buildComposedSchema
To make the schema returned from `buildComposedSchema` reflect the API schema, we filter out core and join elements. The approach is naive and doesn't follow the Core Schema spec, but it should work for the core SDL currently printed from `printComposedSchema` in `@apollo/federation`.
Configuration menu - View commit details
-
Copy full SHA for bf79bec - Browse repository at this point
Copy the full SHA bf79becView commit details -
Configuration menu - View commit details
-
Copy full SHA for 70dce5c - Browse repository at this point
Copy the full SHA 70dce5cView commit details -
Make
@provides
on value types work by printing@join__field
witho……ut `graph` Allowing `@join__field` without `graph` gives us the same metadata previously computed from CSDL input, and should keep the query planner behavior the same as before. In the future, we should probably change composition to keep track of `@provides` on a per subgraph basis, and reflect that in the core schema output by making `@join__field` repeatable and `graph` non-nullable.
Configuration menu - View commit details
-
Copy full SHA for 80e4431 - Browse repository at this point
Copy the full SHA 80e4431View commit details -
Avoid printing
@join__field
for what should be value typesWe should change the way we detect value types. If a type is defined in only one service, we currently don't consider it a value type even if it doesn't specify any keys. That resulted in us printing `@join__field`, with the name of the single service that defined the type, even though we didn't add a corresponding `join__type` to the parent type (because that relies on there being keys defined). That is invalid according to the join spec, and also broke the current workaround for avoiding type explosion on value types (which we should replace, but are leaving in for now to first replicate the existing behavior).
Configuration menu - View commit details
-
Copy full SHA for 63658b8 - Browse repository at this point
Copy the full SHA 63658b8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0365de6 - Browse repository at this point
Copy the full SHA 0365de6View commit details -
3
Configuration menu - View commit details
-
Copy full SHA for 0b133e5 - Browse repository at this point
Copy the full SHA 0b133e5View commit details
Commits on Mar 25, 2021
-
Always invoke
GraphQLNonNull
as a constructorThis was always the recommended style, but now that `GraphQLNonNull` and `GraphQLList` have been converted to proper classes in graphql/graphql-js#2906, calling them as functions no longer works.
Configuration menu - View commit details
-
Copy full SHA for 1b2af2d - Browse repository at this point
Copy the full SHA 1b2af2dView commit details -
Propagate directives on inline fragments to subqueries
This replicates the behavior added to the Rust query planner in #178. Unfortunately, the logic in there is seriously flawed, and may lead to unexpected results. The assumption seems to be that fields with the same parent type are always nested in the same inline fragment. That is not necessarily true however, and because we take the directives from the scope of the first field with a particular parent type, those directives will be applied to all other fields that have the same parent type even if the directives aren't meant to apply to them because they were nested in a different inline fragment. (That also means that if the scope of the first field doesn't have directives, directives that would have applied to other fields will be lost.) (Note that this also applies to `@skip` and `@include`, which could lead to invalid query plans that fail at runtime because expected fields are missing from a subgraph response.)
Configuration menu - View commit details
-
Copy full SHA for 31a7ba6 - Browse repository at this point
Copy the full SHA 31a7ba6View commit details
Commits on Mar 28, 2021
-
Escape string literals when printing core schema
We need to make sure the string values we print are valid GraphQL string literals. If a value includes a quote or backslash for example, these need to be escaped to avoid parser errors. We're relying on `JSON.stringify` for this, which the `graphql-js` printer also uses when printing out a `StringValue`: https://github.com/graphql/graphql-js/blob/d4bcde8d3e7a7cb8462044ff21122a3996af8655/src/language/printer.js#L109-L112
Configuration menu - View commit details
-
Copy full SHA for 88f8c09 - Browse repository at this point
Copy the full SHA 88f8c09View commit details
Commits on Mar 29, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 3350d86 - Browse repository at this point
Copy the full SHA 3350d86View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9cb48f1 - Browse repository at this point
Copy the full SHA 9cb48f1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4b7df18 - Browse repository at this point
Copy the full SHA 4b7df18View commit details
Commits on Mar 30, 2021
-
harmonizer: Update to use
coreSchema
rather thancomposedSdl
.Also updates snapshots of command's output.
Configuration menu - View commit details
-
Copy full SHA for 3f860e3 - Browse repository at this point
Copy the full SHA 3f860e3View commit details -
Configuration menu - View commit details
-
Copy full SHA for da7a186 - Browse repository at this point
Copy the full SHA da7a186View commit details -
Configuration menu - View commit details
-
Copy full SHA for 25b5453 - Browse repository at this point
Copy the full SHA 25b5453View commit details -
Print @join__type directives on interface types
This code remains untested since this path is unsupported by composition currently. There is a related issue polaris-planning#62 which should be referenced when building out the rest of this functionality.
Configuration menu - View commit details
-
Copy full SHA for 973db23 - Browse repository at this point
Copy the full SHA 973db23View commit details -
Remove all notions of CSDL in code. Replaced with "Supergraph SDL" or its appropriately camelCased counterpart.
Configuration menu - View commit details
-
Copy full SHA for 22e6e77 - Browse repository at this point
Copy the full SHA 22e6e77View commit details -
Configuration menu - View commit details
-
Copy full SHA for eb6676b - Browse repository at this point
Copy the full SHA eb6676bView commit details
Commits on Mar 31, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 6906a8c - Browse repository at this point
Copy the full SHA 6906a8cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 247fb10 - Browse repository at this point
Copy the full SHA 247fb10View commit details -
Configuration menu - View commit details
-
Copy full SHA for bc31b88 - Browse repository at this point
Copy the full SHA bc31b88View commit details -
Configuration menu - View commit details
-
Copy full SHA for 19ae2f6 - Browse repository at this point
Copy the full SHA 19ae2f6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 36cdac4 - Browse repository at this point
Copy the full SHA 36cdac4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5b30ba8 - Browse repository at this point
Copy the full SHA 5b30ba8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6abb7d4 - Browse repository at this point
Copy the full SHA 6abb7d4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 466c6e1 - Browse repository at this point
Copy the full SHA 466c6e1View commit details -
Configuration menu - View commit details
-
Copy full SHA for f9e4cf7 - Browse repository at this point
Copy the full SHA f9e4cf7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9db6aa9 - Browse repository at this point
Copy the full SHA 9db6aa9View commit details