[V1] Can't use "resolveTo" with type, query or field renaming
Issue workflow progress
Progress of the issue based on the Contributor Workflow
- [ ] 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox
Make sure to fork this template and run
yarn generatein the terminal.Please make sure Mesh package versions under
package.jsonmatches yours.
- [ ] 2. A failing test has been provided
- [ ] 3. A local solution has been provided
- [ ] 4. A pull request is pending review
Describe the bug
When use @resolveTo with renaming source OpenApi (And other i think), that's not working.
TypeDef without renaming =>
additionalTypeDefs: `
extend type PointOfSale {
test: [MS_Agency_CicsAgencyResponse]
@resolveTo(
sourceName: "ms-agency"
sourceTypeName: "Query"
sourceFieldName: "getCicsByIdUsingGET"
requiredSelectionSet: "{ agencyId }"
sourceArgs: { agency_id: "{root.agencyId}" }
)
}
`
==> Work
But my renaming =>
createRenameTransform({
typeRenamer: ({ typeName }) => {
switch (typeName) {
case "MS_Agency_AgencyResponse":
return "PointOfSale";
default:
return typeName;
}
},
fieldRenamer: ({ typeName, fieldName }) => {
if(typeName === "MS_Agency_Query" && fieldName === "MS_Agency_getCicsByIdUsingGET") {
return "getCicsById";
}
return fieldName;
},
}),
So new typedef :
TypeDef without renaming =>
additionalTypeDefs: `
extend type PointOfSale {
test: [MS_Agency_CicsAgencyResponse]
@resolveTo(
sourceName: "ms-agency"
sourceTypeName: "Query"
sourceFieldName: "getCicsById"
requiredSelectionSet: "{ agencyId }"
sourceArgs: { agency_id: "{root.agencyId}" }
)
}
`
That's not working
Note : As you can see, even Query should be called MS_Agency_Query
To Reproduce Steps to reproduce the behavior:
See above
Expected behavior
Error: No field named "getCicsById" exists in the type Query from the source ms-agency at resolve (file:///C:/Sources/test-gm/graphql-mesh-debug/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_gra_7udymn4ftqclyxdht2baqulwli/node_modules/@graphql-mesh/utils/esm/resolve-additional-resolvers.js:201:35) at executeField (file:///C:/Sources/test-gm/graphql-mesh-debug/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/executor/esm/execution/execute.js:317:24) at executeFields (file:///C:/Sources/test-gm/graphql-mesh-debug/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/executor/esm/execution/execute.js:265:28) at collectAndExecuteSubfields (file:///C:/Sources/test-gm/graphql-mesh-debug/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/executor/esm/execution/execute.js:694:23) at completeObjectValue (file:///C:/Sources/test-gm/graphql-mesh-debug/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/executor/esm/execution/execute.js:684:12) at completeValue (file:///C:/Sources/test-gm/graphql-mesh-debug/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/executor/esm/execution/execute.js:452:16) at file:///C:/Sources/test-gm/graphql-mesh-debug/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/executor/esm/execution/execute.js:320:49 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async file:///C:/Sources/test-gm/graphql-mesh-debug/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/executor/esm/execution/promiseForObject.js:15:35 at async Promise.all (index 0)
Environment:
- OS: Windows "@graphql-hive/gateway": "^1.0.6", "@graphql-mesh/compose-cli": "^1.0.3", "@graphql-mesh/serve-cli": "^1.0.5", "@omnigraph/openapi": "^0.106.8", "@graphql-mesh/plugin-http-details-extensions": "^0.102.5", "@graphql-mesh/types": "^0.102.5",
- NodeJS: 21
Additional context