Solving name conflicts at the gateway (e.g. types or directives) when you've got local schemas being stitched too. In this example the gateway schema has the dupe type on it and we let the merge handler skip the version/s on the downstream service/s, but if you didn't have the type added at the gateway, you could choose to pick one instance from one of the downstream services and skip the others.
var gatewayBuilder = services
// Base schema
.AddGraphQLServer()
// Add authorization services and types (will require merge handling if a downstream service adds auth too)
// If you didn't have local schemas being stitched and don't need authorization middleware to run on your gateway, don't do this and then merging is automatic)
.AddAuthorization()
// Add Relay Node type (will require merge handling if a downstream service adds relay support too)
.AddType<NodeType>()
.AddDirectiveMergeHandler<MergeDirectivesHandler>()
.AddTypeMergeHandler<MergeTypesHandler>()
Adding custom scalars onto the stitched-in schema on the gateway.
var remoteSchemaName = "Bookings";
// Stitch in remote schema into the gateway schema
gatewayBuilder.AddRemoteSchema(remoteSchemaName, ignoreRootTypes: false);
// Adding the remote schema above will create a local representation in the gateay
// You can get / modify that local representation by grabbing it again by name as below
// Configure additionally (may not be needed in later versions)
gatewayBuilder.Services
.AddGraphQL(remoteSchemaName)
// Currently you need to re-add custom scalars here
// though this may change in v13
.AddType<EmailAddressType>() // from HotChocolate.Types.Scalars prob
;
But then the gateway which has the authorization added blocks the request to the services, because it needs to authenticate the user