-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Validate against using keys that haven't been declared #3227
Conversation
3e7006c
to
7c2d9af
Compare
packages/apollo-federation/src/composition/validate/postComposition/keySelectionSetsDeclared.ts
Outdated
Show resolved
Hide resolved
…al consistency errors.
packages/apollo-federation/src/composition/validate/postComposition/keySelectionSetsDeclared.ts
Outdated
Show resolved
Hide resolved
...-federation/src/composition/validate/postComposition/__tests__/keySelectionSetsMatch.test.ts
Outdated
Show resolved
Hide resolved
packages/apollo-federation/src/composition/validate/postComposition/keySelectionSetsDeclared.ts
Outdated
Show resolved
Hide resolved
return errors; | ||
}; | ||
|
||
const selectionSetToString = (a: FieldNode[]): string => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use graphql.print()
for this or is the outcome different from what I'm imagining?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It gave weird formatting in my experience, also it doesn't operate that smoothly with the FieldNode
array, and we don't have a SelectionSet
to pass it, so idk. Left a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after addressing nits, I'd like to let @jbaxleyiii give thumbs up on error message and code. We could potentially offer the user a list of valid keys in the error, but my hesitation is how to display them, especially considering 1 valid key vs n valid keys. I'm interested in a nice approach to this if possible, but don't have a suggestion.
While this is a valid contribution, this PR has gone stale and was forgotten about (my fault). I recently added some key validations in #4498 which obsolete the need for this, so I'm closing it. |
Closes #3202