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

Update graphql-tools to v7 scoped packages and simplify dependency #5183

Merged
merged 1 commit into from
May 6, 2021

Conversation

glasser
Copy link
Member

@glasser glasser commented May 6, 2021

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.

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.
@glasser
Copy link
Member Author

glasser commented May 6, 2021

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!

@glasser glasser merged commit 698ac3a into release-3.0 May 6, 2021
@glasser glasser deleted the glasser/graphql-tools-update branch May 6, 2021 20:11
// 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)]),
Copy link
Member

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

Suggested change
listOfLists: () => [...new Array(3)].map((i) => [...new Array(2)]),
listOfLists: () => [...new Array(3)].map((_, i) => [i, i]),

Copy link
Member Author

@glasser glasser May 6, 2021

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 undefineds in the lists are relevant or not.

Copy link
Member

@abernix abernix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LookedGTM.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants