You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assume I have n remote schemas, and I would like to merge the Query, Mutation and Subscription from different schemas into a single schema, except, each remote schema is placed under their own type.
Assume we have a remote schema called MenuX with:
type Item {
id: Int!
description: String
cost: Int
}
type Query {
items: [Item]
}
and a remote schema called MenuY with:
type Item {
id: Int!
name: String
cost: Int
}
type Query {
items: [Item]
}
I would like to merge the schema into a single schema but under their own types. A contrived example:
type MenuXItem {
id: Int!
description: String
cost: Int
}
type MenuYItem {
id: Int!
name: String
cost: Int
}
type MenuXQuery {
items: [MenuXItem]
}
type MenuYQuery {
items: [MenuYItem]
}
type Query {
MenuX: MenuXItem
MenuY: MenuYItem
}
As we can see that under the Query type it contains two new types which contain the query type from the remote schemas. Item from schema MenuX have been renamed by using the transformers from graphql-tools, similarly Item from schema MenuY has been transformed as well.
But is it possible to transform the structure as well?
With the actual remote schemas from Contentful, we are looking at hundreds of types from each schema, and ideally, I would like to not pollute the root types and the Introspection documentation in GraphiQL.
But I think the bigger discussion is what is the standard with merging schemas? Merge in a flat structure or nested structure?
The text was updated successfully, but these errors were encountered:
It seems others want to go the direction of prefixing the types, but I agree that the root namespace should not be polluted. I've been digging into a way to achieve this locally without a major hack. It seems to me that if we're already mounting remote schemas into our local schema, it should cost us little effort in order to add structure. After all, were we writing this ourselves, we could easily achieve this. There is something to be said for semantic namespacing, which is not only cleaner, but self-documenting.
/label discussion
Assume I have
n
remote schemas, and I would like to merge theQuery
,Mutation
andSubscription
from different schemas into a single schema, except, each remote schema is placed under their own type.Assume we have a remote schema called
MenuX
with:and a remote schema called
MenuY
with:I would like to merge the schema into a single schema but under their own types. A contrived example:
As we can see that under the Query type it contains two new types which contain the query type from the remote schemas. Item from schema
MenuX
have been renamed by using the transformers fromgraphql-tools
, similarly Item from schemaMenuY
has been transformed as well.But is it possible to transform the structure as well?
With the actual remote schemas from Contentful, we are looking at hundreds of types from each schema, and ideally, I would like to not pollute the root types and the Introspection documentation in GraphiQL.
But I think the bigger discussion is what is the standard with merging schemas? Merge in a flat structure or nested structure?
The text was updated successfully, but these errors were encountered: