I'm currently working on combining two different GraphQL graphs into a single Apollo GraphQL supergraph (Apollo Federated Gateway). However, I've encountered a problem where both graphs have a getUser
query and an updateUser
mutation with the same naming. This is causing conflicts, and I'm unsure how to resolve them.
Here's a simplified example of the issue I'm facing:
Graph 1
type Mutation {
createUser(input: CreateUserInput!): User!
}
type Query {
getUser(id: ID!): User!
}
Graph 2
type Mutation {
createUser(input: CreateUserInput!): User!
}
type Query {
getUser(id: ID!): User!
}
As you can see, both graphs define a Query
type with the same getUser
field and a Mutation
type with the same createUser
field.
When attempting to combine these graphs into a supergraph using Apollo Gateway, I encounter errors due to the naming conflicts.
Has anyone else faced a similar issue when combining GraphQL graphs with conflicting query/mutation names? How can I resolve these conflicts and successfully combine the graphs into a supergraph?
I've considered renaming the conflicting fields, but that might introduce breaking changes to the existing clients. Is there a way to differentiate between the queries/mutations from the two graphs within the supergraph without changing the original naming in the individual graphs?
I would greatly appreciate any insights, suggestions, or best practices regarding this issue. Thank you!