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: move federation validations to didBuildSchema hook #1883

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

dariuszkuc
Copy link
Collaborator

📝 Description

We were previously validating usage of @key/@requires/@provides directives when constructing the schema. While it generally worked fine, it is possible to craft a schema when generated types still reference types under construction (see: #1858) and we would have to skip those validations. By moving the validation to the last phase of schema generation, we always have a valid GraphQL schema at that point with resolved references and we can apply validations against all entities at once so we can have single error message with all validations (vs failing the build for each invalid entity).

🔗 Related Issues

#1858

We were previously validating usage of `@key`/`@requires`/`@provides` directives when constructing the schema. While it generally worked fine, it is possible to craft a schema when generated types still reference types under construction (see: ExpediaGroup#1858) and we would have to skip those validations. By moving the validation to the last phase of schema generation, we always have a valid GraphQL schema at that point with resolved references and we can apply validations against all entities at once so we can have single error message with all validations (vs failing the build for each invalid entity).
@dariuszkuc dariuszkuc added changes: patch Changes require a patch version module: generator Issue affects the schema generator and federation code labels Nov 10, 2023
@dariuszkuc dariuszkuc enabled auto-merge (squash) November 10, 2023 16:33
@dariuszkuc dariuszkuc merged commit ea770ef into ExpediaGroup:master Nov 28, 2023
10 checks passed
@dariuszkuc dariuszkuc deleted the fed_validations branch November 28, 2023 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes: patch Changes require a patch version module: generator Issue affects the schema generator and federation code
Development

Successfully merging this pull request may close these issues.

2 participants