-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apollo-server-core: Remove inconsistent
@cacheControl
auto-definiti…
…on (#5182) In Apollo Server 2, ApolloServer *sometimes* adds the definition of `@cacheControl` to your schema. Specifically, it adds it whenever you rely on the implicit call to `graphql-tools`' `makeExecutableSchema` (ie, you pass `typeDefs` and `resolvers`). It doesn't add it when you pass your own `schema`, and oddly it doesn't add it when you use `modules`. On the other hand, it doesn't care if you actually have cache control enabled in your app. What this means is that switching between the implicit call to the built-in version of `makeExecutableSchema` and using your own copy of `graphql-tools` has a surprising impact on your schema. We'd like to make the implicit call just a shorthand and encourage folks who want to use all of the different options of `makeExecutableSchema` to call it directly in their app (rather than having tons of pass-through arguments), so we don't want the semantics to differ in a surprising and undocumented way. Plus, other tools that look at your schema will work better if you define the `@cacheControl` directive explicitly. AS2 did allow you to define the directive yourself (it only adds it if it isn't there). So this PR changes `apollo-server-core` to no longer auto-include the definitions, and documents how to write them yourself. (In the future, we may want to change `@cacheControl` to be a Core Schema feature, but we're not doing that today.) (AS2 had a similar issue with the types related to `graphql-upload` but that integration is removed.) Fixes #5181.
- Loading branch information
Showing
11 changed files
with
68 additions
and
91 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
47 changes: 0 additions & 47 deletions
47
packages/apollo-server-core/src/__tests__/isDirectiveDefined.test.ts
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
packages/apollo-server-core/src/utils/isDirectiveDefined.ts
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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