Skip to content
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

feat(gateway): Strip federation primitives during normalization #4209

Merged
merged 4 commits into from
Jun 8, 2020

Conversation

trevor-scheer
Copy link
Member

@trevor-scheer trevor-scheer commented Jun 5, 2020

This PR makes references to "federation primitives". This is just a way
of saying all of the additions to a schema that federation requires as
listed here in the spec.

This commit removes all federation primitives during the
normalization step of composition. This simplifies the lives of
all non-ApolloServer federation implementors.

buildFederatedSchema goes to some lengths to provide a limited
subset of SDL in the { _service { sdl } } resolver. In its current form,
composition expects this format. This subset is fairly
easy to achieve in JavaScript land, but isn't necessarily simple
in other, non-JS graphql reference implementations. This has been
an outstanding pain point for an endless number of users and
can be quite simply normalized away during this step.

This enables implementors to return a service's complete SDL from
the { _service { sdl } } resolver without any errors. For
unmanaged users, the gateway will now normalize the federation
primitives away. For managed users, our backend will allow
a service:push to contain federation primitives which will be
normalized away in the same fashion.

Fixes #3334

This commit removes all federation primitives during the
normalization step of composition. This simplifies the lives of
all non-ApolloServer federation implementors.

`buildFederatedSchema` goes to some lengths to provide a limited
subset of SDL in the { _service { sdl } } resolver. In its current form, composition expects this format. This subset is fairly
easy to achieve in JavaScript land, but isn't necessarily simple
in other, non-JS graphql reference implementations. This has been
an outstanding pain point for an endless number of users and
can be quite simply normalized away during this step.

This enables implementors to return a service's complete SDL from
the { _service { sdl } } resolver without any errors. For
unmanaged users, the gateway will now normalize the federation
primitives away. For managed users, our backend will allow
a `service:push` to contain federation primitives which will be
normalized away in the same fashion.
@trevor-scheer trevor-scheer merged commit b739e21 into master Jun 8, 2020
@trevor-scheer trevor-scheer deleted the trevor/permit-federation-definitions branch June 8, 2020 21:24
trevor-scheer added a commit that referenced this pull request Jun 8, 2020
trevor-scheer added a commit that referenced this pull request Jun 9, 2020
This commit adds additional normalization to composition inputs in order to
prevent duplicate directive errors when constructing the schema.

The oversight from #4209 that's being corrected by this commit is to _also_
remove specified directive definitions (to be included by the composition
work itself). Failure to remove them during composition results in duplicate
definitions and graphql validation errors.
trevor-scheer added a commit that referenced this pull request Jun 11, 2020
This commit adds additional normalization to composition inputs in order to
prevent duplicate directive errors when constructing the schema.

The oversight from #4209 that's being corrected by this PR is to also remove
specified directive definitions (@deprecated, @Skip, @include, and
@SpecifiedBy) from composition inputs. Failure to remove them during
composition results in duplicate definitions and graphql validation errors if
they are included in the composition inputs.
abernix pushed a commit to apollographql/federation that referenced this pull request Sep 4, 2020
…lographql/apollo-server#4209)

This commit makes references to "federation primitives". This is just a way
of saying all of the additions to a schema that federation requires as
listed in the spec.

This commit removes all federation primitives during the
normalization step of composition. This simplifies the lives of
all non-ApolloServer federation implementors.

buildFederatedSchema goes to some lengths to provide a limited
subset of SDL in the { _service { sdl } } resolver. In its current form,
composition expects this format. This subset is fairly
easy to achieve in JavaScript land, but isn't necessarily simple
in other, non-JS graphql reference implementations. This has been
an outstanding pain point for an endless number of users and
can be quite simply normalized away during this step.

This enables implementors to return a service's complete SDL from
the { _service { sdl } } resolver without any errors. For
unmanaged users, the gateway will now normalize the federation
primitives away. For managed users, our backend will allow
a service:push to contain federation primitives which will be
normalized away in the same fashion.

Fixes apollographql/apollo-server#3334
Apollo-Orig-Commit-AS: apollographql/apollo-server@b739e21
abernix pushed a commit to apollographql/federation that referenced this pull request Sep 4, 2020
abernix pushed a commit to apollographql/federation that referenced this pull request Sep 4, 2020
…-server#4209 (apollographql/apollo-server#4228)

This commit adds additional normalization to composition inputs in order to
prevent duplicate directive errors when constructing the schema.

The oversight from apollographql/apollo-server#4209 that's being corrected by this PR is to also remove
specified directive definitions (@deprecated, @Skip, @include, and
@SpecifiedBy) from composition inputs. Failure to remove them during
composition results in duplicate definitions and graphql validation errors if
they are included in the composition inputs.
Apollo-Orig-Commit-AS: apollographql/apollo-server@672fb1b
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Federated schema SDL cannot include federation definitions
3 participants