-
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
Update graphql-tools to v7 scoped packages and simplify dependency #5183
Conversation
Note that a previous commit on `release-3.0` stopped exporting all `graphql-tools` exports from our packages, but the docs had not yet been updated. - Update from `graphql-tools@4` to the newest version of various `@graphql-tools/X` packages. - Make it clear that the use of `graphql-tools` functionality in Apollo Server is essentially a convenience for the most common use cases, and that folks who want to use detailed `graphql-tools` functionality are welcome to do so directly. - Remove support for `schemaDirectives`. This `makeExecutableSchema` option is considered to be legacy by `graphql-tools` these days, so this seems like a reasonable time to drop it from the Apollo Server API. Folks who want to keep using it can use `makeExecutableSchema` from `@graphql-tools/schema` directly, or ideally switch to the newer `schemaTransforms`. Stop documenting it. - Remove most docs that just duplicate `graphql-tools` docs. (Keep some of the mocking docs.) - Update mocking support to use `addMocksToSchema` from `@graphql-tools/mock` rather than `addMockFunctionsToSchema` from `graphql-tools`. Note that this has some backwards-incompatible changes, mentioned in the CHANGELOG. Update docs to not claim you can look at arguments in mock functions (that's one of those changes). Document alternative to deprecated `MockList` class. Remove skipped test because presumably the "bug" is by this point expected behavior. - Only apply mocks to schema in the non-`gateway` codepath rather than to schemas provided by the gateway (at startup or later via `onSchemaChange`). Assuming your `gateway` is an `ApolloGateway`, this should be a no-op as `ApolloGateway` provides an `executor` which never calls resolvers on the schema. If you have implemented your own `gateway` which does not have an executor that entirely ignores resolvers, you can always add mocks to the schema returned from `load` and sent to `onSchemaChange` yourself. Inspired by #4237 by @yaacovCR. Fixes #4923.
In the interest of velocity (eg, I want to make some alphas today) I'm going to merge this without review but I definitely want feedback on this soon! |
// to generate a random integer | ||
friends: [...new Array(casual.integer(2, 6))], | ||
// a list of three lists of two items: [[1, 1], [2, 2], [3, 3]] | ||
listOfLists: () => [...new Array(3)].map((i) => [...new Array(2)]), |
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.
Noticed this on a drive-by
listOfLists: () => [...new Array(3)].map((i) => [...new Array(2)]), | |
listOfLists: () => [...new Array(3)].map((_, i) => [i, i]), |
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.
I adapted this from the graphql-tools docs (which I suspect were adapted from these docs in the first place) FWIW. I don't know enough about list mocking to know if the undefined
s in the lists are relevant or not.
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.
LookedGTM.
Note that a previous commit on
release-3.0
stopped exporting allgraphql-tools
exports from our packages, but the docs had not yet beenupdated.
graphql-tools@4
to the newest version of various@graphql-tools/X
packages.graphql-tools
functionality in ApolloServer is essentially a convenience for the most common use cases, and
that folks who want to use detailed
graphql-tools
functionality arewelcome to do so directly.
schemaDirectives
. ThismakeExecutableSchema
option is considered to be legacy by
graphql-tools
these days, sothis seems like a reasonable time to drop it from the Apollo Server
API. Folks who want to keep using it can use
makeExecutableSchema
from
@graphql-tools/schema
directly, or ideally switch to the newerschemaTransforms
. Stop documenting it.graphql-tools
docs. (Keep someof the mocking docs.)
addMocksToSchema
from@graphql-tools/mock
rather thanaddMockFunctionsToSchema
fromgraphql-tools
. Note that this has some backwards-incompatiblechanges, mentioned in the CHANGELOG. Update docs to not claim you can
look at arguments in mock functions (that's one of those changes).
Document alternative to deprecated
MockList
class. Remove skippedtest because presumably the "bug" is by this point expected behavior.
gateway
codepath rather thanto schemas provided by the gateway (at startup or later via
onSchemaChange
). Assuming yourgateway
is anApolloGateway
, thisshould be a no-op as
ApolloGateway
provides anexecutor
whichnever calls resolvers on the schema. If you have implemented your own
gateway
which does not have an executor that entirely ignoresresolvers, you can always add mocks to the schema returned from
load
and sent to
onSchemaChange
yourself.Inspired by #4237 by @yaacovCR. Fixes #4923.