-
-
Notifications
You must be signed in to change notification settings - Fork 816
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
stitchSchemas with namespaced queries and mutations #4047
Comments
I used different options for describing fieldName with merge AssetClass from AssetClassService: In addition, the query that I indicated above gave the result without additional merge options, but except for the assetClass {..., assetClass: null} field. However, when I added to the AssetClassService in the schema
The request stopped returning data.
test various options ... return stitchSchemas({
subschemas: [
{
schema: await introspectSchema(assetServiceExecutor),
executor: assetServiceExecutor,
merge: {
Asset: {
canonical: true,
selectionSet: '{ id }',
fieldName: 'Asset.getList',
args: ({ id }) => {
return { id }
},
},
AssetClass: {
selectionSet: '{ id }',
fieldName: 'getMany',
key: (root, args, context, info) => {
return root.id
},
argsFromKeys: (root, args, context, info) => {
return { ids: root.ids }
},
}
}
},
{
schema: await introspectSchema(assetClassServiceExecutor),
executor: assetClassServiceExecutor,
batch: true,
merge: {
Asset: {
selectionSet: '{ id assets }',
fieldName: 'Asset._resolveReference',
key: (root, args, context, info) => {
return root.assets
},
argsFromKeys: (root, args, context, info) => {
return { ids: root.assets }
},
},
AssetClass: {
canonical: true,
selectionSet: '{ id }',
fieldName: 'AssetClass.getMany',
key: (root, args, context, info) => {
return root.id
},
argsFromKeys: (root, args, context, info) => {
return { ids: root.ids }
},
}
}
},
],
});
} |
Thanks for reporting this issue. Would you create a PR with a failing test? |
@ardatan , Here is a repository with two examples: https://github.com/denisgnt/gateway-service-example. |
Discussed in #4042
Originally posted by wmwart December 22, 2021
Good afternoon.
I have a question about using stitchSchemas with namespaced queries and mutations.
I have 2 remote services:
and
Thus, when using stitchSchemas in my proxy service, a function for obtaining a stitched schema appeared:
Which allows me to fulfill the request:
However, none of the combination of
merge
options of these subcircuits specified in the documentation and examples of use returned me the required answer.I assume that the problem is precisely in the namespaced types.
Please help me specify the correct settings for
merge
options or share a link to a solution to a similar problemThe text was updated successfully, but these errors were encountered: