-
Notifications
You must be signed in to change notification settings - Fork 2k
Ignore TypeSystemDirectiveLocations during composition #3536
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TypeSystemDirectiveLocations will now be ignored by composition, meaning service implementors need not worry about their existence at all. This validation rule no longer applies.
Ignoring TypeSystemDirectiveLocations during composition allows services to implement directives which use both types of locations, while the resulting composed schema only accounts for executable locations. This allows for more lax validation rules without affecting the query planner. This also unblocks users who previously had type system directives working in their services prior to the addition of directive validations.
jbaxleyiii
approved these changes
Nov 20, 2019
abernix
added a commit
that referenced
this pull request
Nov 27, 2019
…tives. > Note: This is not the solution, just a test that demonstrates the failure! Recently, the beginnings of [Executable directive] support were brought into federation through #3464 and its follow-up, #3536. The implementation of executable directives currently in place within federation requires that federated directives be declared identically across all implementing services, even if their implementation is different (or a no-op). This is working as intended! However, [Type system directives] need some additional pruning from the composed schema. Specifically, while type system directive declarations don't need to be declared identically across implementing services, their _definitions_ are currently (intentionally!) removed from the composed schema. That would be fine, but the _usages_ of those directives are currently being left in-tact, which results in validation errors within composed schemas since the directives, while still defined in the implementing services, have been removed. It's certainly important that the implementing services maintain those type system directives in order to act upon them within the services themselves, I don't believe those directives need to be preserved in the composed schema that runs at the gateway and is used to generate the query plan. This commit is mostly documenting a reproduction of an issue that was brought to my attention and introduces what I believe is a test case to build a solution against. [Type system directive]: https://graphql.github.io/graphql-spec/draft/#TypeSystemDirectiveLocation [Executable directive]: https://graphql.github.io/graphql-spec/draft/#ExecutableDirectiveLocation
abernix
added a commit
that referenced
this pull request
Nov 27, 2019
> Note: This is not the solution, just a test that demonstrates the failure! Recently, the beginnings of [Executable directive] support were brought into federation through #3464 and its follow-up, #3536. The implementation of executable directives currently in place within federation requires that federated directives be declared identically across all implementing services, even if their implementation is different (or a no-op). This is working as intended! However, [Type system directives] need some additional pruning from the composed schema. Specifically, while type system directive declarations don't need to be declared identically across implementing services, their _definitions_ are currently (intentionally!) removed from the composed schema. That would be fine, but the _usages_ of those directives are currently being left in-tact, which results in validation errors within composed schemas since the directives, while still defined in the implementing services, have been removed. It's certainly important that the implementing services maintain those type system directives in order to act upon them within the services themselves, I don't believe those directives need to be preserved in the composed schema that runs at the gateway and is used to generate the query plan. This commit is mostly documenting a reproduction of an issue that was brought to my attention and introduces what I believe is a test case to build a solution against. [Type system directive]: https://graphql.github.io/graphql-spec/draft/#TypeSystemDirectiveLocation [Executable directive]: https://graphql.github.io/graphql-spec/draft/#ExecutableDirectiveLocation
abernix
added a commit
that referenced
this pull request
Nov 27, 2019
> Note: This is not the solution, just a test that demonstrates the failure! Recently, the beginnings of [Executable directive] support were brought into federation through #3464 and its follow-up, #3536. The implementation of executable directives currently in place within federation requires that federated directives be declared identically across all implementing services, even if their implementation is different (or a no-op). This is working as intended! However, [Type system directives] need some additional pruning from the composed schema. Specifically, while type system directive declarations don't need to be declared identically across implementing services, their _definitions_ are currently (intentionally!) removed from the composed schema. That would be fine, but the _usages_ of those directives are currently being left in-tact, which results in validation errors within composed schemas since the directives, while still defined in the implementing services, have been removed. It's certainly important that the implementing services maintain those type system directives in order to act upon them within the services themselves, I don't believe those directives need to be preserved in the composed schema that runs at the gateway and is used to generate the query plan. This commit is mostly documenting a reproduction of an issue that was brought to my attention and introduces what I believe is a test case to build a solution against. [Type system directive]: https://graphql.github.io/graphql-spec/draft/#TypeSystemDirectiveLocation [Executable directive]: https://graphql.github.io/graphql-spec/draft/#ExecutableDirectiveLocation
josemarluedke
pushed a commit
to josemarluedke/apollo-server
that referenced
this pull request
Jan 29, 2020
> Note: This is not the solution, just a test that demonstrates the failure! Recently, the beginnings of [Executable directive] support were brought into federation through apollographql#3464 and its follow-up, apollographql#3536. The implementation of executable directives currently in place within federation requires that federated directives be declared identically across all implementing services, even if their implementation is different (or a no-op). This is working as intended! However, [Type system directives] need some additional pruning from the composed schema. Specifically, while type system directive declarations don't need to be declared identically across implementing services, their _definitions_ are currently (intentionally!) removed from the composed schema. That would be fine, but the _usages_ of those directives are currently being left in-tact, which results in validation errors within composed schemas since the directives, while still defined in the implementing services, have been removed. It's certainly important that the implementing services maintain those type system directives in order to act upon them within the services themselves, I don't believe those directives need to be preserved in the composed schema that runs at the gateway and is used to generate the query plan. This commit is mostly documenting a reproduction of an issue that was brought to my attention and introduces what I believe is a test case to build a solution against. [Type system directive]: https://graphql.github.io/graphql-spec/draft/#TypeSystemDirectiveLocation [Executable directive]: https://graphql.github.io/graphql-spec/draft/#ExecutableDirectiveLocation
trevor-scheer
pushed a commit
that referenced
this pull request
Jan 30, 2020
> Note: This is not the solution, just a test that demonstrates the failure! Recently, the beginnings of [Executable directive] support were brought into federation through #3464 and its follow-up, #3536. The implementation of executable directives currently in place within federation requires that federated directives be declared identically across all implementing services, even if their implementation is different (or a no-op). This is working as intended! However, [Type system directives] need some additional pruning from the composed schema. Specifically, while type system directive declarations don't need to be declared identically across implementing services, their _definitions_ are currently (intentionally!) removed from the composed schema. That would be fine, but the _usages_ of those directives are currently being left in-tact, which results in validation errors within composed schemas since the directives, while still defined in the implementing services, have been removed. It's certainly important that the implementing services maintain those type system directives in order to act upon them within the services themselves, I don't believe those directives need to be preserved in the composed schema that runs at the gateway and is used to generate the query plan. This commit is mostly documenting a reproduction of an issue that was brought to my attention and introduces what I believe is a test case to build a solution against. [Type system directive]: https://graphql.github.io/graphql-spec/draft/#TypeSystemDirectiveLocation [Executable directive]: https://graphql.github.io/graphql-spec/draft/#ExecutableDirectiveLocation
abernix
added a commit
that referenced
this pull request
Jan 31, 2020
* tests: Show composition failures w/ undeclared type-system directives. > Note: This is not the solution, just a test that demonstrates the failure! Recently, the beginnings of [Executable directive] support were brought into federation through #3464 and its follow-up, #3536. The implementation of executable directives currently in place within federation requires that federated directives be declared identically across all implementing services, even if their implementation is different (or a no-op). This is working as intended! However, [Type system directives] need some additional pruning from the composed schema. Specifically, while type system directive declarations don't need to be declared identically across implementing services, their _definitions_ are currently (intentionally!) removed from the composed schema. That would be fine, but the _usages_ of those directives are currently being left in-tact, which results in validation errors within composed schemas since the directives, while still defined in the implementing services, have been removed. It's certainly important that the implementing services maintain those type system directives in order to act upon them within the services themselves, I don't believe those directives need to be preserved in the composed schema that runs at the gateway and is used to generate the query plan. This commit is mostly documenting a reproduction of an issue that was brought to my attention and introduces what I believe is a test case to build a solution against. [Type system directive]: https://graphql.github.io/graphql-spec/draft/#TypeSystemDirectiveLocation [Executable directive]: https://graphql.github.io/graphql-spec/draft/#ExecutableDirectiveLocation * Remove directives from field definition in composition * Expand functionality to all custom type system directives * Update stripping mechanism to include all TypeSystemDirectives * Jest auto-prettification of snapshots * Rename var in composition to match implementation * Add changelog entry for PR #3736 * nit: Line-length. It's bad in this file altogether, but broad re-formatting of this file won't do anything better than stomp on history. Since this line is already changing, it's worth a fix in the same commit. * Change `definition` to be a `const`-ant rather than `let`. The overall height of this block seems to be a ripe opportunity to try to lock down the re-assignment of this objects' reference, even if it wasn't introduced by this PRs intended change. * Add a comment about what `null` return does on visits. * Add a comment about why we're stripping type system directives. Co-authored-by: Jesse Rosenberger <[email protected]> Co-authored-by: Trevor Scheer <[email protected]>
This was referenced Feb 10, 2020
Federation: support custom directives in federated schemas
apollographql/apollo-feature-requests#145
Closed
abernix
pushed a commit
to apollographql/federation
that referenced
this pull request
Sep 4, 2020
…/apollo-server#3536) * Remove the notion of executable directives only validation TypeSystemDirectiveLocations will now be ignored by composition, meaning service implementors need not worry about their existence at all. This validation rule no longer applies. * Ignore TypeSystemDirectiveLocations during composition Ignoring TypeSystemDirectiveLocations during composition allows services to implement directives which use both types of locations, while the resulting composed schema only accounts for executable locations. This allows for more lax validation rules without affecting the query planner. This also unblocks users who previously had type system directives working in their services prior to the addition of directive validations. Apollo-Orig-Commit-AS: apollographql/apollo-server@e541777
abernix
pushed a commit
to apollographql/federation
that referenced
this pull request
Sep 4, 2020
…ollo-server#3736) * tests: Show composition failures w/ undeclared type-system directives. > Note: This is not the solution, just a test that demonstrates the failure! Recently, the beginnings of [Executable directive] support were brought into federation through apollographql/apollo-server#3464 and its follow-up, apollographql/apollo-server#3536. The implementation of executable directives currently in place within federation requires that federated directives be declared identically across all implementing services, even if their implementation is different (or a no-op). This is working as intended! However, [Type system directives] need some additional pruning from the composed schema. Specifically, while type system directive declarations don't need to be declared identically across implementing services, their _definitions_ are currently (intentionally!) removed from the composed schema. That would be fine, but the _usages_ of those directives are currently being left in-tact, which results in validation errors within composed schemas since the directives, while still defined in the implementing services, have been removed. It's certainly important that the implementing services maintain those type system directives in order to act upon them within the services themselves, I don't believe those directives need to be preserved in the composed schema that runs at the gateway and is used to generate the query plan. This commit is mostly documenting a reproduction of an issue that was brought to my attention and introduces what I believe is a test case to build a solution against. [Type system directive]: https://graphql.github.io/graphql-spec/draft/#TypeSystemDirectiveLocation [Executable directive]: https://graphql.github.io/graphql-spec/draft/#ExecutableDirectiveLocation * Remove directives from field definition in composition * Expand functionality to all custom type system directives * Update stripping mechanism to include all TypeSystemDirectives * Jest auto-prettification of snapshots * Rename var in composition to match implementation * Add changelog entry for PR apollographql/apollo-server#3736 * nit: Line-length. It's bad in this file altogether, but broad re-formatting of this file won't do anything better than stomp on history. Since this line is already changing, it's worth a fix in the same commit. * Change `definition` to be a `const`-ant rather than `let`. The overall height of this block seems to be a ripe opportunity to try to lock down the re-assignment of this objects' reference, even if it wasn't introduced by this PRs intended change. * Add a comment about what `null` return does on visits. * Add a comment about why we're stripping type system directives. Co-authored-by: Jesse Rosenberger <[email protected]> Co-authored-by: Trevor Scheer <[email protected]> Apollo-Orig-Commit-AS: apollographql/apollo-server@db71535
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ignoring
TypeSystemDirectiveLocations
during composition allows services to implement directives which use both types of locations, while the resulting composed schema only accounts for executable locations.This allows for more lax validation rules without affecting the query planner. This also unblocks users who previously had type system directives working in their services prior to the addition of custom directive validations.