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

formatParams replacement and GraphQLExtension #1404

Closed
richgilbank opened this issue Jul 23, 2018 · 4 comments
Closed

formatParams replacement and GraphQLExtension #1404

richgilbank opened this issue Jul 23, 2018 · 4 comments
Labels
📝 documentation Focuses on changes to the documentation (docs)

Comments

@richgilbank
Copy link

Hi folks!

It looks like the removal of formatParams from the ApolloServer constructor options eliminates the approach some have taken to omit __typename from mutations derived from query results.
See here: apollographql/apollo-client#1564
This may be a bit of an edge case, but there seems to be a number of issues relating to the following situation:

  • Query for a data set from Apollo Server, using Apollo Client.
  • [__typename is added to the query result]
  • Locally modify the data set and send it back as a mutation.
  • Rejection due to __typename not being defined in the typedefs.

One workaround to this has historically been using formatParams to omit the __typename key from any incoming variables, so it doesn't have to happen on the client side (and consequently doesn't have to be implemented in every consumer).
@evans mentioned "The experimental, non-public graphql-extensions provides a more structured and flexible way of instrumenting Apollo Server", though I haven't seen any implementations or docs that might help to do so.

So, I suppose any of the following would really help to clarify usage with the new approach:

  • Add a demo or docs for graphql-extensions
  • Add tests for graphql-extensions
  • Document extensions publicly with the ApolloServer docs

Or is it a short-term workaround that shouldn't be documented yet?
Thanks!

@ghost ghost added the 📝 documentation Focuses on changes to the documentation (docs) label Jul 23, 2018
@martijnwalraven
Copy link
Contributor

The reason we removed formatParams is that it depended on implementation details of Apollo Server that we don't want to be bound to. graphql-extensions is not an API we're committed to either, but it could be used as a short term workaround. We're working on a more flexible extension API for the next version of Apollo Server, so hopefully we'll have a more permanent solution in a few weeks.

To make sure that covers your use case, do I get it right you want to modify variables for an incoming GraphQL request?

@richgilbank
Copy link
Author

Ah, ok so it probably doesn't make sense to document it for now then.
Yes, exactly...walking through the variables on an incoming request to omit any nested __typename keys.

@terion-name
Copy link

No solution yet? My entire app can't work without this

@jbaxleyiii jbaxleyiii added the 🚧👷‍♀️👷‍♂️🚧 in triage Issue currently being triaged label Jul 8, 2019
@jbaxleyiii
Copy link
Contributor

Hey @richgilbank @terion-name this is something that can be done using the new request pipeline that is supported now and will be getting a lot more support (and docs) in the future!

@abernix abernix removed 🚧👷‍♀️👷‍♂️🚧 in triage Issue currently being triaged labels Jul 9, 2019
@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
📝 documentation Focuses on changes to the documentation (docs)
Projects
None yet
Development

No branches or pull requests

5 participants