Exception on HoistFieldTransform with a PrefixTransform (V1)
Closed this issue · 0 comments
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 generate
in the terminal.Please make sure Mesh package versions under
package.json
matches 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 attempting to use a HoistFieldTransform with a PrefixTransform, the Hive runtime throws an error: 'TypeError: Cannot read properties of undefined (reading 'getFields')'
To Reproduce Steps to reproduce the behavior:
{
sourceHandler: loadOpenAPISubgraph('Weather', {
source: 'https://api.apis.guru/v2/specs/weatherbit.io/2.0.0/swagger.json',
ignoreErrorResponses: true,
queryParams: {
key: `${process.env.WEATHERBIT_API_KEY}`,
},
operationHeaders: {
'X-RapidAPI-Key': `${process.env.WEATHERBIT_API_KEY}`,
},
}),
transforms: [
createRenameTypeTransform(({ typeName }) =>
typeName === 'Error' ? 'WeatherError' : typeName,
),
createPrefixTransform({
value: "MyTestWeather_",
includeRootOperations: false,
}),
createHoistFieldTransform({
mapping: [
{
typeName: "MyTestWeather_CurrentObs",
pathConfig: ["weather", "description"],
newFieldName: "MyDescription",
},
],
}),
],
},
Package
"@graphql-hive/gateway": "^1.0.5",
"@graphql-mesh/compose-cli": "^1.0.2",
"@graphql-mesh/serve-cli": "^1.0.4",
"@omnigraph/openapi": "^0.106.8",
"graphql": "^16.9.0",
Expected behavior
Current exception :
TypeError: Cannot read properties of undefined (reading 'getFields')
at file:///C:/SourcesPerso/test/v1-next/openapi-location-weather/node_modules/.pnpm/@graphql-tools+wrap@10.0.5_graphql@16.9.0/node_modules/@graphql-tools/wrap/esm/transforms/HoistField.js:38:31
at Array.reduce ()
at HoistField.transformSchema (file:///C:/SourcesPerso/test/v1-next/openapi-location-weather/node_modules/.pnpm/@graphql-tools+wrap@10.0.5_graphql@16.9.0/node_modules/@graphql-tools/wrap/esm/transforms/HoistField.js:37:44)
at file:///C:/SourcesPerso/test/v1-next/openapi-location-weather/node_modules/.pnpm/@graphql-tools+delegate@10.0.21_graphql@16.9.0/node_modules/@graphql-tools/delegate/esm/applySchemaTransforms.js:8:86
at Array.reduce ()
at applySchemaTransforms (file:///C:/SourcesPerso/test/v1-next/openapi-location-weather/node_modules/.pnpm/@graphql-tools+delegate@10.0.21_graphql@16.9.0/node_modules/@graphql-tools/delegate/esm/applySchemaTransforms.js:8:29)
at memoized (file:///C:/SourcesPerso/test/v1-next/openapi-location-weather/node_modules/.pnpm/@graphql-tools+utils@10.5.4_graphql@16.9.0/node_modules/@graphql-tools/utils/esm/memoize.js:20:30)
at wrapSchema (file:///C:/SourcesPerso/test/v1-next/openapi-location-weather/node_modules/.pnpm/@graphql-tools+wrap@10.0.5_graphql@16.9.0/node_modules/@graphql-tools/wrap/esm/wrapSchema.js:9:25)
at memoized (file:///C:/SourcesPerso/test/v1-next/openapi-location-weather/node_modules/.pnpm/@graphql-tools+utils@10.5.4_graphql@16.9.0/node_modules/@graphql-tools/utils/esm/memoize.js:6:30)
at buildTypeCandidates (file:///C:/SourcesPerso/test/v1-next/openapi-location-weather/node_modules/.pnpm/@graphql-tools+stitch@9.2.10_graphql@16.9.0/node_modules/@graphql-tools/stitch/esm/typeCandidates.js:27:55)
Environment:
- OS: Windows
@graphql-mesh/...
: V1- NodeJS: 22.8
Additional context