-
Notifications
You must be signed in to change notification settings - Fork 348
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
Extending the schema with additionalResolvers does not work with start command when using namingConvention #4776
Comments
I really tried to create a stackblitz, but it's really hard to replicate my development environment. |
We need it in order to help you :) |
Updated the description with a stackblitz. Running it is a little complicated, but it should show the error. |
@ardatan any update on this? This is preventing us from using |
No update so far. PRs are welcome from anyone interested in. |
Maybe I have the same question. .meshrc.yaml ...
- type: Query
field: pMediaList
path: /platformmedia/list
method: GET
responseSchema: ./json-schemas/applist-schemas.json#/definitions/PMediaDetailResults
....
transforms:
- namingConvention:
typeNames: pascalCase
enumValues: upperCase
fieldNames: camelCase
fieldArgumentNames: camelCase
additionalTypeDefs: |
type AppInfo {
pMediaList: PMediaDetailResults
}
extend type Query {
getAppInfo: AppInfo
}
additionalResolvers:
- ./additionalResolvers applist-schemas.json "PMediaDetail": {
"type": "object",
"title": "PMediaDetail",
"description": "PMediaDetail Object",
"properties": {
"id": {
"type": "integer"
},
"media_name": {
"type": "string"
}
}
},
"PMediaDetailResults": {
"type": "object",
"title": "PMediaDetailResults",
"description": "PMediaDetail Results",
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/PMediaDetail"
},
"uniqueItems": true
}
}
}
additionalResolvers.ts /* eslint-disable @typescript-eslint/no-non-null-assertion */
import { Resolvers } from './.mesh'
export const resolvers: Resolvers = {
Query: {
getAppInfo: async (root, args, context, info) => {
const pMediaList =
await context.SspIdCoreRESTFulApi.Query.pMediaList({
root,
args,
context,
info,
selectionSet: /* GraphQL */ `
{
code
data {
id
mediaName
}
}
`,
valuesFromResults: (results) => {
// console.log(results.data[0].mediaName)
return {
code: results.code,
data: [
{
id: results.data[0].id,
mediaName: results.data[0].mediaName, // not work, it will get mediaName: null
media_name: results.data[0].mediaName, // well, get mediaName: "xxxxxxxxxxxxx"
},
],
}
},
})
return {
pMediaList,
}
},
},
} When I using snakeCase in API side, setting Now I want add a type named |
I fix it now. https://www.the-guild.dev/graphql/mesh/docs/transforms/transforms-introduction#two-different-modes Add transforms at the source level will fix it. |
#4776 (comment) fixed it for me. |
Issue workflow progress
Progress of the issue based on the Contributor Workflow
Describe the bug
In my mesh config file, I am making use of 2 transforms:
namingConvention
inwrap
mode.rename
inwrap
mode.I am then extending the schema by providing additional resolvers within the
.meshrc.yml
file itself.This works fine with
mesh dev
but withmesh start
I getNo field named \"search_accounts\" exists in the type Query from the source Backend
error.To Reproduce on Stackblitz
Steps to reproduce the behavior:
yarn start:rest
in terminal.yarn start:dev
in a second terminal section3000
in the url with4000
(https://github-s58jtv--4000.local-credentialless.webcontainer.io) to get the GraphiQL UI.yarn start
in place ofyarn start:dev
and you should get"No field named \"get_author_by_id\" exists in the type Query from the source Hello World"
error.Expected behavior
The resolvers should object stitch the different types together when request is made.
Environment:
@graphql-mesh/cli
: 0.78.39@graphql-mesh/openapi
: 0.33.28@graphql-mesh/transform-naming-convention
: 0.11.13@graphql-mesh/transform-rename
: 0.12.95Additional context
I tried to debug through
@graphql-mesh/utils/index.js
and saw that the field names in thecontext
object are in camelCase while theschema
object still has them in snake_case. I'm assuming that's is somehow what's causing the error.The text was updated successfully, but these errors were encountered: