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

fix(federation): Create new @key validations #4498

Merged
merged 9 commits into from
Aug 25, 2020

Conversation

trevor-scheer
Copy link
Member

A few cases of invalid @key directive arrangements are currently possible
with our current validation suite. This commit adds 3 new validations
to ensure that users are informed of these invalid states and block
composition appropriately.

  1. Owning type must specify a @key
  2. Extending types can't specify multiple @keys
  3. Extending types must use a @key specified by the owning type

Additionally:
These invalid arrangements can result in runtime errors when printing CSDL,
nor is it really valid to return an "attempted" print of CSDL, so the result
of composedSdl is now undefined in the case that there are composition
errors.

…sitions

A few cases of invalid @key directive arrangements are currently possible
with our current validation suite. This commit adds 3 new validations
to ensure that users are informed of these invalid states and block
composition appropriately.

1. Owning type must specify a @key
2. Extending types can't specify multiple @keys
3. Extending types must use a key specified by the owning type

Additionally:
These invalid arrangements can result in runtime errors when printing CSDL,
nor is it really valid to return an "attempted" print of CSDL, so the result
of `composedSdl` is now `undefined` in the case that there are composition
errors.
@trevor-scheer trevor-scheer changed the title fix(federation): Create new @key validations to prevent invalid compositions fix(federation): Create new @key validations Aug 25, 2020
@trevor-scheer trevor-scheer merged commit 7b8678f into main Aug 25, 2020
@trevor-scheer trevor-scheer deleted the trevor/key-validations branch August 25, 2020 20:07
abernix pushed a commit to apollographql/federation that referenced this pull request Sep 4, 2020
…rver#4498)

A few cases of invalid @key directive arrangements are currently possible
with our existing validation suite. This PR adds 3 new validations
to ensure that users are informed of these invalid states and block
composition appropriately.

* Owning type must specify a @key
* Extending types can't specify multiple @keys
* Extending types must use a @key specified by the owning type

Additionally:
These invalid arrangements can result in runtime errors when printing CSDL,
nor is it really valid to return an "attempted" print of CSDL, so the result
of `composedSdl` is now `undefined` in the case that there are composition
errors.
Apollo-Orig-Commit-AS: apollographql/apollo-server@7b8678f
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants